Have a question about integration done by substitution $\frac{\sqrt{x^2-1}}{x}$ I have a few questions relating to integral $\int \frac{\sqrt{x^2-1}}{x} \, dx$. On online calculator it is integrated by a substitution $\left[ u=\sqrt{x^2-1} \, dx = \frac{\sqrt{x^2-1}}{x} \, du\right]$. Then after substitution the subintegral expression looks like this: $\int \frac{u^2}{u^2+1} \, du$. After that the following steps are rather straightforward. But on my book the way this particular integral is solved raises some questions for me. Starting off it's actually definite integral $$  \int_1^2 \frac{\sqrt{x^2-1}}{x} \, dx = \left[\begin{array}{cc} x=\frac{1}{cost}; dx= \frac{sint \,dt}{cos^2t}; cost=\frac{1}{x}    \end{array} \\\sqrt{x^2-1}=\sqrt{\frac{1}{cos^2t}-1}=tan(t); \, t=arccos\frac{1}{x}; \, if x=1, \, then \, t=0 \, and \, if \, x=2, \, then  \, t=\frac{\pi}{3} \right]$$. First of all, I think that the idea here is to show that if you do a substitution the limits of integral change as well. But 1) why did they choose x to be equal to $\frac{1}{cosx}$? If I have to do these kinds of problems in the future what's the way to determin when to choose substitue x with cosx or sinx or some other trigonometric function? 2) On online calculator it shows the result like this, -  $\sqrt{x^2-1}-arctan{\sqrt{x^2-1}} + C$ and computing the values at each limit it gives: $-\frac{\pi-3^{\frac{3}{2}}}{3}$ When i compute the value at $x=2$, I get $1-\frac{\pi}{3}$ and at x=1, I get $\sqrt{1-1}-arctan{\sqrt{1-1}}=0$ So, what am I doning wrong? Also, if $u=\sqrt{x^2-1}, $ then at $x=2$ I get 1 and at $x=1$ I get 0. So this doesn't work at all, so I assume that this is different than doing the substitution with the $cosx$, but why?
 A: In general if we deal with expressions like $\sqrt{a^2-x^2},\sqrt{x^2-a^2}, \sqrt{x^2+a^2}$, then trigonometric substitutions are helpful to get rid of the square root. Now the question is which trigonometric substitution should be used? For that, look at the following identities (they can be derived from one another)
\begin{align*}
1-\cos^2 t & = \sin^2t \\
1+\tan^2t & = \sec^2 t && \text{or} & \sec^2t-1=\tan^2t.
\end{align*}
Now if you want to deal with $\sqrt{\color{red}{a}^2-\color{blue}{x}^2}=\sqrt{\color{red}{\text{constant}}^2 - \color{blue}{\text{variable}}^2}$ then we look for the trig identity that can possibly exhibit this behavior. From the list given above, the form that can help is $\color{red}{1}-\color{blue}{\cos^2 t}=\sin^2t$, so we make a substitution $x=a \cos t$ (or $x=a \sin t$). 
Likewise for $\sqrt{x^2-a^2}=\sqrt{\text{variable}^2-\text{constant}^2}$, we can go with $x=a \sec t$. Also for $\sqrt{x^2+a^2}=\sqrt{\text{variable}^2+\text{constant}^2}$, we can go with $x=a \tan t$ and so on.

Coming to your particular problem, you have made a small error when computing the expression at $x=2$. Note that $\sqrt{x^2-1}$ at $x=2$ is $\sqrt{3}$.
A: Finding the right substitution requires a mix of art and black magic.
Given an integral, a certain substitution can make it almost immediate, another one could make it just easier than the origina, another one could mix up things in a very complicated fashion: see, for instance, Is there another way to solve this integral? and the various answers, besides the OP's solution.
When you have $\sqrt{x^2-1}$, $x\ge1$, the standard choices are


*

*$x=\cosh t$ (with $t\ge0$), due to $\cosh^2t-\sinh^2t=1$; one gets $dx=\sinh t\,dt$;

*$x=\sec t$ (with $t\ge0$), due to $\sec^2t-1=\tan^2t$; one gets $dx=-\sec t\tan t\,dt$.
Which one to choose depends on what you get after the substitution. In the first case,
$$
\int\frac{\sqrt{x^2-1}}{x}\,dx=\int\frac{\sinh t}{\cosh t}\sinh t\,dt=
\int\left(\cosh t-\frac{1}{\cosh t}\right)dt=\sinh t-\int\frac{1}{\cosh t}\,dt
$$
The last integral can be managed in the following way
$$
\int\frac{1}{\cosh t}\,dt=\int\frac{2e^t}{e^{2t}+1}\,dt=2\arctan(e^t)+c
$$
Let's see the second one. We get
$$
\int\cos t\tan t(-\sec t)\tan t\,dt=\int(1-1-\tan^2t)\,dt=t-\tan t+c
$$
Much easier, isn't it?
Another possibility is called “Euler's substitution”: $\sqrt{x^2-1}=x-t$. After squaring we get
$$
x=\frac{t^2+1}{2t},\qquad dx=\frac{t^2-1}{2t^2}\,dt,\qquad \sqrt{x^2-1}=\frac{1-t^2}{2t}
$$
so the integral becomes
$$
\int\frac{1-t^2}{2t}\frac{2t}{1+t^2}\frac{t^2-1}{2t^2}\,dt=
\int\left(\frac{4}{t^2+1}-1-\frac{1}{t^2}\right)=4\arctan t-t+\frac{1}{t}
$$
In the particular case, also $t=\sqrt{x^2-1}$ works, because we have
$$
dt=\frac{x}{\sqrt{x^2-1}}\,dx
$$
and we have
$$
\int\frac{\sqrt{x^2-1}}{x}\,dx=
\int\frac{x^2-1}{x^2}\frac{x}{\sqrt{x^2-1}}\,dx=
\int\frac{t^2}{t^2+1}\,dt=t-\arctan t+c
$$
