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

Feb 27, 2016

$\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{2 \left(x - y\right) y}{x} ^ 2$

#### Explanation:

First, let's think of this as $f \left(x\right) = {\left(x - y\right)}^{2} \cdot {y}^{-} 1$ instead, because it is simpler to use the product rule rather than the quotient rule.

Product Rule: $y ' = \frac{\mathrm{dy}}{\mathrm{dx}} = g ' \left(x\right) \cdot h \left(x\right) + h ' \left(x\right) \cdot g \left(x\right)$

Let $g \left(x\right) = {\left(x - y\right)}^{2}$. Let's compute for $g ' \left(x\right)$.

$\left[1\right] \text{ } g ' \left(x\right) = 2 \left(x - y\right)$ by Power Rule. We need to use Chain Rule after.

$\left[2\right] \text{ } g ' \left(x\right) = 2 \left(x - y\right) \cdot \left(1 - 1 \cdot \frac{\mathrm{dy}}{\mathrm{dx}}\right)$

$\left[3\right] \text{ } g ' \left(x\right) = 2 \left(x - y\right) - \left[2 \left(x - y\right) \frac{\mathrm{dy}}{\mathrm{dx}}\right]$

Let $h \left(x\right) = {y}^{-} 1$. Let's compute for $h ' \left(x\right)$.

$\left[1\right] \text{ } h ' \left(x\right) = - 1 \cdot {y}^{-} 2$ by Power Rule. We need to use Chain Rule.

$\left[2\right] \text{ } h ' \left(x\right) = - {y}^{-} 2 \cdot 1 \cdot \frac{\mathrm{dy}}{\mathrm{dx}}$

$\left[3\right] \text{ } h ' \left(x\right) = - {y}^{-} 2 \frac{\mathrm{dy}}{\mathrm{dx}}$

Now we can solve for $\frac{\mathrm{dy}}{\mathrm{dx}}$.

$\left[1\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} = g ' \left(x\right) \cdot h \left(x\right) + h ' \left(x\right) \cdot g \left(x\right)$

$\left[2\right] \text{ "dy/dx={2(x-y)-[2(x-y)dy/dx]}*y^-1+[-y^-2dy/dx]"⋅} \left[{\left(x - y\right)}^{2}\right]$

$\left[3\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} = 2 {y}^{-} 1 \left(x - y\right) - \left[2 \left(x - y\right) \frac{\mathrm{dy}}{\mathrm{dx}}\right] {y}^{-} 1 - {y}^{-} 2 \frac{\mathrm{dy}}{\mathrm{dx}} {\left(x - y\right)}^{2}$

$\left[4\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} = \frac{2 \left(x - y\right)}{y} - \frac{2 \left(x - y\right) \frac{\mathrm{dy}}{\mathrm{dx}}}{y} - \frac{\frac{\mathrm{dy}}{\mathrm{dx}} {\left(x - y\right)}^{2}}{y} ^ 2$

Subtract both sides of the equation by the terms containing $\frac{\mathrm{dy}}{\mathrm{dx}}$.

$\left[5\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} + \frac{2 \left(x - y\right) \frac{\mathrm{dy}}{\mathrm{dx}}}{y} + \frac{\frac{\mathrm{dy}}{\mathrm{dx}} {\left(x - y\right)}^{2}}{y} ^ 2 = \frac{2 \left(x - y\right)}{y}$

Factor out $\frac{\mathrm{dy}}{\mathrm{dx}}$.

$\left[6\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} \left(1 + \frac{2 \left(x - y\right)}{y} + \frac{{\left(x - y\right)}^{2}}{y} ^ 2\right) = \frac{2 \left(x - y\right)}{y}$

$\left[7\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} \left(\frac{{y}^{2} + 2 \left(x - y\right) y + {\left(x - y\right)}^{2}}{y} ^ 2\right) = \frac{2 \left(x - y\right)}{y}$

$\left[8\right] \text{ } \frac{\mathrm{dy}}{\mathrm{dx}} = \frac{2 \left(x - y\right)}{y} \left({y}^{2} / {\left[y - \left(x - y\right)\right]}^{2}\right)$

$\left[9\right] \text{ } \textcolor{b l u e}{\frac{\mathrm{dy}}{\mathrm{dx}} = \frac{2 \left(x - y\right) y}{x} ^ 2}$

Note: Your solution doesn't actually have to be this long. In fact, you can complete this whole problem in maybe two or three lines. I just broke it down into several parts so you know what I'm doing.