What is a derivative?
The derivative of a function is a second function that gives its exact slope at every point. A few short rules let you write it down without taking a single step.
In this lesson you will use the power, sum and product rules to differentiate a polynomial. You will then check each answer against the estimate from the last lesson.
By the end of this lesson
Note
I can use the rules for the derivative of a simple function.
Key words
| Word | What it means | Example |
|---|---|---|
| Derivative | a function that gives the exact slope at every point | |
| Polynomial | a sum of powers of x, each with a number in front | 3x squared + 5x + 7 |
| Power rule | bring the power down as a multiplier, then lower the power by one | |
| Sum rule | the derivative of a sum is the sum of the derivatives | |
| Product rule | the derivative of two functions multiplied together |
The cells students fill in are left blank in this preview.
The power rule lowers the power by one
Write each power of x with a number in front. To differentiate it, multiply the number by the power, then lower the power by one.
So x cubed has a derivative of 3 times x squared. A plain number such as 5 never changes, so its slope is zero. The letter x on its own has a slope of 1.
Worked example: the power rule
| Function | Bring the power down | Derivative | Slope at x = 2 |
|---|---|---|---|
| 5 | No power to bring down | 0 | 0 |
| x | 1 times x to the power 0 | 1 | 1 |
| x squared | 2 times x to the power 1 | 2x | 4 |
| x cubed | 3 times x to the power 2 | 3x squared | 12 |
| x to the power 4 | 4 times x to the power 3 | 4x cubed | 32 |
The cells students fill in are left blank in this preview.
Differentiate a polynomial one term at a time
The sum rule says to differentiate each term separately and add the results. A number in front of a term stays in front.
Take 3x squared + 5x + 7. The first term gives 3 times 2x, which is 6x. The second gives 5. The third is a plain number and gives 0. The derivative is 6x + 5.
Worked example: x cubed + 2x at four points
| x | Term x cubed gives 3x squared | Term 2x gives 2 | Slope: the two added |
|---|---|---|---|
| 0 | 0 | 2 | 2 |
| 1 | 3 | 2 | 5 |
| 2 | 12 | 2 | 14 |
| 3 | 27 | 2 | 29 |
The cells students fill in are left blank in this preview.
Estimate the slope at x = 2
docker exec jupyter python3 -c "import numpy as np; x = np.linspace(0, 4, 4001); y = x ** 3 + 2 * x; print(np.gradient(y, x)[2000].round(3))"Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.
The product rule is not slopes multiplied
To differentiate two functions multiplied together, differentiate the first and keep the second. Then keep the first and differentiate the second. Add the two.
Take x times (x + 3). The first part has slope 1, the second has slope 1. So the answer is 1 times (x + 3) plus x times 1, which is 2x + 3. Multiplying it out first gives x squared + 3x, and the power rule agrees.
A common mistake
Warning
Many people think the derivative of a product is the product of the derivatives. For x times x that would be 1 times 1, which is 1. The real slope is 2x. Use the product rule, then check one point with an estimate.
Check a rule against an estimate
# A rule for the slope of x * x * x + 2 * x, checked by estimating it.
def f(x):
return x ** 3 + 2 * x
def rule(x):
return 3 * x ** 2 + 2
for x in [0, 1, 2, 3]:
estimate = (f(x + 0.001) - f(x - 0.001)) / 0.002
print(x, rule(x), round(estimate, 3))
# Change f to x ** 4 and rule to 4 * x ** 3, then run it again.
# Do the two columns still agree?
Going further
In your own notebook, write the derivative of x to the power 5 + 3x squared by hand. Then estimate its slope at x = 2 with a step of 0.001.
The rule should give 92. If your estimate is far from it, find which term went wrong.