I am trying to find $$\int{ \frac {5x + 1}{x^2 + 4} dx}$$ The best approach would be to split up the fraction. According to Wolfram Alpha, the answer is $\frac{5}{2}\ln\left(x^2 + 4\right) + \frac{1}{2}\displaystyle\arctan\left(\frac x2\right)$ which seems OK, but when I try the trig substitution: $x = 2\tan\theta$, I get an answer that is slightly different but not equivalent, and I've looked at this over and over and I couldn't quite figure out what I did wrong.
$$x = 2\tan\theta$$ $$dx = 2\sec^2\theta d\theta$$ $$\int{ \frac {5x + 1}{x^2 + 4}dx} = \frac{1}{4}\int{\frac{10\tan\theta + 1}{\sec^2\theta} 2\sec^2\theta \,d\theta}$$ $$ = \frac{1}{2}\int{10 \tan\theta + 1}\space d\theta$$ $$ = 5 \ln|\sec\theta| + \frac{\theta}{2} + C$$ We know $\theta = \displaystyle\arctan\left(\frac x2\right)$ and since $\tan\theta = \displaystyle\frac{x}{2}$, we can draw a triangle to see that $\sec\theta = \displaystyle\frac{\sqrt{x^2 + 4}}{2}$.
$$5 \ln|\sec\theta| + \frac{\theta}{2} = 5\ln\left({\frac{\sqrt{x^2 + 4}}{2}}\right) + \frac{1}{2}\arctan\left({\frac x2}\right) $$ $$= \frac{5}{2}\ln\left({\frac{x^2 + 4}{4}}\right) + \frac{1}{2}\arctan\left({\frac x2}\right)$$
But $$\frac{5}{2}\ln\left({\frac{x^2 + 4}{4}}\right) + \frac{1}{2}\arctan\left({\frac x2}\right) \neq \frac{5}{2}\ln\left(x^2 + 4\right) + \frac{1}{2}\arctan\left(\frac x2\right)$$
There seems to be a small difference between the answer provided by Alpha and the trig substitution method, but I cannot see where I made the mistake.