How do you differentiate cos(x) = x/(x-y^2-y)?

$\left(x - {y}^{2} - y\right) \cos x = x , x \cos x - {y}^{2} \cos x - y \cos x = x$
$\frac{d}{\mathrm{dx}} \left(x \cos x - {y}^{2} \cos x - y \cos x = x\right)$
$- x \sin x + \cos x - \left(- {y}^{2} \sin x + 2 y \cos x \frac{\mathrm{dy}}{\mathrm{dx}}\right) - \left(- y \sin x + \frac{\mathrm{dy}}{\mathrm{dx}} \cos x\right) = 1$
$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{- x \sin x + \cos x + {y}^{2} \sin x + y \sin x - 1}{2 y \cos x + \cos x}$