I am asked as a part of a question to integrate $$\int 2\,\sin^{2}{x}\cos{x}\,dx$$
I managed to integrate it using integration by inspection: $$\begin{align}\text{let } y&=\sin^3 x\\ \frac{dy}{dx}&=3\,\sin^2{x}\cos{x}\\ \text{so }\int 2\,\sin^{2}{x}\cos{x}\,dx&=\frac{2}{3}\sin^3x+c\end{align}$$
However, looking at my notebook the teacher did this: $$\int -\left(\frac{\cos{3x}-\cos{x}}{2}\right)$$ And arrived to this result: $$-\frac{1}{6}\sin{3x}+\frac{1}{2}\sin{x}+c$$
I'm pretty sure my answer is correct as well, but I'm curious to find out what how did do rewrite the question in a form we can integrate.