Solve $\sin x + \cos x = \sin x \cos x.$ 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?
 A: 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$$
A: As your error has been pointed out, I am providing a different way to tackle the problem without introducing extra solutions. 
 From the given equation, we have $1=(1-\sin x)(1-\cos x)$, which is equivalent to
$$1=\Biggl(1-\cos\left(\frac{\pi}2-x\right)\Biggr)\left(2\sin^2 \frac{x}{2}\right)=4\sin^2\left(\frac{\pi}{4}-\frac{x}{2}\right)\sin^2\frac{x}{2}$$
That is 
$$2\sin\left(\frac{\pi}{4}-\frac{x}{2}\right)\sin\frac{x}{2}=\pm 1.\tag{1}$$
This means
$$\cos\left(\frac{\pi}{4}-x\right)-\cos\frac{\pi}{4}=\pm 1.$$
Therefore
$$\cos\left(\frac{\pi}{4}-x\right)=\frac{1\pm\sqrt{2}}{\sqrt{2}}.$$
But $\frac{1+\sqrt2}{\sqrt2}>1$, so
$$\cos\left(\frac{\pi}{4}-x\right)=\frac{1-\sqrt 2}{\sqrt2}.\tag{2}$$
Therefore
$$2n\pi+\left(\frac{\pi}{4}-x\right) =  \pm \arccos \frac{1-\sqrt 2}{\sqrt2}$$
for some integer $n$.  This gives us
$$x=\left(2n+\frac14\right)\pi \pm \arccos \frac{1-\sqrt 2}{\sqrt2}.\tag{3}$$
In fact there are also complex solutions to $(1)$, and they are given by
$$x=\left(2n+\frac{1}{4}\right)\pi\pm i\operatorname{arccosh} \frac{1+\sqrt 2}{\sqrt2}.\tag{4}$$
Note that $$\operatorname{arccosh} \frac{1+\sqrt 2}{\sqrt2}=\ln\left(\frac{1+\sqrt2+\sqrt{1+2\sqrt2}}{\sqrt2}\right).$$
All real and complex solutions to the original equation are given by $(3)$ and $(4)$.
Note that
$$\frac\pi4 + \arccos \frac{1-\sqrt 2}{\sqrt2}=\frac12\arcsin(2-2\sqrt2)+\pi$$
and
$$\frac\pi4 -\arccos \frac{1-\sqrt 2}{\sqrt2}=\frac{\pi}{2}-\frac12\arcsin(2-2\sqrt2)-\pi.$$
So your solutions only work for odd $k$.  Even values of $k$ do not give solutions.
A: There is a subtle way to get rid of the extra solutions that uses the work you've done.
When you render
$\sin 2x=2\sin x\cos x =2-2\sqrt{2}$
you then have with $u=\sin x, v=\cos x$:
$uv=1-\sqrt{2}$
$\color{blue}{u+v=uv=1-\sqrt{2}}$
where the blue equation reimposes the original requirement and it's goodbye extraneous roots.  Using the Vieta formulas for a quadratic polynomial this is solved by rendering $u$ and $v$ as the two roots of the quadratic equation
$w^2-(1-\sqrt2)w+(1-\sqrt2)=0$
The roots of this equation are obtained by the usual methods, and because of the symmetry of the original equation between $\sin x$ and $\cos x$ you may take either root as the sine and the other as the cosine.  Note that with the negative product the values must be oppositely signed which informs us of quadrant location.
$\sin x=\dfrac{1-\sqrt2+\sqrt{2\sqrt2-1}}{2},\cos x=\dfrac{1-\sqrt2-\sqrt{2\sqrt2-1}}{2}$ ($x$ in 2nd quadrant)
$\sin x=\dfrac{1-\sqrt2-\sqrt{2\sqrt2-1}}{2},\cos x=\dfrac{1-\sqrt2+\sqrt{2\sqrt2-1}}{2}$ ($x$ in 4th quadrant)
Then with the quadrant information above we may render the correct roots for $x$:
$x=\pi-\arcsin(\dfrac{1-\sqrt2+\sqrt{2\sqrt2-1}}{2})+2n\pi$
$x=\arcsin(\dfrac{1-\sqrt2-\sqrt{2\sqrt2-1}}{2})+2n\pi$
A: Using auxiliary angle, we first change the equation
$$
\sin x+\cos x=\sin x \cos x \tag*{(*)} 
$$
equivalently to
$$
\sqrt{2} \cos \left(x-\frac{\pi}{4}\right)= \frac{\sin 2 x}{2} 
$$
Putting $y=x-\dfrac{\pi}{4} $ gives a quadratic equation in $\cos y $
$$
\sqrt{2} \cos y=\frac{1}{2}\left(2 \cos ^{2} y-1\right)
$$
Solving the quadratic equation yields
$$
\cos y=\frac{\sqrt{2}-2}{2} \text { or } \frac{\sqrt{2}+2}{2} \text { (rejected) }
$$
Plugging  the general solution for $(*)$ is
$$
x=\frac{(8 n+1) \pi}{4} \pm \cos ^{-1}\left(\frac{\sqrt{2}-2}{2}\right),
$$
where $n\in Z.$
