Are these two integral answers equivalent?

$\displaystyle \int sec^2xtanxdx$

I let u=tanx

du=sec^2xdx

$\displaystyle \int udu$

$\displaystyle \frac{u^2}{2} + C$

$\displaystyle \frac{1}{2}tan^2x + C$

The answer key let u=sec^2x

Their answer is

$\displaystyle \frac{1}{2}sec^2x + C$

It doesn't seem that they could be the same. What did I do wrong?

Re: Are these two integral answers equivalent?

Both substitutions are correct, the book's substitution would have been easier though.

Your answer was $\displaystyle \frac{1}{2} \tan^2x + \mathrm{C}$

Although it really isn't intuitive, from there you can use the tangent identity $\displaystyle \tan^2\theta = \sec^2\theta - 1$ to rewrite your integral as$\displaystyle \frac{\sec^2x}{2} - \frac{1}{2} + \mathrm{C}$ now -1/2 is a constant and any constant plus an arbitrary constant is still an arbitrary constant so your answer becomes $\displaystyle \frac{\sec^2x}{2} + \mathrm{C}$

When all else fails, you can always try writing those trig functions in terms of sine and cosine. For this problem it would be

$\displaystyle \int \frac{\sin x}{\cos x} \frac{1}{ \cos^2x}\,\,dx = \int\frac{\sin x}{\cos^3x}\,\,dx \,\,\,\,\, u =\cos x \rightarrow dx = -\sin x \,\,du$

$\displaystyle -\int \frac{1}{u^3}\,\,du = -\frac{-1}{2u^2} + \mathrm{C} = \frac{1}{2} \frac{1}{\cos^2x} + \mathrm{C}= \frac{\sec^2x}{2} + \mathrm{C}$

that's a lot more unnecessary work, but it's a surefire way to get an answer

Re: Are these two integral answers equivalent?

Awesome, thank you for the explanation.