# Where is this negative coming from? (Help with the chain rule)

I am a high school student who is having trouble with understanding a resource which I am using for a resource project. The resource gives the derivative of a function as $-2(x-y)b$. I am getting the answer of $2(x-y) \times (-b)$. I am wondering if this is because they wanted to move the negative for simplicity sake (?). I provided a image showing my problem. If you need clarification about my problem feel free to comment. I would appreciate any help.

My Problem

• The two values $-2 \left( x - y \right)b$ and $2 \left( x - y \right) \times \left( -b \right)$ are the same. Aug 23, 2018 at 2:01
• @Aniruddha Deshmukh but did I calculate the derivative correctly? Aug 23, 2018 at 2:02
• See the answer posted below. You will get the idea. Aug 23, 2018 at 2:04

Negative comes from $\dfrac{\partial Z}{\partial y} = -2(x-y)$

This can be shown by $Z = (x-y)^2 = f(x, y)^2 = f^2$ where $f(x, y) = x - y$

Now $\dfrac{\partial Z}{\partial y} = \dfrac{dZ}{df}\dfrac{d f}{dy}$ as $x$ is independent of $y$.

$\dfrac{\partial Z}{\partial f} = 2f = 2(x-y)$

$\dfrac{d f}{dy} = -1$

• so what does that mean? Did they indeed move the negative for simplicity sake or am I missing something? Is my answer the correct one ( 2(x-y)*-b) Aug 23, 2018 at 1:53
• I've edited my answer above to answer this Aug 23, 2018 at 2:05
• Thanks! I didn't think of that before :) Aug 23, 2018 at 2:09