TITLE: Extra solutions when solving $\sin\theta+\cos\theta=\sqrt{2\sin2\theta}$
QUESTION [21 upvotes]: The problem:
$$\sin\theta+\cos\theta=\sqrt{2\sin2\theta}$$
My solution:
$$\sin\theta+\cos\theta=\sqrt{2\sin2\theta}$$
$$\sin\theta+\cos\theta=\sqrt{2\times2\sin\theta\cos\theta}$$
$$\sin\theta+\cos\theta=2\sqrt{\sin\theta\cos\theta}$$
$$\sin\theta-2\sqrt{\sin\theta\cos\theta}+\cos\theta=0$$
$$(\sqrt{\sin\theta}-\sqrt{\cos\theta})^2=0$$
$$\sqrt{\sin\theta}=\sqrt{\cos\theta}$$
Either $\cos\theta$ or $\sin\theta$ can be equal to zero. Both can't be equal to zero at the same time. As we can see that $\sqrt{\sin\theta}=\sqrt{\cos\theta}$, neither of $\cos\theta$ and $\sin\theta$ is equal to zero. So, dividing both sides by $\cos\theta$ is valid.
$$\sqrt{\tan\theta}=1$$
$$\tan\theta=1$$
$$\theta=n\pi+\frac{\pi}{4}\tag{1}$$
My question:

We've stumbled upon an interesting solution in (1). Here, $\theta$ satisfies our original equation only when $n$ is even or $0$. Why is that? Isn't $n$ supposed to belong to the set of integers?

PS: This might help you in answering the question.

REPLY [2 votes]: By squaring, you have established that any solution of the equation must be of the form $\theta = \frac{\pi}{4}+k \pi$. However, not all numbers  with this form need to be solutions of the equation. Imagine a simpler situation, where you are solving $x = -\sqrt{x}$, and thus assuming that $x\ge 0$. When you square both sides of the equality, you obtain $x^2=x \Leftrightarrow x = 0 \vee x = 1$, but $x=1$ is clearly not a solution to the initial equation. This boils down to realising that $ a = b \Rightarrow a^2=b^2$ but $a^2=b^2 \not \Rightarrow a = b$.