Why does the second part of the problem cos x turns into cos x^2 explain the problem.

Step-by-step explanation:
It's not cos x^2
[tex]\cos^2x\neq\cos x^2[/tex]
----------------------------------------------
[tex]\cos x-\dfrac{\sin x\sin x}{\cos x}=\dfrac{\cos x\cos x}{\cos x}-\dfrac{\sin x\sin x}{\cos x}=\dfrac{\cos^2-\sin^2x}{\cos x}[/tex]
It's the same as
[tex]3-\dfrac{2}{3}=\dfrac{3\cdot3}{3}-\dfrac{2}{3}=\dfrac{3^2-2}{3}[/tex]