# 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.

• Alright, now I would like to know why the first integral gives $\ln \sec x$ instead of $-\ln \cos x$. Jun 8, 2012 at 23:07
• I think that was just an error in typing out the question
– user138246
Jun 8, 2012 at 23:08
• @Phira: Because you can bring the $-1$ up. Jun 8, 2012 at 23:16
• Same function, different expression. Note that $$\ln|\sec x| = \ln\left|\frac{1}{\cos x}\right| = \ln\left(|\cos x|^{-1}\right) = -\ln|\cos x|.$$ And $$\cos 2x = \cos^2x - \sin^2x = \cos^2x-(1-\cos^2x) = 2\cos^2x - 1$$so $$\frac{\cos 2x}{4}+C = \frac{2\cos^2x}{4}-\frac{1}{4}+C = \frac{1}{2}\cos^2x + C'.$$ Jun 8, 2012 at 23:16
• You're making good progress I see. Jun 8, 2012 at 23:27

A very simple way to check if the answer to an indefinite integral is correct is to differentiate the answer. If you get the original function, your answer is correct, and is equal, up to a constant, with any other solutions.

We have \begin{align*} \frac{d}{dx}\left(\ln|\sec x| + \frac{\cos 2x}{4} + C\right) &= \frac{1}{\sec x}(\sec x)' + \frac{1}{4}(-\sin(2x))(2x)' + 0\\ &= \frac{\sec x\tan x}{\sec x} - \frac{1}{2}\sin(2x)\\ &= \tan x - \frac{1}{2}\left(2\sin x\cos x\right)\\ &= \frac{\sin x}{\cos x} - \sin x\cos x\\ &= \frac{ \sin x - \sin x\cos^2 x}{\cos x}\\ &= \frac{\sin x(1 - \cos^2 x)}{\cos x}\\ &= \frac{\sin^3 x}{\cos x}\\ &= \frac{\sin ^3 x \cos^2 x}{\cos^3x}\\ &= \frac{\sin^3 x}{\cos^3 x}\cos^2 x\\ &= \tan^3 x \cos^2 x. \end{align*} So your answer is right.

This happens a lot with integrals of trigonometric identities, because there are a lot of very different-looking expressions that are equal "up to a constant". So the answer to $$\int\sin x\cos x\,dx$$ can be either $\sin^2 x + C$ or $-\cos^2x + C$; both correct, though they look different, because they differ by a constant: $-\cos^2x + C = 1-\cos^2x + (C-1) = \sin^2x + (C-1)$.

$${\ln |\sec x| + \frac{{\cos 2x}}{4} + C}$$

$${\ln \left|\frac 1 {\cos x}\right| + \frac{{1+\cos 2x}}{4} + C}-\frac 1 4$$

$${-\ln \left| {\cos x}\right| + \frac 1 2\frac{{1+\cos 2x}}{2} + K}$$

$${-\ln \left| {\cos x}\right| + \frac 1 2 \cos ^2 x + K}$$

• this kind of thing makes me feel like Calculus II exams and assignments must be hell to mark.
– crf
Jun 8, 2012 at 23:56
• Everything is hell to mark. But one can often structure exam questions to minimize these issues. Jun 9, 2012 at 0:28

You have been simplifying things up until line 6 and then kind of turned back into complications. It would be natural to notice that $$\sin x dx = -d\left(\cos x\right)$$ Then the integral looks as follows: $$I=-\int\frac{1-\cos^2x}{\cos x}d\left(\cos x\right)$$ So it appears that $\cos x$ plays the role of a variable in its own right, so why not let for example $t=\cos x$. Now $$I=-\int\frac{1-t^2}{t}dt=-\int\frac{dt}{t}+\int tdt=-\ln t+\frac{t^2}{2}+C$$ Now plug $\cos x$ back into place. Recognising distinct "reusable" blocks within the expression is the most natural way to arrive at useful substitutions.

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.

• $\frac{1}{2}cos^2 x - ln|cosx| + C$
– user138246
Jun 8, 2012 at 23:18

Notice that:

$$\frac{1}{2} \cos^2 x = \frac{1}{2} \left(\frac{1}{2} + \frac{1}{2} \cos 2x\right) = \frac{1}{4} + \frac{1}{4} \cos 2x$$

And:

$$-\ln|\cos x| = \ln|(\cos x)^{-1}| = \ln|\sec x|$$

$$\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.

A simple $u$-substitution will work even better, IMO. ${\cos^2\theta\tan^3\theta }$ yields ${\frac {\sin^3}{\cos\theta}}$ So starting from there $${\int\frac{\sin^2\theta}{\cos\theta}\sin\theta d\theta}$$ then $${\int\frac{1-\cos^2\theta}{\cos\theta}\sin\theta d\theta}$$ Let $u={\cos \theta}$ then ${du=-\sin\theta d\theta}$ $${-\int\frac {1-u^2}{u}du}$$ let ${v=1-u^2 }$ ${dv=-2u}$

let ${dw=1/u}$, ${w=\ln u}$

thus $${\ln u(1-u^2)+\int 2u\ln u}\,du$$ then

let ${v=\ln u}$, ${dv=u^{-1}}$

let ${dw=2u}$, ${w=u^2}$

then \begin{align*} {\ln u u^2-\int \frac{u^2}{u}\,du}\\{\ln u u^2-\int u\,du}\\ {\ln u(1-u^2)+\ln u u^2-1/2u^2} \end{align*} then \begin{align*}{\ln u(1-u^2+u^2)-1/2u^2}\\ {-(\ln u-1/2u^2)} \end{align*} substituting back yields $${-\ln\cos\theta+1/2\cos^2\theta+c}$$