<s>[INST] Show that the general value of $\theta$ satisfying $\sin\theta=\sin\alpha$ and $\cos\theta = \cos\alpha$ is given by $\theta = 2n\pi + \alpha$ 
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!
 [/INST] One problem is you divided by $\sin\left(\frac{\theta - \alpha}{2}\right)$ when going from the third to fourth lines. However, with $\theta = 2n\pi + \alpha$, then $\frac{\theta - \alpha}{2} = n\pi$, but $\sin(n\pi) = 0$. When you divide by $0$, basically anything can occur from it, including incorrect results such as what you got.
</s>