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.

$\int\tan x\,dx=\ln|\sec x|=-\ln|\cos x|+ k $since  $-\ln |\cos x|+k= \ln|(\cos x)^-1|+k = \ln|\sec x| +k$
$$\frac{\cos2x}{4}= \frac{1}{2}\cos^2(x) - 1/4$$
$k-1/4 =  \text{new constant } C  $ and together you have the solution.
Your answer seems to be correct it is just manipulation or different approach to trig identities.
