Differentiate f(x)=x2cosx, then find the slope of its graph at x=π.
f(x)=x2cosx
1
See why expanding fails
In x2(x+1) you could multiply out and use the power rule. Here there is nothing to multiply out, because x2 and cosx are different kinds of function. The product rule is the route.
2
Name the four pieces
The first factor is x2, with derivative 2x. The second is cosx, with derivative −sinx. The minus sign belongs to g′, so write it down now.
f=x2, f′=2x,g=cosx, g′=−sinx
f=x2, f′=2xg=cosx, g′=−sinx
3
Apply the product rule
The first factor’s derivative times the second, plus the first times the second’s derivative. Keep the brackets around −sinx until the next step.
f′(x)=2xcosx+x2(−sinx)
4
Simplify
Adding a negative is subtracting. Both terms share a factor of x, so the derivative can also be written x(2cosx−xsinx).
f′(x)=2xcosx−x2sinx
5
Find the slope at x=π
cosπ=−1 and sinπ=0. The first term is 2π⋅(−1)=−2π and the second is π2⋅0=0, which leaves f′(π)=−2π≈−6.283. The graph is falling steeply at x=π.
f′(π)=2π(−1)−π2(0)=−2π
6
Test it with numbers
From x=π to π+0.001 the secant slope is about −6.279, close to −6.283. The wrong sign, 2xcosx+x2sinx, also gives −2π here, because sinπ=0. At x=π/2 the two differ, −π2/4 against +π2/4, and a secant there finds the falling one.
Result
f′(x)=2xcosx−x2sinx, and f′(π)=−2π≈−6.28.
f′(x)=2xcosx−x2sinx
Your turn
1. One like the example
Differentiate y=xsinx.
Show the answer and explanation
dy/dx=sinx+xcosx.
The first factor x has derivative 1, and the second, sinx, has derivative cosx. The product rule gives 1⋅sinx+x⋅cosx.
y=xsinxdxdy=sinx+xcosx
2. A variation
Differentiate f(x)=exsinx. Here neither factor is a polynomial.
Show the answer and explanation
f′(x)=ex(sinx+cosx).
ex is its own derivative and sinx has derivative cosx. The product rule gives exsinx+excosx, and factoring out ex gives ex(sinx+cosx).