How to get the integral of the following question? I am trying really hard but cannot figure out how to solve this question:
$\int \frac{\sqrt{1+x^2}}{x}dx$
Any help would be really appreciated.
 A: Among the options: If you substitute $u = \sqrt{1+x^2}$, then $x = \sqrt{u^2-1}$ and $dx = \frac{u}{\sqrt{u^2-1}} \, du$.  Then you wind up with an integral that can be done by partial fractions.
A: $$\int\frac{\sqrt{1+x^2}}{x}\space\text{d}x=$$

Substitute $x=\tan(u)$ and $\text{d}x=\sec^2(u)\space\text{d}u$.
Then $\sqrt{1+x^2}=\sqrt{1+\tan^2(u)}=\sec(u)$ and $u=\arctan(x)$:

$$\int\csc(u)\sec^2(u)\space\text{d}u=\int\left(\tan^2(u)+1\right)\csc(u)\space\text{d}u=\int\left(\csc(u)+\tan(u)\sec(u)\right)\space\text{d}u=$$
$$\int\csc(u)\space\text{d}u+\int\tan(u)\sec(u)\space\text{d}u=\int\csc(u)\space\text{d}u+\int\frac{\sin(u)}{\cos^2(u)}\space\text{d}u=$$

Substitute $s=\cos(u)$ and $\text{d}s=-\sin(u)\space\text{d}u$:

$$\int\csc(u)\space\text{d}u-\int\frac{1}{s^2}\space\text{d}s=\int\csc(u)\space\text{d}u+\frac{1}{s}=$$
$$\int\csc(u)\space\text{d}u+\frac{1}{\cos(u)}=\int\csc(u)\space\text{d}u+\frac{1}{\cos(\arctan(x))}=$$

For the integral $\int\csc(u)\space\text{d}u$, multiply numerator and denominator by $\cot(u)+\csc(u)$:
$$\int\csc(u)\space\text{d}u=\int-\frac{-\cot(u)\csc(u)-\csc^2(u)}{\cot(u)+\csc(u)}\space\text{d}u$$
Now substitute $p=\cot(u)+\csc(u)$ and $\text{d}p=\left(-csc^2(u)-\cot(u)\csc(u)\right)\space\text{d}u$:
$$\int-\frac{1}{p}\space\text{d}p=-\ln\left|p\right|+\text{C}$$

$$\frac{1}{\cos(\arctan(x))}-\ln\left|\cot(u)+\csc(u)\right|+\text{C}=$$
$$\frac{1}{\cos(\arctan(x))}-\ln\left|\cot(\arctan(x))+\csc(\arctan(x))\right|+\text{C}=$$
$$\sqrt{1+x^2}-\ln\left|\frac{1}{x}+\frac{\sqrt{1+x^2}}{x}\right|+\text{C}=$$
$$\sqrt{1+x^2}-\ln\left|\frac{1+\sqrt{1+x^2}}{x}\right|+\text{C}$$
A: Let's put $x=\tan t$.
$$\implies \int \frac {\sqrt{1+x^2}dx}{x}=$$
$$\int \frac{\sec^3 tdt}{\tan t}$$
$$=\int\frac{dt}{\sin t \cos^2 t}$$
$$=\int \frac{(\sin^2t+\cos^2t)dt}{\sin t \cos^2 t}$$
$$=\int \sec t\tan t dt+\int \csc tdt$$
$$=\cdots?$$
A: We can write the integral in a form 
$$J = \int \frac{\sqrt{1+x^2}}x\,dx = \int \frac{\sqrt{1+x^2}}{1+x^2-1}\,x\,dx $$
which allows the suitable substitution
$$1+x^2=t^2,\quad x\,dx = t\,dt.$$
Then
$$J = \int\frac{t^2}{t^2-1}\,dt = \int dt+\int\frac1{t^2-1}\,dt = t + \frac12\log{\left|\frac{t-1}{t+1}\right|}+C,$$
$$J = \sqrt{1+x^2} + \frac12\log{\left|\frac{\sqrt{1+x^2}-1}{\sqrt{1+x^2}+1}\right|}+C,$$
and after getting rid of irrationality in the denominator:
$$\boxed{J = \sqrt{1+x^2} + \log{\left|\frac{\sqrt{1+x^2}-1}x\right|}+C}.$$
