Product and Quotient Rules I
Objectives
- Use the derivative at a given input to obtain a linear approximation of the function there.
- Use basic derivative rules plus the product and quotient rules to find derivatives by hand.
- In R, use
D()to find the derivative of a function.
1. Linear Approximation
Objective. Use the derivative at a given input to obtain a linear approximation of the function there.
Definition 1 (Linear approximation).
For a function differentiable at , the linear approximation of when is the tangent line to when , given by
The line through and , two points on the graph of , is not the linear approximation of when , because the definition requires the tangent line. This line is a secant line with slope , while the tangent line has slope (Example 1).
For inputs near , the value is close to , because has the same output and the same rate of change as at . The difference is the error of the approximation. Farther from , the graph of can bend away from the line, and the error can grow.
Example 1
Find the linear approximation of
at . Estimate and with the linear approximation.
ShowHide solution
By the definition of the linear approximation, is the tangent line to when . Substitute into the formula for the linear approximation:
Rewrite as . The power rule gives . Evaluate and at 4:
Substitute both values into :
Estimate with at :
For comparison, R computes the true value with sqrt(4.1): . The error is small, because 4.1 is close to .
Estimate with at :
The true value is . The error is far larger in size, because 16 is far from . On the graph, the red line touches the curve at and lies close to the curve for inputs near . At the line lies above the curve.
Example 2
In R, find the linear approximation of
at . Estimate with the linear approximation, compare the estimate with , and plot with .
ShowHide solution
Build the linear approximation as in Example 1, with and from R. Then compare with , and plot with . Used R.
f = makeFun(x^3 - 5*x ~ x) df = D(f(x) ~ x) f(1) [1] -4 df(1) [1] -2 L = makeFun(f(1) + df(1)*(x - 1) ~ x) L(1.1) [1] -4.2 f(1.1) [1] -4.169 plotFun(f(x) ~ x, xlim = range(-3, 3)) plotFun(L(x) ~ x, add = TRUE, col = "red")
The code stores the derivative under the name df. R prints and . The linear approximation is therefore . The command that defines L is the formula written in R. The error of the estimate is . In the plot, the red line touches the black curve at with slope .
Example 3
For the function
find and in R. Write the linear approximation of at , and estimate with it.
ShowHide solution
Compute from g and from the derivative that D() returns, build as in Example 2, and evaluate . Used R.
g = makeFun(x^2*sin(x)/(x + 1) ~ x) dg = D(g(x) ~ x) g(2) [1] 1.212397 dg(2) [1] 0.2534019 L = makeFun(g(2) + dg(2)*(x - 2) ~ x) L(1.9) [1] 1.187056
To three decimals, and . The linear approximation is
and the estimate is .
2. Product and Quotient Rules
Objective. Use basic derivative rules plus the product and quotient rules to find derivatives by hand.
To differentiate a product of two functions, use the product rule below. For , combining the factors into one power first gives
and the product rule gives the same derivative without combining:
Rule 2 (Product rule).
Let and be differentiable functions. Then
Rule 3 (Quotient rule).
Let and be differentiable functions. When , the following holds:
The rules in words. The derivative of a product is the sum of two terms, each the derivative of one factor times the other factor. The derivative of a quotient is the denominator times the derivative of the numerator, minus the numerator times the derivative of the denominator, all divided by the square of the denominator.
Order in the quotient rule. In the quotient rule, the numerator is a difference. Reversing its two terms gives the negative of the derivative.
Squared sine notation. The expression means .
Example 4
Differentiate
ShowHide solution
By the product rule, the derivative of a product of two differentiable factors and is
Here the factors are , with derivative , and , with derivative . Substitute them into the product rule:
Example 5
Differentiate
ShowHide solution
The two factors are , with derivative by the power rule, and , with derivative . By the product rule,
for every with , where both factors are differentiable.
Example 6
Differentiate
ShowHide solution
By the quotient rule, the derivative of a quotient of a differentiable by a differentiable , at each input with , is
Here the numerator is , with derivative , and the denominator is , with derivative . Substitute them into the quotient rule, then divide the numerator and the denominator by :
for every with .
Example 7
Differentiate
ShowHide solution
The numerator is , with derivative , and the denominator is , with derivative 1. By the quotient rule,
for every with .
Example 8
Differentiate
ShowHide solution
The numerator is , with derivative , and the denominator is , with derivative . By the quotient rule,
for every with , because for every input .
Example 9
Differentiate
ShowHide solution
The numerator is a product. By the product rule, its derivative is
The denominator is , with derivative . By the quotient rule,
for every with and .
Example 10
Determine which of these functions are differentiated with the product rule, which with the quotient rule, and which with only the basic derivative rules of Lesson 29:
ShowHide solution
- Differentiate and with the product rule, because each is a product of two non-constant factors, and no algebra rewrites it as a linear combination of power functions and basic modeling functions (Lesson 29).
- Differentiate with the quotient rule, because its denominator is not constant, and no algebra rewrites the quotient as a linear combination of power functions and basic modeling functions.
- Differentiate with only the basic derivative rules, because the function is the constant 4 times . Its derivative is .
- Differentiate with only the basic derivative rules, because the function is the constant times . Its derivative is .
- Differentiate with only the basic derivative rules, because the function simplifies to . Its derivative is . The simplified form equals only for , the domain of . The derivative applies on that domain.
3. Derivatives in R
Objective. In R, use D() to find the derivative of a function.
The command D() differentiates products and quotients with the same syntax as in Lesson 29, D(f(x) ~ x).
Checking a hand derivative. The derivative R prints can look different from the hand derivative and still be equal to it. To check, rewrite the printed form by algebra until it matches the hand derivative. To spot-check, evaluate both derivatives at one input: different outputs show that the two derivatives differ, and equal outputs show agreement at that input only.
Parentheses in a quotient. Type a quotient with parentheses around a numerator or a denominator that has more than one term, as in (3*x - 2)/(x^2 + 5). Without them, 3*x - 2/(x^2 + 5) divides only the 2, and R gives a wrong value with no error.
Products in R. Type every product with *. R rejects 3x^2, typed in place of 3*x^2, with an error:
> 3x^2 Error: unexpected symbol in "3x"
Example 11
Find the derivative of
in R. Check it against the hand derivative .
ShowHide solution
Define , differentiate it with D(), and print the derivative. Used R.
f = makeFun(3*x^2*exp(x) ~ x) df = D(f(x) ~ x) df function (x) 3 * (x^2 * exp(x) + 2 * x * exp(x))
R prints the derivative as a function of , with its formula on the second line. The printed form matches the hand derivative. As a spot check at , the hand derivative is
Evaluate the R derivative and . Used R.
df(1) [1] 24.46454 9*exp(1) [1] 24.46454
The two outputs are equal at , consistent with the algebraic match.
Example 12
Find the derivative of
in R. Check it against the hand derivative .
ShowHide solution
Define with parentheses around the denominator, differentiate it with D(), and print the derivative. Used R.
r = makeFun(x^2/(x + 1) ~ x) dr = D(r(x) ~ x) dr function (x) { .e1 <- 1 + x x * (2 - x/.e1)/.e1 }
The line .e1 <- 1 + x stores the denominator under the name .e1, and the last line is the derivative written with that name:
The printed form matches the hand derivative. As a spot check at , the hand derivative is
Evaluate the R derivative at 1. Used R.
dr(1) [1] 0.75
The R value and the hand value are equal at , consistent with the algebraic match.
Found a mistake, a broken tool or something unclear? Report a problem