Integration trig substitution $\int \frac{dx}{x\sqrt{x^2 + 16}}$

UPDATE 2 The first integral is not $\int \frac{dx}{x\sqrt{x^{2}-16}}$ but $\int \frac{dx}{x\sqrt{x^{2}+16}}$ (as noticed by julien), because

\begin{eqnarray*} I &=&\int \frac{dx}{x\sqrt{x^{2}+16}},\qquad x=\tan \theta ,dx=\sec ^{2}\theta d\theta \\ &=&\int \frac{\sec ^{2}\theta }{\left( \tan \theta \right) 4\sec \theta }% \,d\theta =\int \frac{\sec \theta }{4\tan \theta }\,d\theta \\ &=&\int \frac{\sec \theta }{4\tan \theta }\,d\theta =\int \frac{1}{4\sin \theta }\,d\theta \text{.} \end{eqnarray*}


Use the Weierstrass substitution $$t=\tan\frac{\theta}{2}.$$

Then

$$\int \frac{1}{\sin \theta }\,d\theta =\int \frac{2}{\frac{2t}{1+t^{2}} \left( 1+t^{2}\right) }\,dt=\int \frac{1}{t}\,dt=\ln \left\vert t\right\vert +C=\ln \left\vert \tan \frac{\theta }{2}\right\vert +C.$$

Comment: The Weierstrass substitution is a universal standard substitution to evaluate an integral of a rational fraction in $\sin \theta,\cos \theta$, i.e. a rational fraction of the form

$$R(\sin \theta,\cos \theta)=\frac{P(\sin \theta,\cos \theta)}{Q(\sin \theta,\cos \theta)},$$

where $P,Q$ are polynomials in $\sin \theta,\cos \theta$

$$ \begin{equation*} \tan \frac{\theta }{2}=t,\qquad\theta =2\arctan t,\qquad d\theta =\frac{2}{1+t^{2}}dt \end{equation*}, $$

which converts the integrand into a rational function in $t$. We know from trigonometry that

$$\cos \theta =\frac{1-\tan ^{2}\frac{\theta }{2}}{1+\tan ^{2}\frac{ \theta}{2}}=\frac{1-t^2}{1+t^2},\qquad \sin \theta =\frac{2\tan \frac{\theta }{2}}{1+\tan ^{2} \frac{\theta }{2}}=\frac{2t}{1+t^2}.$$

Proof. A possible proof is the following one, which uses the double-angle formulas and the identity $\cos ^{2}\frac{\theta}{2}+\sin ^{2}\frac{\theta}{2}=1$:

$$ \begin{eqnarray*} \cos \theta &=&\cos ^{2}\frac{\theta}{2}-\sin ^{2}\frac{\theta }{2}=\frac{\frac{\cos ^{2} \frac{\theta}{2}-\sin ^{2}\frac{\theta}{2}}{\cos ^{2}\frac{\theta}{2}}}{\frac{\cos ^{2} \frac{\theta}{2}+\sin ^{2}\frac{\theta}{2}}{\cos ^{2}\frac{\theta}{2}}}=\frac{1-\tan ^{2} \frac{\theta}{2}}{1+\tan ^{2}\frac{\theta}{2}}, \\ && \\ \sin \theta &=&2\sin \frac{\theta}{2}\cos \frac{\theta}{2}=\frac{\frac{2\sin \frac{\theta}{2} \cos \frac{\theta}{2}}{\cos ^{2}\frac{\theta}{2}}}{\frac{\cos ^{2}\frac{\theta}{2}+\sin ^{2} \frac{\theta}{2}}{\cos ^{2}\frac{\theta}{2}}}=\frac{2\tan \frac{\theta}{2}}{1+\tan ^{2} \frac{\theta}{2}}. \end{eqnarray*} $$


Another possible substitution is the Euler substitution $$ \begin{equation*} \sqrt{x^{2}+16}=t+x. \end{equation*} $$ Then $$ \begin{eqnarray*} I &=&\int \frac{dx}{x\sqrt{x^{2}+16}}=\int \frac{2}{t^{2}-16}\,dt \\ &=&\int \frac{1}{4\left( t-4\right) }-\frac{1}{4\left( t+4\right) }dt=\frac{1 }{4}\ln \left\vert \frac{t-4}{t+4}\right\vert +C \\ &=&\frac{1}{4}\ln \left\vert \frac{\sqrt{x^{2}+16}-x-4}{\sqrt{x^{2}+16}-x+4} \right\vert +C. \end{eqnarray*} $$


Hint: $$ \begin{align} \int\frac1{\sin(\theta)}\,\mathrm{d}\theta &=\int\frac{\sin(\theta)}{\sin^2(\theta)}\,\mathrm{d}\theta\\ &=-\int\frac1{1-\cos^2(\theta)}\,\mathrm{d}\cos(\theta)\\ &=-\frac12\int\left(\frac1{1-\cos(\theta)}+\frac1{1+\cos(\theta)}\right)\,\mathrm{d}\cos(\theta)\\ \end{align} $$


HINT:

$$\int\frac{d\theta}{\sin\theta}=\int\csc\theta d\theta=\int\frac{\csc\theta(\csc\theta+\cot\theta)}{\csc\theta+\cot\theta}d\theta$$

Now what’s the derivative of that last denominator?