Square roots in trigonometry. I don’t understand please help?

By definitions of the (co)tangent and cosecant function,
[tex]3\tan^2x-2=\csc^2x-\cot^2x\iff3\dfrac{\sin^2x}{\cos^2x}-2=\dfrac1{\sin^2x}-\dfrac{\cos^2x}{\sin^2x}[/tex]
Turn everything into fractions with common denominators:
[tex]\dfrac{3\sin^2x-2\cos^2x}{\cos^2x}=\dfrac{1-\cos^2x}{\sin^2x}[/tex]
Recall that [tex]\cos^2x+\sin^2x=1[/tex], so we can simplify both sides a bit.
On the left:
[tex]\dfrac{3\sin^2x+3\cos^2x-5\cos^2x}{\cos^2x}=\dfrac{3-5\cos^2x}{\cos^2x}[/tex]
On the right:
[tex]\dfrac{1-\cos^2x}{\sin^2x}=\dfrac{\sin^2x}{\sin^2x}=1[/tex]
(as long as [tex]\sin x\neq 0[/tex], which happens in the interval [tex]0\le x\le\pi[/tex] when [tex]x=0[/tex] or [tex]x=\pi[/tex])
So we have
[tex]\dfrac{3-5\cos^2x}{\cos^2x}=1\implies3-5\cos^2x=\cos^2x[/tex]
[tex]\implies3=6\cos^2x[/tex]
[tex]\implies\cos^2x=\dfrac12[/tex]
[tex]\implies\cos x=\pm\dfrac1{\sqrt2}[/tex]
[tex]\implies x=\dfrac\pi4\text{ or }x=\dfrac{3\pi}4[/tex]