Recently, my friend gave me the following indefinite integral to evaluate : $$\int \frac{\sin^2 x }{\sin x +\cos x} \mathrm dx$$
I searched it on WolframAlpha, just to be sure, that whether it has an elementary primitive or not. It turn out to be not a elementary one.
Then I asked him, that why did he gave it to me, if it wasn't supposed to be a question for High-schoolers? His reply surprised me! He had solved it. It goes as follows -
\begin{align}\int \frac{\sin^2 x }{\sin x +\cos x}\mathrm dx &=\int \frac 12 \left( \frac{\sin^2 x +\color{blue}{\cos^2 x}}{\sin x +\cos x} + \frac{\sin^2 x -\color{blue}{\cos^2 x}}{\sin x +\cos x} \right)\mathrm dx \\ &=\frac 12 \int \frac{1}{\sin x +\cos x}\mathrm dx +\frac 12 \int (\sin x -\cos x)\mathrm dx\\ \end{align}
Now the first part can be solved using $\sin x +\cos x = \sqrt 2 \cos \left( x -\dfrac {\pi}4 \right)$ and $\int \sec x \mathrm dx = \ln (\sec x+ \tan x )$. Second part is trivial.
Did I get something wrong, or Wolfy is the wrong one here?