<s>[INST] Showing that $\int \frac {dx}{\sqrt{x^2+a^2}} \;=\; \ln\,\biggl| x+\sqrt{x^2+a^2}\,\biggr| +C$ I want to show that 
$$\int \frac {dx}{\sqrt{x^2+a^2}} \;=\; \ln\,\biggl| x+\sqrt{x^2+a^2}\,\biggr| +C$$
and get a slightly incorrect result and I wonder what I am doing wrong. 
I let $x = a\tan\theta$ so $dx=a\sec^2\theta\, d\theta$ such that I perform the following operations,
$$\frac aa \int \frac {\sec^2\theta}{\sqrt{\tan^2\theta + 1}}d\theta\;=\; \int \sec\theta\,d\theta$$
Multiplying the integrand by $1 = \frac {\sec\theta+\tan\theta}{\sec\theta+\tan\theta}$ I get
$$\int \sec\theta\, d\theta \;=\; \int \frac {\sec^2\theta+\sec\theta\tan\theta}{\sec\theta+\tan\theta} d\theta$$
Then I let $u=\sec\theta+\tan\theta$ and $du = \sec^2\theta+\sec\theta\tan\theta$ such that I get a $\int \frac 1u du$ integral that yields
$$\int \sec\theta \, d\theta \;=\;\ln|\sec\theta+\tan\theta|+C$$
Getting back in $x$ variable terms I get,
$$\int \frac {dx}{\sqrt{x^2+a^2}} \;=\; \ln\,\biggl| \frac 1a \left(x+\sqrt{x^2+a^2}\right)\biggr| +C$$
It seems to me that this $\frac 1a$ has to be there according to the substitution $x=a\tan\theta$, the adjacent side to the angle $\theta$ is of length $a$. Then, when substituting back to $x$ I get $\sec\theta= \frac {x^2+a^2}a$ and $\tan\theta = \frac xa$. What am I missing?
 [/INST] $$\ln \frac{(x+\sqrt{x^2+a^2})}{a} + C$$
$$= \ln (x+\sqrt{x^2+a^2}) - \ln a + C$$
$$= \ln (x+\sqrt{x^2+a^2}) + C'$$
</s>