Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Derivative rules for polynomials

After this lesson: I can use the rules for the derivative of a simple function.

60 min lesson1 commandJupyterLab data science lab: pandas, Matplotlib and scikit-learn in the browser

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

WordWhat it meansExample
Derivativea function that gives the exact slope at every point
Polynomiala sum of powers of x, each with a number in front3x squared + 5x + 7
Power rulebring the power down as a multiplier, then lower the power by one
Sum rulethe derivative of a sum is the sum of the derivatives
Product rulethe 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

FunctionBring the power downDerivativeSlope at x = 2
5No power to bring down00
x1 times x to the power 011
x squared2 times x to the power 12x4
x cubed3 times x to the power 23x squared12
x to the power 44 times x to the power 34x cubed32

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

xTerm x cubed gives 3x squaredTerm 2x gives 2Slope: the two added
0022
1325
212214
327229

The cells students fill in are left blank in this preview.

Estimate the slope at x = 2

Command
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

Code: python
# 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.

About this lab and its source: JupyterLab data science lab: pandas, Matplotlib and scikit-learn in the browser

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.