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.

First you multiplied by $\sin{4x}$. When this is zero, this makes the equation satisfied automatically. That's 8 extra roots...
Also, because you squared, you lost the information that
$$ \sin{4x}+\cos{4x} = +1: $$
if you square
$$ \sin{4x}+\cos{4x} = -1, $$
you end up with the same equation. Hence you are solving both of these equations:
$$ 0 = (\sin{4x}+\cos{4x}+1)(\sin{4x}+\cos{4x}-1) = (\sin{4x}+\cos{4x})^2 - 1 $$

I think this is what you did:
$$ 1-\cos{2\theta} = 1-\cos^2{\theta}+\sin^2{\theta}=2\sin^2{\theta}, $$
so
$$ \csc{4x}-\cot{4x} = \frac{1-\cos{4x}}{\sin{4x}} = \frac{2\sin^2{2x}}{2\sin{2x}\cos{2x}} $$
At this point we have the worry that $\sin^2{2x}=0$. Thankfully this doesn't matter: there are two on the top, so the answer would end up as zero anyway. So I get your $\tan{2x}=1$, and then you have the correct solutions. (But note I checked when I cancelled terms that might be zero)
