What algebraic manipulation is used to express the solution to this integral? According to WolframAlpha, $$
\int \frac{2}{\sqrt{x^2 + 4}} dx = 2 \sinh^{-1}\left(\frac{x}{2}\right) + c.$$
I'm wondering how this was obtained, as I got the following:
Let $x = 2\tan\theta$. Then $dx = 2\sec^2\theta$, so \begin{align*}\int\frac{2}{\sqrt{x^2 + 4}}dx &= \int\frac{4\sec^2\theta}{\sqrt{4\tan^2\theta + 4}}d\theta = \int\frac{2\sec^2\theta}{\sqrt{\tan^2\theta + 1}}d\theta = 2\int\frac{\sec^2\theta}{\sec\theta}d\theta\\ &= 2\int\sec\theta{}d\theta = 2\ln\mid{\tan\theta + \sec\theta}\mid + c.\end{align*}
The substitution $x = 2\tan\theta$ implies that $\sec\theta = \frac{\sqrt{x^2 + 4}}{2}$ and $\tan\theta = \frac{x}{2}$. Hence $$
\int \frac{2}{\sqrt{x^2 + 4}} dx = 2\ln\left|{\frac{x}{2} +  \frac{\sqrt{x^2 + 4}}{2}}\right| + c.$$
Either I made a mistake or I don't know the right algebraic manipulation.

Both are correct . Almost whenever we've got a function of $x^2+a^2$, we can use either a trigonometric substitution (i.e. let $x=a\tan(\theta)$ or a hyperbolic substitution (i.e. let $x=a\sinh(t)$).
The reason that we can do this is because of the following identities:


*

*$$1+\tan^2(\theta) \equiv \sec^2(\theta)$$

*$$1+\sinh^2(t) \equiv \cosh^2(t)$$


The former identity is useful because it's of the form $$1+u^2=u' \quad .$$
The latter is useful because it's of the form $$1+u^2=\left(u'\right)^2$$
