# Question about the chain rule.

I was doing some practice problems with implicit differentiation and the chain rule. This is something that I have known how to do, but I do not understand why it works. Here is a screenshot of the derivative of $$y^2$$ with respect to $$x$$:

Where exactly does the $$\frac{dy}{dx}\frac{d}{dy}$$ come from? Why exactly does $$dy$$ stay in the numerator; why is the final term $$\frac{dy}{dx}[2y]$$ and not $$\frac{d}{dx}[2x]$$?

• For what it's worth, I find this notation much clearer, easier to parse and work with than the "prime" notation. In this example, you just multiply by $\frac{dy}{dy}$, a.k.a. $1$. Oct 3, 2018 at 10:34

If you want to see why this works fundamentally, we can derive it from the definition of derivatives.

$$lim_{h\to0} \frac{f(x+h)^2 - f(x)^2}{h} = lim_{h\to0} \frac{(f(x+h) - f(x))}{h}(f(x+h)+f(x))$$

The first term becomes $$f'(x)$$ and the second term becomes $$2f(x)$$. So the limit is $$2f'(x)f(x)$$. If $$y=f(x)$$, you can convert this to Leibniz's notation to get $$\frac{dy}{dx}[2y]$$.

It might be easier to understand with the “prime” notation instead of Leibniz notation.

The chain rule says that $$(f\circ g)' = (f' \circ g)\times g'$$. In your case, $$y(x) = g(x)$$ and $$f(x) = x^2$$. You want to find the derivative of $$f\bigl(g(x)\bigr)$$, which, by the chain rule, is $$g'(x) f'(g(x))$$, or $$y'(x) \times 2g(x)$$

The term $$\frac{dy}{dx}\frac{d}{dy}$$ comes from the chain rule. Since you want to differentiate with respect to $$x$$ but your function is interms of $$y$$, by the chain rule first you differentiate your function with respect to $$y$$ and then multiply by the derivative of $$y$$ with respect to x. The notation $$\frac{d}{dx}$$ is kind of nice since it can be seen like you are doing some kind of multiplication by $$1$$ $$\frac{dy^2}{dx}=\frac{dy^2}{dx}\cdot 1=\frac{dy^2}{dx}\frac{dy}{dy}=\frac{dy^2}{dy}\frac{dy}{dx}=2y\frac{dy}{dx}.$$

Though I treated $$\frac{d}{dx}$$ as fractions ,$$\frac{d}{dx}$$ is not really a fraction but turns out it works like a fraction when you apply the chain rule.

Suppose we add an infinitesimal to $$x$$: $$x_1=x_0+\Delta x$$. What happens to $$y$$? By definition, the derivative tells us how much a function changes relative to changes in its input: the change in a function is equal to the change in its input times its derivative (for infinitesimal changes in input). That is, $$\frac{dy}{dx}$$ represents the ratio between the infinitesimal change in $$y$$ and the infinitesimal change in $$x$$: the change in $$y$$ divided by the change in $$x$$ is $$\frac{dy}{dx}$$:

$$\frac{\Delta y}{\Delta x}=\frac{dy}{dx}$$

This can be rewritten as $$\Delta y=\frac{dy}{dx}{\Delta x}$$. In other words, the change in one variable is equal to the derivative with respect to another variable, times the change in that variable. This basically the $$d=rt$$ equation, except more general.

The change in variable is final minus initial: $$\Delta y = y_1-y_0$$. Rewriting, $$y_1=y_0+\Delta y$$. Substituting in $$\Delta y$$: $$y_1=y_0+\frac{dy}{dx} \Delta x$$. Thus, we have $$y_1^2=(y_0+\frac{dy}{dx} \Delta x)^2=y_0^2+2y_0\frac{dy}{dx} \Delta x+(\frac{dy}{dx} \Delta x)^2$$. When we square an infinitesimal, we get zero (a more technical analysis would be more precise than this, but this suffices for current purposes). So $$y_1=y_0^2+2y_0\frac{dy}{dx} \Delta x$$, and the change in $$y$$ is thus $$2y_0\frac{dy}{dx} \Delta x$$. If we say $$g(y)=y^2$$, then we have that $$\Delta g=2y_0\frac{dy}{dx} \Delta x$$, or $$\frac{\Delta g}{\Delta x}=2y_0\frac{dy}{dx}$$.

One thing to keep in mind with Leibniz notation (that is, the $$\frac{dy}{dx}$$ notation) is that derivatives are written as fractions, and we can manipulate them according to many of the rules of fractions (e.g. cancelling out like terms in numerator and denominator), but they aren't "really" fractions. As Ovi says, using the prime notation allows us to avoid this issue, but the problem is that when using the chain rule, it is crucial to keep track of what we are taking the derivative with respect to, which the prime notation is not good at showing. We could also write things in terms of the subscript notation; $$y_x$$ instead of $$\frac{dy}{dx}$$. This has its own problems, but you can replace all instances of $$\frac{dy}{dx}$$ with $$y_x$$ and see if it's an clearer to you.

As a concrete example, suppose you get paid a certain amount of money for each box you make. Your hourly wage will be the rate per box, times the number of boxes you make per hour:

(money/hour) = (money/box)(box/hour)

Suppose you get paid more money per box the more boxes you make: your final payment is the number of boxes squared. Now, suppose you want to know your instantaneous hourly wage. So you ask: if I were to work one more second, how much would my total payment increase? To get to your hourly wage, you then have to multiply that by 3600. So, let's work through this (we'll assume you can get paid for fractional boxes).

You have some rate at which you can make boxes. Let's call that $$b$$. This rate may change; maybe as the day goes on you get tired and can't make boxes as quickly. This doesn't matter; we're just concerned with what $$b$$ is equal to at this particular moment. If you work one more second, you will make $$\frac b{3600}$$ more boxes ($$b$$ is how many boxes you can make per hour). Suppose the number of boxes you've made already is $$B$$. Then after one more second, you will have $$B+\frac b{3600}$$ boxes. Your payment will be that squared: $$(B+\frac b{3600})^2=B^2+2B\frac b{3600}+(\frac b{3600})^2$$. You've already made $$B^2$$, so the extra amount you made from working that extra second is $$2B\frac b{3600}+(\frac b{3600})^2$$. When we multiply by 3600 to get your hourly rate, we get $$2Bb+\frac {b^2}{3600}$$. Note that if instead of looking at how much your payment increased over one second, we were to take smaller and smaller time intervals, the first term would stay the same, but the second term would get smaller and smaller (instead of 3600 in the denominator, we would have larger and larger numbers). So we can take the instantaneous increase in payment to be $$2Bb$$. The $$2B$$ part is coming from the fact that the total payment is $$B^2$$, and the derivative of that with respect to $$B$$ is $$2B$$. Then we multiply that by the derivative of $$B$$ with respect to time, which is $$b$$. So:

derivative of payment with respect to time =
(derivative of payment with respect to boxes) * (derivative of boxes with respect to time)

• can u plz elaborate what u mean by "but they aren't "really" fractions". bcz the definition i know for derivative is just a limit of specific fraction Aug 6, 2022 at 6:14

I think the main problem here is sloppy notation. $$\dfrac{dy}{dx}$$ does not work 'on' $$[2y]$$, rather than it should be multiplied with it. If I had a say, I would write this as: $$\dfrac{d}{dx}[y^2] = \dfrac{d}{dy}[y^2]\cdot \dfrac{dy}{dx} = 2y\cdot y'$$