<s>[INST] What is wrong with my solution? $\int \cos^2 x \tan^3x dx$ I am trying to do this problem completely on my own but I can not get a proper answer for some reason
$$\begin{align}
\int \cos^2 x \tan^3x dx
&=\int \cos^2 x \frac{ \sin^3 x}{ \cos^3 x}dx\\
&=\int  \frac{ \cos^2 x\sin^3 x}{ \cos^3 x}dx\\
&=\int  \frac{ \sin^3 x}{ \cos x}dx\\
&=\int  \frac{ \sin^2 x \sin x}{ \cos x}dx\\
&=\int  \frac{ (1 -\cos^2 x) \sin x}{ \cos x}dx\\
&=\int  \frac{ (\sin x -\cos^2 x \sin x) }{ \cos x}dx\\
&=\int  \frac{ \sin x -\cos^2 x \sin x }{ \cos x}dx\\
&=\int  \frac{ \sin x }{ \cos x}dx - \int   \cos x \sin x dx\\
&=\int  \tan x dx - \frac{1}{2}\int  2 \cos x \sin x dx\\
&=\ln|\sec x| - \frac{1}{2}\int \sin 2x dx\\
&=\ln|\sec x| + \frac{\cos 2x}{4} + C
\end{align}$$
This is the wrong answer, I have went through and back and it all seems correct to me.
 [/INST] The calculation is correct.  There are many alternate forms of the integral, because of the endlessly many trigonometric identities. 
If you differentiate the expression you got and simplify, you will see that you are right.
The answer you saw is likely also right. What was it?
Added: Since $\sec x=\frac{1}{\cos x}$, we have $\ln(|\sec x|)=-\ln(|\cos x|)$.
Also, since $\cos 2x=2\cos^2 x -1$, we have $\frac{\cos 2x}{4}=\frac{\cos^2 x}{2}-\frac{1}{4}$.  
So your answer and the book answer differ by a constant. That's taken care of by the arbitrary constant of integration. As a simpler example,
$\int 2x\, dx=x^2+C$ and $\int 2x\, dx=(x^2+17)+C$ are both right.
</s>