Solving $\sin x - \cos x = 1$ I have been trying to solve $\sin x - \cos x = 1$ by squaring both sides but has not been able to obtain the solution. Here is what I did:
$$\begin{align}(\sin x - \cos x)^2 &=1^2\\\sin^2x-2\sin x\cos x+\cos^2x&=1\\1-\sin 2x&=1\\\sin2x&=0\end{align}$$
Obviously $x=0$ is not a solution. May I ask why this is the case or where did things go wrong?
Thank You

As squaring will yield more answers than enough, I am now going to solve the equation using $\sin ^{2} x+\cos ^{2} x=1$.
Let $a=\sin x \text { and } b=\cos x,$ then
$$
\begin{aligned}
&\left\{\begin{array}{l}
a-b=1 \quad \cdots(1) \\
a^{2}+b^{2}=1 \quad \cdots(2)
\end{array}\right.\\
\Rightarrow \quad & a^{2}+(a-1)^{2}=1 \\
\Rightarrow \quad & 2 a(a-1)=0 \\
\Rightarrow \quad & a=0 \text { or } 1
\end{aligned}
$$
A. When $a=0, b=-1$
$$
\left\{\begin{array}{l}
\sin x=0 \\
\cos x=-1
\end{array} \Rightarrow x=(2 n+1) \pi\right. \text {, where }n\in Z.
$$
B. When $a=1, b=0$
$$
\left\{\begin{array}{l}
\sin x=1 \\
\cos x=0
\end{array} \quad \Rightarrow x=\frac{(4 n+1) \pi}{2} \text {, where } n \in \mathbb{Z}\right.
$$
Therefore the solutions are $x=(2 n+1) \pi \text{ and } \dfrac{(4 n+1) \pi}{2}, \text {where } n\in Z.$
