I have to solve the equation:
$$\sin x + \cos x = \sin x \cos x$$
This is what I tried:
$$\hspace{1cm} \sin x + \cos x = \sin x \cos x \hspace{1cm} ()^2$$
$$\sin^2 x + 2\sin x \cos x + \cos^2 x = \sin^2 x \cos^2x$$
$$1 + \sin(2x) = \dfrac{4 \sin^2 x \cos^2x}{4}$$
$$1 + \sin(2x) = \dfrac{\sin^2(2x)}{4}$$
$$\sin^2(2x) - 4 \sin(2x) -4 = 0$$
Here we can use the notation $t = \sin(2x)$ with the condition that $t \in [-1,1]$.
$$t^2-4t-4=0$$
Solving this quadratic equation we get the solutions:
$$t_1 = 2+ 2\sqrt{2} \hspace{3cm} t_2 = 2 - 2\sqrt{2}$$
I managed to prove that $t_1 \notin [-1, 1]$ and that $t_2 \in [-1, 1]$. So the only solution is $t_2 = 2 - \sqrt{2}$. So we have:
$$\sin(2x) = 2 - 2\sqrt{2}$$
From this, we get:
$$2x = \arcsin(2-2\sqrt{2}) + 2 k \pi \hspace{3cm} 2x = \pi - \arcsin(2-2\sqrt{2}) + 2 k \pi$$
$$x = \dfrac{1}{2} \arcsin(2-2\sqrt{2}) + k \pi \hspace{3cm} x = \dfrac{\pi}{2} - \dfrac{1}{2}\arcsin(2 - 2\sqrt{2}) + k \pi$$
Is this solution correct? It's such an ungly answer, that I kind of feel like it can't be right. Did I do something wrong?
Note that when you square the equation
$$(\sin x + \cos x)^2 = (\sin x \cos x)^2$$
which can be factorized as
$$(\sin x + \cos x - \sin x \cos x)(\sin x + \cos x + \sin x \cos x)=0$$
you effectively introduced another equation $\sin x + \cos x =- \sin x \cos x$ in the process beside the original one $\sin x + \cos x = \sin x \cos x$. The solutions obtained include those for the extra equation as well.
Normally, you should plug the solutions into the original equation to check and exclude those that belong to the other equation. However, given the complexity of the solutions, it may not be straightforward to do so. Therefore, the preferred approach is to avoid the square operation.
Here is one such approach. Rewrite the equation $\sin x + \cos x = \sin x \cos x$ as
$$\sqrt2 \cos(x-\frac\pi4 ) = \frac12 \sin 2x = \frac12 \cos (2x-\frac\pi2 ) $$
Use the identity $\cos 2t = 2\cos^2 t -1$ on the RHS to get the quadratic equation below
$$\sqrt2 \cos(x-\frac\pi4) = \cos^2 (x-\frac\pi4 ) -\frac12$$
or
$$\left( \cos(x-\frac\pi4) - \frac{\sqrt2-2}2\right)\left( \cos(x-\frac\pi4) - \frac{\sqrt2+2}2\right)=0$$
Only the first factor yields real roots
$$x = 2n\pi + \frac\pi4 \pm \cos^{-1}\frac{\sqrt2-2}2$$