Integrating $\frac{1}{\sqrt{x^2+1}}$ with the help of a variable change The question I am faced with is as follows:

With the help of a variable change $\sqrt{x^2+1}=x+t$, demonstrate that over $\mathbb{R}$, with $k\in \mathbb{R}$
$$\int{\frac{1}{\sqrt{x^2+1}} \ \mathrm{d}}x=\ln(x+\sqrt{x^2+1})+k$$

Now what I did was something different, I built a right triangle with an angle $\alpha$ (its adjacent side being $1$ and opposite side being $x$), and with a hypotenuse of $\sqrt{x^2+1}$.
Thus, $x=\tan{\alpha}$ and $\mathrm{d}x=\sec^2{\alpha} \ \mathrm{d}\alpha$. So we have:
$$\int{\frac{1}{\sqrt{x^2+1}} \ \mathrm{d}}x=\int{\cos{\alpha} \ \mathrm{d}x}=\int{\frac{\sec^2{\alpha}}{\sec{\alpha}}  \ \mathrm{d}\alpha}=\int{\sec{\alpha}  \ \mathrm{d}\alpha}$$
I know how to integrate $\sec{\alpha} \ \mathrm{d}\alpha$, and after replacing $\alpha$ with the initial value of $x$, I indeed end up with the result $\ln(x+\sqrt{x^2+1})+k$.
But how would one end up with the same result using the given hint? Can someone help me out? Thanks.

Let $t=\sqrt{x^2+1}-x=\frac{1}{\sqrt{x^2+1}+1}$, which is equivalent to $x=\frac{1-t^2}{2t}$.  Then, we have
$$\begin{align}
\int \color{blue}{\frac{1}{\sqrt{1+x^2}}}\,\color{red}{dx}&=\int \color{blue}{\left(\frac{2t}{1+t^2}\right)}\,\color{red}{\left(-\frac12 \frac{t^2+1}{t^2}\right)\,dt}\\\\
&=-\int \frac1t\,dt\\\\
&=-\log(t)+k\\\\
&=\log(x+\sqrt{x^2+1})+k
\end{align}$$
as was to be shown!
