Evaluate the integral $\int \frac{\cos(x)}{\sqrt{1+\sin^2(x)}} \, dx$ Evaluate the integral
$$\int \frac{\cos x}{\sqrt{1+\sin^2x}}  \mathrm{d}x$$
Hey guys, I've been having real problems with this one. I've tried setting $u=\sin x$ so $\mathrm{d}u=\cos x ~\mathrm{d}x$ but that didn't go anywhere... Tried subbing out $\sin^2x$ via pythagorean identity but alas, I ran into another dead end. I checked the answer and it's supposed to be $\ln(1 + \sqrt{2})$, which makes me think there is some identity involved I am not aware of... Thanks in advance!

Use fact that:
$$ \cos x ~\mathrm{d}x = \mathrm{d}(\sin x )$$
Then we have:
$$\begin{aligned} \int \frac{\cos x}{\sqrt{1+\sin^2 x}} \mathrm{d}x  
&= \int \frac{\mathrm{d}( \sin x)}{\sqrt{1+\sin^2 x}} \\ 
&= \int \frac{\mathrm{d}u}{\sqrt{1+u^2}} \hspace{35pt} \text{via}~u=\sin x \\ 
&= \int \frac{\mathrm{d}s}{\cos s}\hspace{35pt} \text{via}~ u=\tan s \\ 
&= \int \frac{(\sec s)(\sec s + \tan s)}{\sec s+ \tan s} \mathrm{d}s \\
&= \int \frac{\mathrm{d}r}{r} \hspace{35pt} \text{via}~ |r = \sec(s) + \tan(s)|\\ 
&= \ln r + C \\ 
&= \ln(\sec s +\tan s) + C \\
&= \ln\left(u+\sqrt{u^2+1}\right)+C \\
&= \ln\left(\sin x + \sqrt{\sin^2 x+1}\right)+C \\
&= \sinh^{-1}(\sin x) \end{aligned} $$
