Split the integral up into two
int cos^2(x)sin(x)-tan^2(x)cot(x) dx = int cos^2(x)sin(x)dx - int tan^2(x)cot(x) dx
First Step
For int cos^2(x)sin(x)dx,
Let u=cos(x) and thus du=-sin(x)dx
Substituting, you get
int cos^2(x)sin(x)dx=-int cos^2(x)(-sin(x)dx)=-int u^2du=-u^3/3+C =-cos^3(x)/3+C
Second Step
For int tan^2(x)cot(x) dx,
Since tan^2(x)cot(x)=tan^2(x)/tan(x)=tan(x)
int tan^2(x)cot(x)=int tan(x)dx
At this point, you can use a formula sheet to get the answer directly, but if you are interested, you can follow along the next few steps.
int tan(x)dx = int sin(x)/cos(x) dx
Now if you let w=cos(x), then dw=-sin(x)dx
int sin(x)/cos(x) dx = -int 1/cos(x) * -sin(x)dx=-int 1/w dw = -lnabs(w)+C=lnabs(cos(x))+C
Final step
Hence, by subtracting the two integrals, one gets
int cos^2(x)sin(x)-tan^2(x)cot(x) dx = -cos^3(x)/x - (-lnabs(cos(x)))+C = lnabs(cos(x))-cos^3(x)/x+C