# Evaluating $\int{\frac{1}{\sqrt{x^2+y^2}}\mathrm dx}$

Attempting to calculate $\displaystyle \int{\dfrac{1}{\sqrt{x^2+y^2}}\mathrm dx}$, $$\int{\dfrac{1}{\sqrt{x^2+y^2}}\mathrm dx}=\int{\frac{1}{\sqrt{(y\tan\theta)^2+y^2}}y\sec^2\theta \mathrm d\theta}=\int{\sec\theta d\theta}=\ln(\sec\theta +\tan\theta)=\ln\left(\sqrt{\left(\frac{x}{y}\right)^2+1}+\frac{x}{y}\right)=\ln\left(\frac{1}{x}\left(\sqrt{x^2+y^2}+x\right)\right),$$ where $x=y\tan\theta$

However Wolfram Integrator somehow returns $$\ln\left(2\left(\sqrt{x^2+y^2}+x\right)\right)$$ as the answer. Where did I go wrong? Many thanks.

• For one, you should have factored out a $1/y$ rather than a $1/x$. The factor of two can be wrapped up in an integration constant. – Ron Gordon Oct 5 '13 at 12:21
• The only nitpick I have so far is that the coefficient in front of the natural logarithm at the end of your solution should be $\frac{1}{y}$ and not $1/x$. – Clayton Oct 5 '13 at 12:21
• I think the wolfram integrator is wrong see wolframalpha.com/input/… – Shobhit Oct 5 '13 at 12:24
• @Shobhit: It isn't wrong, it just chose a (seemingly arbitrary) specific constant of $\ln(2)$. The only thing I dislike is how both have absorbed the $-\ln(y)$ into the constant. – Clayton Oct 5 '13 at 12:27
• @Clayton agreed – Shobhit Oct 5 '13 at 12:28

Hint: after you fix the mistake in the last step, differentiate the function $$x\mapsto \ln\left(\frac{1}{y}\left(\sqrt{x^2+y^2}+x\right)\right)-\ln\left(2\left(\sqrt{x^2+y^2}+x\right)\right)$$ with respect to $x$. It's easy to do so in your head. Also do not forget that you should consider the absolute value appropriately ($\int \frac 1x\mathrm dx)=\ln (|x|)$) and to add an arbitrary constant when you integrate.