I know that I can't divide by $\cos x$ when solving an equation because it might be equal to $0$. In a worksheet, my teacher divided by $\cos x$. I want to know when can I divide by it.
$$\frac{8 \sin^2(x) (2\cos^3x-\cos x)}{\cos(x)} = \frac{4\cos^5x+\cos x-4\cos^3x}{\cos(x)}$$
You can divide by anything that is not constantly $0$ as long as you treat separately the case when that thing is $0$. That way, you obtain some solutions for $\cos{x}=0$ and some other solutions for $\cos{x}\neq 0$.