Use basic rules plus the product and quotient rules to find derivatives by hand.
Using R, obtain and plot the derivative of a function.
1. Derivatives by Hand
Objective. Use basic rules plus the product and quotient rules to find derivatives by hand.
Order of work. Finding a derivative by hand combines the basic rules from sections 2 to 4 of the Lesson 29 Notes with the product and quotient rules from section 2 of the Lesson 30 Notes.
Rewrite roots and reciprocals of powers of x as powers, as in x=x1/2 and 1/x2=x−2.
Identify the main operation: a sum, a constant multiple, a product, or a quotient.
For a sum, differentiate term by term. For a constant multiple, keep the constant and differentiate the function it multiplies. Apply steps 4 and 5 to each term or function that is a product or a quotient.
For a product or a quotient, name u and v: the factors of a product, or the numerator and denominator of a quotient.
Find u′ and v′. When u or v is itself a product or a quotient, find its derivative by the same steps. Substitute u, u′, v, and v′, each in parentheses, into the product rule or the quotient rule.
Simplify the result.
Example 1
For the function
y=x2x4−3x2+6,
find y′ by simplifying first. Then find y′ by the quotient rule.
ShowHide solution
To simplify first, divide each term of the numerator by x2:
y=x2x4−x23x2+x26=x2−3+6x−2.
Differentiate term by term with the power, constant multiple, and sum rules:
y′=2x−0+6(−2)x−3=2x−12x−3=2x−x312.
For the quotient rule, find the derivatives of the numerator u and the denominator v:
u=x4−3x2+6,u′=4x3−6x,v=x2,v′=2x.
Substitute u, u′, v, and v′ into the quotient rule, (vu)′=v2u′v−uv′, and expand the numerator:
The two methods give the same derivative, and simplifying first takes fewer steps.
Example 2
Find the derivative:
y=4ex3x−2ln(x)+5x3.
ShowHide solution
The main operation is a sum. Its first term is 4 times the product ex3x. Differentiate the product by substituting u=ex, u′=ex, v=3x, and v′=3xln(3) into the product rule, (uv)′=u′v+uv′:
dxd(ex3x)=ex3x+ex3xln(3)=ex3x(1+ln(3)).
Differentiate the whole sum term by term with the constant multiple, logarithm, and power rules:
The main operation is a quotient. Rewrite x as x1/2, and write the numerator u and the denominator v with their derivatives:
u=x5−x1/2,u′=5x4−21x−1/2,v=cos(x),v′=−sin(x).
Substitute u, u′, v, and v′ into the quotient rule. Since v′=−sin(x), the term −uv′ becomes +(x5−x)sin(x) in the numerator. In the second line, x1/2 and x−1/2 are written as roots again:
The main operation is a quotient with u=cos(x), u′=−sin(x), and v=(x3+1)ex. The denominator is itself a product. Find v′ by the product rule, with factors x3+1 and ex and their derivatives 3x2 and ex:
v′=3x2ex+(x3+1)ex=ex(x3+3x2+1).
Substitute u, u′, v, and v′ into the quotient rule:
Substitute u, u′, v, and v′ into the product rule or the quotient rule.
Simplify the result.
Compare the result with each choice.
Example 6
Determine which choice is the derivative of
f(x)=x3+xln(x).
(a) (x3+x)2ln(x)(3x2+1)−x1(x3+x)
(b) (x3+x)2x1(x3+x)+ln(x)(3x2+1)
(c) x3+xx1(x3+x)−ln(x)(3x2+1)
(d) (x3+x)2x2+1−(3x2+1)ln(x)
ShowHide solution
Substitute u=ln(x), u′=1/x, v=x3+x, and v′=3x2+1 into the quotient rule:
f′(x)=(x3+x)2x1(x3+x)−ln(x)(3x2+1).
Simplify the first term of the numerator, x1(x3+x)=x2+1:
f′(x)=(x3+x)2x2+1−(3x2+1)ln(x).
Choice (d) matches this derivative. Choice (a) subtracts the numerator’s terms in the opposite order, choice (b) adds them, and choice (c) has no square in the denominator.
Objective. Using R, obtain and plot the derivative of a function.
Plotting a derivative. The command D() from section 5 of the Lesson 29 Notes returns the derivative as a function. Give it a name, as in df = D(f(x) ~ x), so that later commands can use it. To plot df for a≤x≤b, with the vertical axis from c to d, use the command
Roots in R. For positive x, the cube root of x is x^(1/3), with the exponent in parentheses. Without them, R reads x^1/3 as x1 divided by 3 and gives a wrong value with no error:
> 8^(1/3)
[1] 2
> 8^1/3
[1] 2.666667
Example 7
For the function
f(x)=cos(x)x5−x,
find f′(1) in R. Then plot f′ for 0.2≤x≤1.2, with the vertical axis from −5 to 40.
ShowHide solution
Define f, differentiate it with D(), evaluate the derivative at 1, and plot it over the requested window. Used R.
To three decimals, f′(1)≈8.329. As a check by the quotient rule with u=x5−x and v=cos(x), the values u(1)=0, u′(1)=5−21=4.5, v(1)=cos(1), and v′(1)=−sin(1) give the same value:
The plot is the graph of f′ over 0.2≤x≤1.2. The value f′(1)≈8.329 is the height of that graph at x=1, the marked point.
Example 8
For the function
g(x)=xcos(x),
determine which curve is the graph of g′(x). Evaluate g′(2) in R.
ShowHide solution
Find g′ by the product rule, with u=x and v=cos(x):
g′(x)=(1)cos(x)+x(−sin(x))=cos(x)−xsin(x).
Evaluate g′(2) to locate one point on the graph of g′. Used R.
g = makeFun(x*cos(x) ~ x)dg = D(g(x) ~ x)dg(2)[1] -2.234742
The formula for g′ found by the product rule gives the same value:
g′(2)=cos(2)−2sin(2)≈−0.416−1.819=−2.235.
At x=2, curve C is the only curve that passes through (2,g′(2))≈(2,−2.235). The other three curves sit above −1 there. Curve C is therefore the graph of g′.
Example 9
The concentration of a drug in the blood, in milligrams per liter, t hours after a dose, is modeled by
C(t)=t2+420t.
Find C′(1) and C′(3) in R. Give the units of C′. Determine whether the concentration is increasing or decreasing three hours after the dose.
ShowHide solution
Define C, differentiate it with D(), and evaluate C′ at 1 and 3. Used R.
The units of C′ are the units of C per unit of t: milligrams per liter per hour.
One hour after the dose, the concentration is increasing at 2.4 milligrams per liter per hour, because C′(1)=2.4 is positive. Three hours after the dose, the concentration is decreasing at about 0.592 milligrams per liter per hour, because C′(3)≈−0.592 is negative. On the graph of C, the tangent line rises at t=1 and falls at t=3.