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.
 A: 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)
A: 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.)
A: This happened because in your first step, you multiplied the equation by $\sin (4x)$.   Anytime that is 0,  it makes the whole equation $0=0$, meaningless, and indeed, the original functions aren't defined when $\sin (4x)=0$.   These are called "extraneous solutions" or "extraneous roots", and they happen when you do mathematical operations that aren't always valid.
A: The problem came when you squared both sides of the equation.  You also ended up with solutions to $\sin4x+\cos4x=-1$ which has the same result when squared.  Disagreeing with previous answers, multiplying by $\sin4x$ does not introduce extraneous solutions since if $\sin4x$ were equal to $0$, neither cotangent nor cosecant would be defined.
I'm not sure what identities you used for the second attempt, but allow me to provide a third method.  If you multiply both sides by $\csc4x+\cot4x$, you get
$$\csc^24x-\cot^24x=\csc4x+\cot4x$$
$$\csc4x+\cot4x=1$$
Adding this to the original equation gives
$$2\csc4x=2$$
$$\csc4x=1$$
$$\sin4x=1$$
$$4x=\frac\pi2+2\pi k$$
$$x=\frac\pi8+\frac{k\pi}2$$
