Answer
$$\int\cot x\cos^2 xdx=\ln|\sin x|-\frac{\sin^2 x}{2}+C$$
Work Step by Step
$$A=\int\cot x\cos^2 xdx$$
Here we would try to change the whole integral in terms of $\sin x$ and $\cos x$ so that we can use the Substitution Rule, according to the following formulas $$\cot x=\frac{\cos x}{\sin x}$$ $$\cos^2 x=1-\sin^2 x$$
Therefore we have
$$A=\int\frac{\cos x}{\sin x}(1-\sin^2 x)dx$$ $$A=\int\frac{\cos x}{\sin x}dx-\int\cos x\sin xdx$$ $$A=X-Y$$
*Consider X: $$X=\int\frac{\cos x}{\sin x}dx$$
Let $u=\sin x$. Then $du=\cos xdx$ $$X=\int \frac{1}{u}du$$ $$X=\ln|u|+C$$ $$X=\ln|\sin x|+C$$
Consider Y: $$C=\int\cos x\sin xdx$$
Again, let $v=\sin x$. Then $dv=\cos xdx$ $$Y=\int vdv$$ $$Y=\frac{v^2}{2}+C$$ $$Y=\frac{\sin^2 x}{2}+C$$
Combine X and Y, we have $$A=\ln|\sin x|-\frac{\sin^2 x}{2}+C$$