TITLE: Show that the general value of $\theta$ satisfying $\sin\theta=\sin\alpha$ and $\cos\theta = \cos\alpha$ is given by $\theta = 2n\pi + \alpha$
QUESTION [7 upvotes]: The general value of $\theta$ simultaneously satisfying equations, $$\sin\theta = \sin\alpha \quad\text{and}\quad \cos\theta = \cos\alpha$$
  is given by
  $$\theta = 2n\pi + \alpha \ \forall \ n \in \mathbb{Z} \\$$

My attempt:
Adding the two equations, 
$$\sin\theta + \cos\theta = \sin\alpha + \cos\alpha$$
$$\sin\theta - \sin\alpha = \cos\alpha - \cos\theta$$
$$2\cos\left( \frac{\theta + \alpha}{2} \right)\sin\left( \frac{\theta - \alpha}{2} \right)= 2\sin\left( \frac{\theta + \alpha}{2} \right)\sin\left( \frac{\theta - \alpha}{2} \right)$$
$$\cos^2\left( \frac{\theta + \alpha}{2} \right) = \sin^2\left( \frac{\theta + \alpha}{2} \right)$$
$$\cos(\theta + \alpha) = 0$$
$$\therefore \theta + \alpha = (2n+1)\frac{\pi}{2},\  n \in \mathbb{Z}$$
$$\theta = (2n+1)\frac{\pi}{2} - \alpha, \ n \in \mathbb{Z} $$
Why doesn't my solution match with the correct solution?
Please help!

REPLY [4 votes]: No matter how complicated expressions get, you still can't divide by zero, which you implicitly did from the third line.
In this case we might have that $\sin\frac{\theta-\alpha}2=0$, which reduces to $\theta=2n\pi+\alpha$ for some $n\in\mathbb Z$ as desired. If it is not zero, we can divide by it and get
$$\cos\frac{\theta+\alpha}2=\sin\frac{\theta+\alpha}2$$
which reduces to $\theta=\frac\pi2+2n\pi-\alpha$, but this does not satisfy the original system.