<s>[INST] Integrating $ \int \frac{1}{\sqrt{x^2+4}}\,dx $ using Trigonometric Substitution I'm reviewing integration by trigonometric substitution in anticipation of covering it in class next week.  I seem to be a bit rusty and keep catching myself making various mistakes.  On this particular problem I keep getting the same answer which is very close to being correct.  However, I somehow end up dividing by two where I should not.  I'm hoping another set of eyes can quickly set me right so I can stop frustrating myself reworking the problem to the same apparently wrong answer repeatedly!  Thanks in advance!
The problem asks to solve:
$$
\int \frac{1}{\sqrt{x^2+4}}\,dx
$$
The answer is given as:
$$
ln\lvert x + \sqrt{x^2+4} \rvert + C
$$
Somehow I keep getting:
$$
ln\Bigg|\frac{\sqrt{x^2+4}}{2} + \frac{x}{2}\Bigg| + C
$$
Here's my work:
$$
\int \frac{1}{\sqrt{x^2+4}}\,dx = \int \frac{1}{\sqrt{4(\frac{1}{4}x^2+1)}}\,dx = \frac{1}{2}\int\frac{1}{\sqrt{\frac{1}{4}x^2+1}}\,dx = \frac{1}{2}\int\frac{1}{\sqrt{(\frac{1}{2}x)^2+1}}\,dx
$$
At this point I substitute as follows:
$$
\frac{1}{2}x = \tan\theta
$$
$$
x = 2\tan\theta
$$
$$
dx = 2\sec^2\theta
$$
So I continue on with:
$$
\frac{1}{2}\int\frac{2\sec^2\theta}{\sqrt{\tan^2\theta+1}}\,d\theta = \int\frac{\sec^2\theta}{\sqrt{\sec^2\theta}}\,d\theta = \int\frac{\sec^2\theta}{\sec\theta}\,d\theta = \int\sec\theta\,d\theta = ln\lvert\sec\theta + \tan\theta\rvert + C
$$
Finally, to get the answer in terms of x I essentially draw a right triangle and use the fact that $\tan\theta = \frac{x}{2}$.  The side opposite $\theta$ I take to be x, the side adjacent $\theta$ is 2, and the hypotenuse is $\sqrt{x^2+4}$.  So $\sec\theta = \frac{\sqrt{x^2+4}}{2}$ and $\tan\theta = \frac{x}{2}$.
So, substituting these values back in, as mentioned, I end up with:
$$
ln\Bigg|\frac{\sqrt{x^2+4}}{2} + \frac{x}{2}\Bigg| + C
$$
Can anyone help me see where I'm going wrong or failing to understand something?
 [/INST] You are correct still. Notice that 
$$
\begin{align}
\ln\Bigg|\frac{\sqrt{x^2+4}}{2} + \frac{x}{2}\Bigg| + C &= \ln\Bigg|\frac{\sqrt{x^2+4}+x}{2}\Bigg| + C\\
&= \ln\Bigg|\sqrt{x^2+4}+x\Bigg|-\ln(2) + C\\
&= \ln\Bigg|\sqrt{x^2+4}+x\Bigg|+C'
\end{align}
$$ 
where $C'$ is still an arbitrary constant.
</s>