# Integrate $\int \frac{\sin(3x)}{\cos x}~dx$

An answer is $\ln|\cos x| - \cos2x$.

I'm trying to get the answer but I'm getting something different

$$\int \frac{\sin(3x)}{\cos x}~dx = \int\frac{3\sin x - 4\sin^3x}{\cos x}~dx=3 \int \tan x ~dx +4 \int \frac{1-\cos^2x}{\cos x}~d(\cos x) \\= \frac{3}{\cos^2x} + 4\ln|\cos x| - 2\cos^2x + C.$$

What's wrong with my approach?

• Where are you getting $\frac{3}{\cos^2(x)}$ from? It looks like you're taking a mixture of the integral and derivative of $\tan(x)$. Mar 21 '15 at 11:50
• yes, you're right, I didnt noticed that Mar 21 '15 at 12:00

$$\int \frac{\sin(3x)}{\cos x}~dx = \int\frac{3\sin x - 4\sin^3x}{\cos x}~dx \\=3 \int \frac{\sin x}{\cos x} ~dx +4 \int \frac{1}{\cos x}~d(\cos x)-4\int \cos x~d(\cos x)\\=-3\ln |\cos x|+4\ln |\cos x|-2\cos^2x+C_0=\ln |\cos x|-\cos 2x + (C_0 -1)$$
Since $C_0$ is an arbitrary constant we can replace $C_0 -1$ by $C$.