Solutions of sin(x) = cos(x) I know that the solutions to the equation $\sin(x) = \cos(x)$ are :
$ x= \frac{\pi}{4}$  (45°) ; $ x= \frac{5 \pi}{4}$ (225°)
However when I try to solve it algebraically I get the following :
$$  \sin x = \cos x$$
$$  \sin^2 x = \cos^2 x$$
$$  \sin^2 = 1 - \sin^2 x$$
$$  2\sin^2 x = 1$$
$$  sin^2 x = \frac{1}{2}$$
$$ \sqrt {sin^2 x} = \sqrt{\frac{1}{2}}$$
$$ \sqrt {sin^2 x} = \sqrt{\frac{1}{2}}$$
$$ \sin x= \lvert\frac{1}{\sqrt2}\rvert$$
$$ \sin x= \frac{\sqrt2}{2}  ;  \sin x= -\frac{\sqrt2}{2}$$
So if I look for all the values of $x$ that solve the above I should get not only $ x= \frac{\pi}{4}$  (45°) ; $ x= \frac{5 \pi}{4}$ (225°) but also $ x= \frac{3\pi}{4}$  (135°) ; $ x= \frac{7 \pi}{4}$ (315°).
What am I doing wrong?

$\cos x=\sin x=\cos\left(\frac{\pi}{2}-x\right)$ thus $x=\frac{\pi}{2}-x \bmod [2\pi]$ or $x=-\frac{\pi}{2}+x \bmod [2\pi]$. The first equation has $\pi/4$ as solution and the second does not provide a solution.
