I have calculated the indefinite integral $\int \frac{-\sin x}{\cos^3x}dx$ by two ways and I get different solutions.
First, I substitute $u=\cos x$. Therefore, $$\int \frac{-\sin x}{\cos^3x}dx=\int u^{-3}du=-\frac{1}{2\cos^2x}+c$$
Second, I ve rewritten the integral and I substitute $u=\tan x$:
$$\int \frac{-\sin x}{\cos^3x}dx=\int -\tan x \sec^2xdx=\int -udu=-\frac{\tan^2 x}{2}+c$$
What is wrong with the solutions above? Are they same results?
I am sorry if this is very elementary.
Thanks for any help