I'm calculating the following integral: $\int \frac{1}{\sqrt{x^2+2}}dx$
I tried the following:
Performing $u$ substitution:
Let $x=\sqrt{2}\tan(u)$
$x^2=2\tan^2(u)$
$dx=\sqrt{2}(1+\tan^2(u))du$
$\int \frac{1}{\sqrt{x^2+2}}dx=\int \frac{\sqrt{2}(1+\tan^2(u))du}{\sqrt{2\tan^2(u)+2}}= \int \frac{(1+\tan^2(u))du}{\sqrt{\tan^2(u)+1}} = \int \frac{(1+\tan^2(u))du}{\sqrt{\tan^2(u)+1}}=\int \frac{1}{\cos u}du$
=$\int \frac{\cos u}{ cos^2u}du=\int \frac{\cos u}{1-\sin^2u}du$
Let $t = \sin u$
$dt=\cos u.du$
$\int \frac{dt}{1-t^2}du= \frac{1}{2}\int\frac{1}{1-t}+\frac{1}{2}\int\frac{1}{1+t}du=\frac{1}{2}\ln(\frac{1+t}{1-t})=\frac{1}{2}\ln(\frac{1+\sin u}{1-\sin u})$
$=\ln(\sqrt{\frac{1+\sin u}{1-\sin u}})=\ln\left(\sqrt{\frac{(1+\sin u)^2}{1-\sin^2u}}\right)=\ln\left(\frac{1+\sin u}{\cos u}\right)=\ln\left(\frac{1}{\cos u}+\tan u\right)$
Substituting $u$ with $\arctan\frac{x}{\sqrt{2}}$ We get:
$\ln\left(\frac{1}{\cos u}+\tan u\right)=\ln\left(\frac{x}{\sqrt{2}}+\sqrt{1+\frac{x^2}{2}}\right)$.
Although the formula says $\int \frac{1}{\sqrt{x^2+a^2}}dx=\ln(x+\sqrt{x^2+a^2})$
So the answer shoud have been $ln(x+\sqrt{x^2+2})$?
Thanks for the help!
You are absolutely correct. Note that the difference between your answer and the most common form of the answer is a constant. Note that: $$\ln(\frac{x}{\sqrt 2} + \sqrt{1+ \frac{x^2}{2}}) = \ln(\frac{1}{\sqrt 2}\left[x + \sqrt{x^2+2}\right]) = \ln(x + \sqrt{x^2+2}) - \color{red}{\ln \sqrt 2}$$
where the red part is a constant. Note that $\ln(ab) = \ln a + \ln b$.