Trigonometric functions I wonder how does a WolframAlpha get this relation where input is a LHS and output is RHS:
$$\cos^2(x)\cos(2x) = \tfrac{1}{4}\cos(4x) + \tfrac{1}{2}\cos(2x) + \tfrac{1}{4}$$

\begin{align*}
\cos^2(x)\cos(2x) &= \frac{1}{2}(1+\cos(2x))\cos(2x)\\
&= \frac{1}{2}\cos(2x) +\frac{1}{2}\cos^2(2x) \\
&= \frac{1}{2}\cos(2x) + \frac{1}{4} + \frac{1}{4}\cos(4x)
\end{align*}
by two applications of the double angle formula.
