Introduce notation, language, and rules to make concrete the idea of “getting closer and closer to a point but not be equal to that point”
Develop shortcuts for calculating derivatives
Learn how to calculate derivatives by hand using these shortcuts
Jump into using SymPy, a way to do symbolic computation in Python
“Getting closer and closer”
Suppose a function \(f\) is defined for all \(x\) near \(a\), but not necessarily at \(x=a\). We write \[\lim_{x\to a} f(x)=A\] if \(f(x)\) gets closer and closer to \(A\) whenever \(x\) gets closer and closer to \(a\).
\(x\) gets closer and closer to \(a\): \(x\to a\)
\(f(x)\) gets closer and closer to \(A\): \(f(x)\to A\)
Using the terminology
\[\lim_{x\to a} f(x)=A\]
\(A\) is the limit of \(f\) as \(x\) gets closer and closer to \(a\)
Note that it is possible that the limit may not exist (but we do not cover it here yet).
Note that \(f(a)\) itself does not have to be defined.
Working with limits
If \(\displaystyle\lim_{x\to a} f(x)=A\) and \(\lim_{x\to a} g(x)=B\), then
Definition 1 (Derivative at a point) The derivative of the function \(f\) at point a, denoted by \(f^{\prime}(a)\), is given by the formula \[f^{\prime}(a)=\lim_{h\to 0}\frac{f(a+h)-f(a)}{h}.\]
Given a function \(f(x)\), the derivative it itself a function \(f^\prime(x)\) provided that \(x\) is a valid input.
Example 01
Let \(f(x)=mx+b\). Compute the derivative of \(f\).
We found the Newton quotient to be \[\frac{f(a+h)-f(a)}{h}=m.\]
Then \(\displaystyle f^\prime(a)=\lim_{h\to 0} \frac{f(a+h)-f(a)}{h}=?\)
Therefore, if \(f(x)=mx+b\), then \(f^\prime(x)=?\)
Example 02
Let \(g(r)=\pi r^2\). Compute the derivative of \(g\).
We found the Newton quotient to be \[\frac{g(a+h)-g(a)}{h}=2\pi a +\pi h.\]
Then \(\displaystyle g^\prime(a)=\lim_{h\to 0} \left(2\pi a +\pi h\right) = ?\)
Therefore, if \(g(r)=\pi r^2\), then \(g^\prime(x)=?\)
Example 03
Let \(f(x) = \sqrt{x}\). Compute the derivative of \(f\).
We found the Newton quotient to be \[\frac{f(a+h)-f(a)}{h}=\frac{1}{\sqrt{a+h}+\sqrt{a}}.\]
Then \(\displaystyle f^\prime(a)=\lim_{h\to 0} \frac{1}{\sqrt{a+h}+\sqrt{a}} = ?\)
Therefore, if \(f(x) = \sqrt{x}\), then \(f^\prime(x)=?\)
Example 04
Let \(c(t) = \displaystyle \frac{t}{t^2+4}\). Compute the derivative of \(c\).
We found the Newton quotient to be \[\frac{c(a+h)-c(a)}{h}=\frac{-a^2+4-ah}{\left[(a+h)^2+4\right](a^2+4)}.\]
Then \(\displaystyle c^\prime(a)=\lim_{h\to 0} \frac{-a^2+4-ah}{\left[(a+h)^2+4\right](a^2+4)} = ?\)
Therefore, \(c^\prime(t)=?\)
Shortcut 01
We can already just directly use the idea that \[f^\prime(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h},\] with the understanding that \(x\) has to be a valid input.
Shortcut 02
You already found that if \(f(x)=mx+b\), then \(f^{\prime}(x)=m\).
What does this mean when \(m=0\)?
Shortcut 03
Let \(c\) be a constant and \(g(x)=cf(x)\).
What is \(g^\prime(x)\)?
Shortcut 04
You already found that if \(f(x)=mx+b\), then \(f^\prime(x)=m\).
Set \(m=1\). What do you notice?
You already found that if \(g(r)=\pi r^2\), then \(g^\prime(r)= 2\pi r\). So if \(f(x)=x^2\), can you guess what is \(f^\prime(x)\)?
You already found that if \(f(x)=\sqrt{x}\), then \(f^\prime(x)=\displaystyle\frac{1}{2\sqrt{x}}\).
Notice a pattern?
The pattern you see is actually the Power Rule at work.
Let \(r\) be an arbitrary constant. It states that if \(f(x)= x^r\), then \[f^\prime(x)=rx^{r-1}.\]
We cannot prove this for real now, but we will next week.
Shortcut 05
You already found that if \(f(x)=mx+b\), then \(f^\prime(x)=m\).
But you can think of \(mx+b\) as the sum of two functions \(mx\) and \(b\).
Applying the shortcuts you have to get the derivatives of each function, you get derivatives \(m\) and \(0\), respectively.
The pattern you see is actually the Sum Rule at work:
If \(F(x)=f(x)\pm g(x)\), then \[F^\prime(x)=f^\prime(x)\pm g^\prime(x).\]
The rule extends to sums of many functions.
Shortcut 06
Product Rule: If \(F(x)=f(x)\cdot g(x)\), then \[F^\prime(x)=f(x)g^\prime(x)+g(x)f^\prime(x).\]
Quotient Rule: If \(F(x)=\dfrac{f(x)}{g(x)}\), then \[F^\prime(x)=\frac{g(x)f^\prime(x)-f(x)g^\prime(x)}{\left(g(x)\right)^2}.\]
We actually encountered a quotient of two functions already, \[c(t)=\frac{t}{t^2+4}.\]
Use the Quotient Rule to find \(c^\prime(t)\).
Why can’t we use the Product Rule to find \(c^\prime(t)\) for \[c(t)=\frac{t}{t^2+4}=t(t^2+4)^{-1}?\]
Shortcut 07
From one of the exercises in HW01, you (hopefully) found that \[\lim_{h\to 0} \frac{e^h-1}{h}=1.\]
We did not prove the previous result, but only gave an indication that it might be true.
Take comfort in the fact that it is true. If \(f(x)=e^x\), then \(f^\prime(x)=e^x\).
Jumping into SymPy
We will be using SymPy, a part of Python which enables you to do symbolic computation.
# Load SymPyfrom sympy import*# Declare symbolsx = symbols('x', real =True)# Encode the expressionexpr = sqrt(x)# Take derivativediff(expr, x)
\(\displaystyle \frac{1}{2 \sqrt{x}}\)
What if you want \(f^\prime(x)\) if \(f(x)=mx+b\)?
# Load SymPyfrom sympy import*# Declare symbolsx = symbols('x', real =True)m, b = symbols('m b', real =True)# Encode the expressionexpr = m*x+b# Take derivativediff(expr, x)
\(\displaystyle m\)
What if you want \(g^\prime(r)\) if \(g(r)=\pi r^2\)?
# Load SymPyfrom sympy import*# Declare symbolsr = symbols('r', real =True)# Encode the expressionexpr = pi*r**2# Take derivativediff(expr, r)
\(\displaystyle 2 \pi r\)
What if you want \(c^\prime(t)\) if \(c(t)=\dfrac{t}{t^2+4}\)?
# Load SymPyfrom sympy import*# Declare symbolst = symbols('t', real =True)# Encode the expressionexpr = t/(t**2+4)# Take derivativediff(expr, t)