Question regarding the proof of chain rule using the $\lim_{h \rightarrow 0}\frac{ f(x+h) - f(x)}{h}$ definition of derivative Using the following definition of derivative:

$$\frac{dy}{dx}=\lim_{h \rightarrow 0}\frac{ f(x+h) - f(x)}{h}$$

I am trying to prove the chain rule, that is:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{dg(x)}}  \times\frac{dg(x)}{dx}$$

However, I don't understand where we get the definition of derivative in terms of two functions (colored in red). So that:

$$\frac{df(g(x))}{dg(x)} = \frac{df(g(x))}{d(x)} \times\frac{dx}{dg(x)}$$

$$= \lim_{h \rightarrow 0}\frac{ f(g(x+h)) - f(g(x))}{h} \times \lim_{h \rightarrow 0} \frac{h }{g(x+h) - g(x)}=\lim_{h \rightarrow 0} \frac{ f(g(x+h)) - f(g(x))}{g(x+h) - g(x)}  $$

From which the relation is easy to see. How is this definition/equality derived?¨

$-----------------------$

EDIT:

Here is an attempt but there may still be problems. First note that the term (again in red) is defined as first taking the derivative and then evaluating it at $g(x)$. So we replace every x in $f'(x)$ with $g(x)$. However this should the same as replacing every occurrence of x with $g(x)$ right in the beginning (Admittedly an argument with less hand-waving would be preferable).

As such the red term is equivalent to:

$$\lim_{h \rightarrow 0}\frac{ f(g(x)+h) - f(g(x))}{h}$$

Now substitute $h = g(x)-g(x+h)$

$$\lim_{g(x)-g(x+h) \rightarrow 0}\frac{ f(g(x+h) - f(g(x))}{g(x+h)-g(x)}$$

Which is equivalent to:

$$\lim_{h \rightarrow 0}\frac{ f(g(x+h) - f(g(x))}{g(x+h)-g(x)}$$
$\require{cancel}$

Perhaps look at it this way:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{dg(x)}}  \times\frac{dg(x)}{dx}$$

How we got the quantity in red is because notice how the denominator $\color{red}{dg(x)}$ cancels with the numerator in the next term. So we have that:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{\cancel{dg(x)}}}  \times\frac{\cancel{dg(x)}}{dx}$$

Basically, we have the following:

$$\frac{df(g(x))}{dx} =\frac{df(g(x))}{dx}  \times 1$$

$$1 =\frac{dg(x)}{dg(x)} $$

Hence we get:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{dg(x)}}  \times\frac{dg(x)}{dx}$$

Simply by moving around the denominator. We "get" this because it's required to cancel out terms, which you see further in your chain rule proof. I don't think it's as important that you understand "where it came from", rather then "why it's here and how it's applied"
$\require{cancel}$

Perhaps look at it this way:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{dg(x)}}  \times\frac{dg(x)}{dx}$$

How we got the quantity in red is because notice how the denominator $\color{red}{dg(x)}$ cancels with the numerator in the next term. So we have that:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{\cancel{dg(x)}}}  \times\frac{\cancel{dg(x)}}{dx}$$

Basically, we have the following:

$$\frac{df(g(x))}{dx} =\frac{df(g(x))}{dx}  \times 1$$

$$1 =\frac{dg(x)}{dg(x)} $$

Hence we get:

$$\frac{df(g(x))}{dx} =\color\red{\frac{df(g(x))}{dg(x)}}  \times\frac{dg(x)}{dx}$$

Simply by moving around the denominator. We "get" this because it's required to cancel out terms, which you see further in your chain rule proof. I don't think it's as important that you understand "where it came from", rather then "why it's here and how it's applied"