By assuming that you have some test function [tex]\theta\mapsto f(\theta)[/tex], defining a new function [tex]x\mapsto \bar{f}(x)[/tex] by formula [tex]\bar{f}(x)=f(\theta(x))[/tex], where [tex]x\mapsto \theta(x)[/tex] is some inverse of cosine, and then calculating

[tex]
\frac{d}{dx}\bar{f}(x) = \cdots
[/tex]

and then "thinking" that [tex]\bar{f}[/tex] and [tex]f[/tex] are somehow the same thing, and that you could cancel them out of the equation, so that you are left only with operators on the both sides.

Use the chain rule. If y is any function of x (and therefore of [itex]\theta[/itex]),
[tex]\frac{dy}{dx}= \frac{dy}{d\theta}\frac{d\theta}{dx}[/tex]

Since [itex]x= cos(\theta)[/itex], then [itex]dx/d\theta= -sin(\theta)[/itex] so that [itex]d\theta/dx= 1/(-sin(\theta))[/itex] and then
[tex]\frac{dy}{dx}= \frac{-1}{sin(\theta)}\frac{dy}{d\theta}[/tex]