Why $\cos^3 x - 2 \cos (x) \sin^2(x) = {1\over4}(\cos(x) + 3\cos(3x))$? Wolfram Alpha says so, but step-by-step shown skips that step, and I couldn't find the relation that was used.

Start by the left hand side. You can calculate it known that:


*

*$\cos (x+2x)=\cos x\cos 2x-\sin x\sin 2x,$

*$\cos 2x=2\cos^2 x -1,$

*$\sin 2x=2\sin x\cos x,$

*$\cos^2 x+\sin^2 x=1.$
$$\frac{1}{4}\left(\cos x+3\cos 3x\right)=\frac{1}{4}\left(\cos x+3\left(4\cos^3 x-3\cos x\right)\right)=3\cos^3 x-2\cos x=\cos^3 x-2\cos x\left(1-\cos^2 x\right)$$
