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

May 18, 2016

See below.

#### Explanation:

In terms of differentiating the above equation, $\frac{\mathrm{dy}}{\mathrm{dx}}$ is to be found.

If you differentiate both sides and fiddle a little bit, it's possible to extract $\frac{\mathrm{dy}}{\mathrm{dx}}$.

The left side will need to be differentiated with the product rule and the left with the quotient rule.

Furthermore, taking derivatives of functions of y occur as follows:

$\frac{\mathrm{df} \left(y\right)}{\mathrm{dx}} = \frac{\mathrm{df} \left(y\right)}{\mathrm{dy}} \frac{\mathrm{dy}}{\mathrm{dx}}$, by the chain rule.
This can be simply remembered as just differentiating the function with respect to $y$ and just sticking a $\frac{\mathrm{dy}}{\mathrm{dx}}$ on the end.

Let's differentiate the left side first:
$\frac{d}{\mathrm{dx}} \left({y}^{2} \cos y\right) = \frac{d}{\mathrm{dx}} \left({y}^{2}\right) \cos y + \frac{d}{\mathrm{dx}} \left(\cos y\right) {y}^{2}$
$\frac{d}{\mathrm{dx}} \left({y}^{2} \cos y\right) = 2 y \cos y \frac{\mathrm{dy}}{\mathrm{dx}} - {y}^{2} \sin y \frac{\mathrm{dy}}{\mathrm{dx}}$

The right side:
$\frac{d}{\mathrm{dx}} \left(\frac{x}{x - y}\right) = \frac{\frac{d}{\mathrm{dx}} \left(x\right) \left(x - y\right) - \frac{d}{\mathrm{dx}} \left(x - y\right) x}{x - y} ^ 2$
$\frac{d}{\mathrm{dx}} \left(\frac{x}{x - y}\right) = \frac{x - y - x \left(1 - \frac{\mathrm{dy}}{\mathrm{dx}}\right)}{x - y} ^ 2$
$\frac{d}{\mathrm{dx}} \left(\frac{x}{x - y}\right) = \frac{y + x \frac{\mathrm{dy}}{\mathrm{dx}}}{x - y} ^ 2$

Therefore:
${y}^{2} \cos y = \frac{x}{x - y}$
Becomes:
$2 y \cos y \frac{\mathrm{dy}}{\mathrm{dx}} - {y}^{2} \sin y \frac{\mathrm{dy}}{\mathrm{dx}} = \frac{y + x \frac{\mathrm{dy}}{\mathrm{dx}}}{x - y} ^ 2$
We need to group all of the $\frac{\mathrm{dy}}{\mathrm{dx}}$ parts on one side in order to solve for it:
$2 y \cos y \frac{\mathrm{dy}}{\mathrm{dx}} - {y}^{2} \sin y \frac{\mathrm{dy}}{\mathrm{dx}} - \frac{x \frac{\mathrm{dy}}{\mathrm{dx}}}{x - y} ^ 2 = \frac{y}{x - y} ^ 2$
Factorise by $\frac{\mathrm{dy}}{\mathrm{dx}}$:
$\frac{\mathrm{dy}}{\mathrm{dx}} \left(2 y \cos y - {y}^{2} \sin y - \frac{x}{x - y} ^ 2\right) = \frac{y}{x - y} ^ 2$
Therefore (and this is a little messy):
$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{y}{{\left(x - y\right)}^{2} \left(2 y \cos y - {y}^{2} \sin y - \frac{x}{x - y} ^ 2\right)}$
Tidy it up a little bit:
$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{y}{{\left(x - y\right)}^{2} \left(2 y \cos y - {y}^{2} \sin y\right) - x}$