Week 6 - Chain Rule #
Differentiation Rules #
The Chain Rule #
- Definition
- If
g
is differentiable atx
andf
is differentiable atg(x)
, then the composite function $F = f \circ g$ defined by $F(x) = f(g(x))$ is differentiable atx
andF'
is given by the product $$F’(x)=f’(g(x)) \cdot g’(x)$$
- If
Implicit Differentiation #
This consists of differentiating both sides of the equation with respect to
x
and then solving the resulting equation fory'
.Sample 1: $x^2+y^2=25$, find $\frac{d}{dx}y$, and the tangent to the circle at point
(3, 4)
.- $$\begin{aligned}
\frac{d}{dx}(x^2+y^2) &= \frac{d}{dx}(25) \\ \frac{d}{dx}(x^2) + \frac{d}{dx}(y^2) &= 0 \\ 2x + 2y \cdot \frac{d}{dx}y &= 0 \\ \frac{d}{dx}y &= -\frac{x}{y}
\end{aligned}$$
- NOTE:
- $y=g(x) = \sqrt{25-x^2}$
y
is a function ofx
and using the Chain Rule, we have $$\frac{d}{dx}(y^2) = \frac{d}{dy}(y^2) \cdot \frac{d}{dx}y = 2y\frac{d}{dx}y$$
- NOTE:
- At the point
(3, 4)
we havex = 3
andy = 4
, so $$\frac{d}{dx}y = -\frac{3}{4}$$
- $$\begin{aligned}
\frac{d}{dx}(x^2+y^2) &= \frac{d}{dx}(25) \\ \frac{d}{dx}(x^2) + \frac{d}{dx}(y^2) &= 0 \\ 2x + 2y \cdot \frac{d}{dx}y &= 0 \\ \frac{d}{dx}y &= -\frac{x}{y}
\end{aligned}$$
Sample 2: $x^3+y^3=axy$ (folium of Descartes)
- $x^3+y^3=6xy$, find $\frac{d}{dx}y$
- $$\begin{aligned} 3x^2 + 3y^2y’ &= 6xy’ + 6y \\ x^2 + y^2y’ &= 2xy’ + 2y \\ (y^2 - 2x)y’ &= 2y - x^2 \\ y’ &= \frac{2y - x^2}{y^2 - 2x} \end{aligned}$$
Derivatives of Inverse Function #
- If
f
is a differentiable function, andf'
is continuous, and $f’(a) \ne 0$, then- $f^{-1}(y)$ is defined for
y
nearf(a)
, $f^{-1}$ is differentiable nearf(a)
, $(f^{-1})’$ is continuous nearf(a)
, and- $$(f^{-1})’(y)=\frac{1}{f’(f^{-1}(y))}$$
- $f^{-1}(y)$ is defined for
- Sample: $$\begin{aligned} f(x) &= x^2\\ (x>0),\\ f’(x) = 2x \\ f^{-1}(x) &= \sqrt{x} \\ (f^{-1})’(x) &= \frac{1}{f’(f^{-1}(x))} = \frac{1}{f’(\sqrt{x})} = \frac{1}{2\sqrt{x}} \end{aligned}$$
Derivatives of Logarithmic Functions #
Note:
- log without base, usually means that the base is 10.
- Another base that is often used is e (Euler’s Number) which is about 2.71828.
- Example: $\ln(7.389) = \log_{e}(7.389) ≈ 2$
- More details: https://www.mathsisfun.com/algebra/logarithms.html
Sample 1: $$\begin{aligned} f(x) &= e^x,\\ f’(x) = e^x \text{(proved in the end of week 5)} \\ f^{-1}(x) &= \ln{x} \\ (f^{-1})’(x) &= \frac{1}{f’(f^{-1}(x))} = \frac{1}{f’(\ln{x})} = \frac{1}{e^{\log{x}}} \\ &= \frac{1}{x} \end{aligned}$$
Sample 2: $$\begin{aligned} f(x) &= \log_{b}{x} \\ f’(x) &= \frac{d}{dx}\frac{\ln{x}}{\ln{b}} = \frac{1}{\ln{b}} \cdot \frac{d}{dx}\ln{x} = \frac{1}{\ln{b}} \cdot \frac{1}{x} \\ &= \frac{1}{x \cdot \ln{b}} \end{aligned}$$
Sample 3: $$\begin{aligned} f(x) &= b^x \\ &= (e^{\ln{b}})^x = e^{\ln{b} \cdot x} \\ f’(x) &= e^{\ln{b} \cdot x} \cdot \frac{d}{dx}(\ln{b} \cdot x)\\ \text{(chain rules)} \\ &= (e^{\ln{b}})^{\cdot x} \cdot \ln{b} \\ &= b^x \cdot \ln{b} \end{aligned}$$
Logarithmic Differentiation #
- The calculation of derivatives of complicated functions involving products, quotients, or powers can often be simplified by taking logarithms.
- Sample: Differentiate $f(x)=\frac{(1+x^2)^5 \cdot (1+x^3)^8}{(1+x^4)^7}$, $$\begin{aligned} y &= \frac{(1+x^2)^5 \cdot (1+x^3)^8}{(1+x^4)^7} \\ \ln{y} &= \ln{\frac{(1+x^2)^5 \cdot (1+x^3)^8}{(1+x^4)^7}} \\ \frac{d}{dx}\ln{y} &= \frac{d}{dx}\ln{\frac{(1+x^2)^5 \cdot (1+x^3)^8}{(1+x^4)^7}} \\ \frac{d}{dx}\ln{y} &= \frac{d}{dx}(5\ln{(1+x^2)} + 8\ln{(1+x^3)} - 7\ln{(1+x^4)}) \\ \frac{1}{y} \cdot \frac{d}{dx}y &= 5\frac{d}{dx}\ln{(1+x^2)} + 8\frac{d}{dx}\ln{(1+x^3)} - 7\frac{d}{dx}\ln{(1+x^4)} \\ \frac{1}{y} \cdot \frac{d}{dx}y &= 5\frac{2x}{1+x^2} + 8\frac{3x^2}{1+x^3} - 7\frac{4x^3}{1+x^4} \\ \frac{d}{dx}y &= (5\frac{2x}{1+x^2} + 8\frac{3x^2}{1+x^3} - 7\frac{4x^3}{1+x^4}) \cdot \frac{(1+x^2)^5 \cdot (1+x^3)^5}{(1+x^4)^7}\\ \end{aligned}$$
Justify the Derivative Rules #
The Power Rule #
- $\frac{d}{dx}x^{-n}=-nx^{-n-1}$
- Before, the power rule only apply for the real numbers, this formula apply for all rational numbers.
- Use chain rules to find the derivative of $f(x)=\frac{1}{x^n}$ :
- First use the limit theorem to find the derivative of $f(x)=\frac{1}{x}$: $$\begin{aligned} \frac{d}{dx}\frac{1}{x} &= \lim_{h \to 0}\frac{\frac{1}{x+h}-\frac{1}{x}}{h} \\ &= \lim_{h \to 0}\frac{\frac{x-h-x}{x(x+h)}}{h} \\ &= \lim_{h \to 0}\frac{\frac{-h}{x(x+h)}}{h} \\ &= \lim_{h \to 0}\frac{-1}{x(x+h)} \\ &= -\frac{1}{x^2} \\ \end{aligned}$$
- Then use chain rules to find the derivative of $f(x)=\frac{1}{x^n}$: $$\begin{aligned} \frac{d}{dx}\frac{1}{x^n} &= - \frac{1}{(x^n)^2} \cdot \frac{d}{dx}x^n \\ &= - \frac{1}{(x^n)^2} \cdot nx^{n-1} \\ &= - nx^{-2n+n-1} \\ &= - nx^{-n-1} \end{aligned}$$
- Sample: Differentiate $y=x^{\sqrt{2}},\\ (x>0)$,
- $$\begin{aligned} \log{y} &= \log{x^{\sqrt{2}}} \\ \frac{d}{dx}\log{y} &= \frac{d}{dx}\log{x^{\sqrt{2}}} \\ \frac{1}{y} \cdot \frac{d}{dx}y &= \frac{d}{dx}\sqrt{2}\log{x} \\ \frac{1}{x^{\sqrt{2}}} \cdot \frac{d}{dx}y &= \sqrt{2} \cdot \frac{1}{x} \\ \frac{d}{dx}y &= \sqrt{2} \cdot \frac{1}{x} \cdot x^{\sqrt{2}} \\ \frac{d}{dx}y &= \sqrt{2} \cdot x^{\sqrt{2}-1} \\ \end{aligned}$$
The Product Rule #
- Use logarithms to prove:
- $$\begin{aligned} f(x) &> 0,\\ g(x) > 0, \\ \ln(f(x)g(x)) &= \ln(f(x)) + \ln(g(x)) \\ \frac{d}{dx} \ln(f(x)g(x)) &= \frac{d}{dx} \ln(f(x)) + \frac{d}{dx} \ln(g(x)) \\ \frac{1}{f(x)g(x)} \cdot \frac{d}{dx}f(x)g(x) &= \frac{1}{f(x)} \cdot \frac{d}{dx}f(x) + \frac{1}{g(x)} \cdot \frac{d}{dx}g(x) \\ \frac{d}{dx}f(x)g(x) &= g(x) \cdot \frac{d}{dx}f(x) + f(x) \cdot \frac{d}{dx}g(x) \end{aligned}$$
The Quotient Rule #
First we need to calculate the derivative of $\frac{1}{g(x)}$ :
- $$\begin{aligned} \text{we have proved this:} f(x) &= \frac{1}{x},\\ f’(x) = -\frac{1}{x^2} \\ so,\\ \frac{d}{dx}\frac{1}{g(x)} &= - \frac{1}{(g(x))^2} \cdot g’(x) \end{aligned}$$
Then:
- $$\begin{aligned} \frac{d}{dx}\frac{f(x)}{g(x)} &= \frac{d}{dx}(f(x) \cdot \frac{1}{g(x)}) \\ &= f’(x) \cdot \frac{1}{g(x)} + f(x) \cdot (- \frac{1}{(g(x))^2} \cdot g’(x)) \\ &= \frac{f’(x) \cdot g(x) - f(x) \cdot g’(x)}{(g(x))^2} \\ \end{aligned}$$
Proof the Chain Rule #
- Recall If
y = f(x)
andx
changes froma
toa + ∆x
, we define the increment ofy
as $$\Delta y = f(a+\Delta x)-f(a)$$. According to the definition of a derivative, we have $$\lim_{\Delta x \to o}\frac{\Delta y}{\Delta x}=f’(a)$$ . So if we denote by $\epsilon$ the difference between the difference quotient and the derivative, we obtain $$\lim_{\Delta x \to 0}\epsilon = \lim_{\Delta x \to 0}(\frac{\Delta y}{\Delta x}-f’(a)) = f’(a)-f’(a) = 0$$. But $$\epsilon = \frac{\Delta y}{\Delta x}-f’(a)\\ \Rightarrow \Delta y = f’(a)\Delta x + \epsilon \Delta x$$. If we define $\epsilon$ to be 0 when∆x = 0
, then $\epsilon$ become a continuous function of∆x
. Thus, for a differentiable functionf
, we can write $$\Delta y = f’(a)\Delta x + \epsilon \Delta x \text{ where } \epsilon \to 0\\ as\\ \Delta x \to 0$$ and $\epsilon$ is a continuous function of∆x
. This property of differentiable functions is what enables us to prove the Chain Rule. - Now to Prove: Suppose
u=g(x)
is differentiable ata
andy=f(u)
is differentiable atb=g(a)
, If∆x
is an increment inx
and∆u
and∆y
are corresponding increments inu
andy
, then we can use last equation to write $$\Delta u = g’(a)\Delta x + \epsilon_1\Delta x = (g’(a) + \epsilon_1)\Delta x$$ where $\epsilon_1 \to 0$ as $\Delta x \to 0$. Similarly $$\Delta y = f’(b)\Delta u + \epsilon_2\Delta u = (f’(b) + \epsilon_2)\Delta u$$ where $\epsilon_2 \to 0$ as $\Delta x \to 0$. If we now substitute the expression for∆u
, we get $$\Delta y = [f’(b) + \epsilon_2][g’(a) + \epsilon_1]\Delta x$$, so $$\frac{\Delta y}{\Delta x} = [f’(b) + \epsilon_2][g’(a) + \epsilon_1]$$. As $\Delta x \to 0$. So both $\epsilon_2 \to 0$ and $\epsilon_1 \to 0$ as $\Delta x \to 0$. Therefore- $$\begin{aligned} \frac{dy}{dx} &= \lim_{\Delta x \to 0}\frac{\Delta y}{\Delta x} = \lim_{\Delta x \to 0}[f’(b) + \epsilon_2][g’(a) + \epsilon_1] \\ &= f’(b)g’(a) = f’(g(a))g’(a) \end{aligned}$$ This prove the Chain Rule.
Review Questions #
- what is chain rule?
- what is the derivatives of inverse function? the formula.
- what is the power rule that suits for product rule as well?