Why this this approach to solving a trig equation yield invalid solutions alongside valid ones? I've got the following equation:
$$\csc(4x) - \cot(4x) = 1$$
$$0 < x < 2\pi$$
At first, I tried solving it like this:
$$\frac{1}{\sin(4x)} - \frac{\cos(4x)}{\sin(4x)} = 1$$
$$1 - \cos(4x) = \sin(4x)$$
$$1 = \sin(4x) + \cos(4x)$$
$$1^2 = \sin^2(4x) + \cos^2(4x) - 2\sin(4x)\cos(4x)$$
Then, because $\sin^2(4x) + \cos^2(4x) = 1$ and $2\sin(4x)\cos(4x) = \sin(8x)$:
$$\sin(8x) = 0$$
giving $$x = \frac{n\pi}{8} \text{, where n is an integer and } 1 \le n \le 15$$ 
However, plugging some of these answers back into the original trig function gives an undefined result, rather than 1. This happens with $x = \pi$, for example. The only valid solutions turn out to be as follows:
$$x = \frac{n\pi}{8} \text{, where } n = 1, 5, 9, 13 $$
I then realised how with some rearranging and the use of some trig identities, the original equation, $\csc(4x) - \cot(4x) = 1$ , could be expressed as:
$$\tan(2x) = 0$$
$$\text{giving } x = \frac{n\pi}{8} \text{, where } n = 1, 5, 9, 13 $$
Why is it that this second approach yields the correct $x$ values alone, while the first approach yields these amongst 11 incorrect values for $x$? Do these incorrect values come from some kind of mistake in the first approach? If not, how exactly do they come about, and aside from substituting them back into the original equation, is there any easy way to discern them from the valid ones?
Thanks for your help.

Hint:
In your first solution you have two critical steps:
1) whan you multilpy by $\sin (4x)$ you must have $\sin (4x) \ne 0$ (this excludes solutions $ k \pi / 8 $ with an  even $ k $)
2) whan you square $1=\sin(4x)+\cos(4x)$ you introduce improper solutions. (this exlude the other solutions as you have find.)
