Substitute sin(x) = tan(t) and cos(x) dx = sec²(t) dt. We want this change of variable to be reversible, so let's assume bot x and t are bounded between 0 and π/2.
Then we have
[tex]\displaystyle \int \frac{\cos(x)}{\sqrt{1 + \sin^2(x)}} \, dx = \int \frac{\sec^2(t)}{\sqrt{1 + \tan^2(t)}} \, dt[/tex]
Recall the Pythagorean identity,
1 + tan²(t) = sec²(t)
Then
√(1 + tan²(t)) = √(sec²(t)) = sec(t)
and the integral reduces to
[tex]\displaystyle \int \frac{\sec^2(t)}{\sqrt{1 + \tan^2(t)}} \, dt = \int \frac{\sec^2(t)}{\sec(t)} \, dt = \int \sec(t) \, dt = \ln|\sec(t)+\tan(t)| + C[/tex]
Change the variable back to x, so the antiderivative is
[tex]\displaystyle \int \frac{\cos(x)}{\sqrt{1 + \sin^2(x)}} \, dx = \ln \left|\sec\left(\tan^{-1}(\sin(x))\right) + \tan\left(\tan^{-1}(\sin(x))\right) \right| + C [/tex]
[tex]\displaystyle \int \frac{\cos(x)}{\sqrt{1 + \sin^2(x)}} \, dx = \boxed{\ln \left|\sqrt{1+\sin^2(x)} + \sin(x) \right| + C} [/tex]