Use implicit differentiation where LaTeX:  \displaystyle y is a function of LaTeX:  \displaystyle x to find the derivative of LaTeX:  \displaystyle y = \cos{\left(x y \right)}

Taking the derivative gives LaTeX:  \displaystyle y' = - \sin{\left(x y \right)}\cdot (xy'+y) . Solving for LaTeX:  \displaystyle y' gives LaTeX:  \displaystyle y' = \left\{- \frac{y \sin{\left(x y \right)}}{x \sin{\left(x y \right)} + 1}\right\}