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.

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.
