I was solving the integral $$\int\frac{\sin x}{\cos^3x}dx$$ I used the substitution $$u=\cos x \qquad du=-\sin x\,dx \qquad -du=\sin x dx$$ So the integral has the form $$\int-\frac{du}{u^3}=\frac{1}{2u^2}+C=\frac{1}{2\cos^2x}+C$$ However, when I checked the answer in the book, this was $$\int\frac{\sin x}{\cos^3x}dx=\frac{\tan^2x}{2}+C$$ Because it was solved using the conversion $$\int\frac{\sin x}{\cos^3x}=\int \tan x\sec^2x$$ And the substitution $u=\tan x$. So, I derived both functions and the result is the same.
Is this normal? Does this mean that both equations are equal? Can I use any of these answers?
Thank you for reading!