Math
Derivative calculator
Type a function of x to get its derivative, worked through rule by rule. Choose a higher order for f″, f‴ or f⁽⁴⁾, and enter a point to get the slope there and the equation of the tangent line.
Use ^ for powers and * or a space for multiplication. ln is the natural log; sqrt, abs, sin, cos, tan, sec, asin, sinh, e and pi all work.
━ f(x) = x²·sin(3x) ━ f′(x) ┄ tangent at the point
| Step h | [f(a + h) − f(a)] ÷ h |
|---|---|
| −0.1 | −4.00777 |
| −0.01 | −3.24121 |
| 0.01 | −3.03915 |
| 0.1 | −1.99478 |
Show the working, step by step
Power rule: bring the power down and reduce it by 1
d/dx [x²] = 2x
Trig, chain rule: the derivative of sin(u) is cos(u), times u′ where u = 3x
d/dx [sin(3x)] = cos(3x)·3 = 3cos(3x)
Product rule: with u = x² and v = sin(3x), (uv)′ = u′v + uv′
d/dx [x²·sin(3x)] = 2x·sin(3x) + x²·3cos(3x) = 2x·sin(3x) + 3x²·cos(3x)
Substitute x = pi/2 (1.5707963).
f′(pi/2) = −π ≈ −3.1415927
Each result is simplified automatically; an equivalent form (for example sin(2x) instead of 2sin(x)cos(x)) is equally correct.
What a derivative is
The derivative f′(x) is the slope of the graph of f at x: how fast f changes as x changes. It is defined as a limit of the slope of a chord between two nearby points.
f′(x) = lim h→0 [f(x + h) − f(x)] ÷ h
The table under the graph shows that limit in action: the chord slopes for h = ±0.1 and ±0.01 close in on f′ at your point. In practice nobody differentiates from the definition. You apply a handful of rules, and the calculator does the same.
The rules
| Rule | Formula | Example |
|---|---|---|
| Power | (xⁿ)′ = n·xⁿ⁻¹ | (x⁵)′ = 5x⁴ |
| Constant multiple | (c·u)′ = c·u′ | (7x²)′ = 14x |
| Sum and difference | (u ± v)′ = u′ ± v′ | (x³ − x)′ = 3x² − 1 |
| Product | (uv)′ = u′v + uv′ | (x·eˣ)′ = eˣ + x·eˣ |
| Quotient | (u/v)′ = (u′v − uv′)/v² | (sin x / x)′ = (x·cos x − sin x)/x² |
| Chain | f(g(x))′ = f′(g(x))·g′(x) | (sin 3x)′ = 3cos 3x |
| Exponential | (eᵘ)′ = eᵘ·u′, (aˣ)′ = aˣ·ln a | (2ˣ)′ = 2ˣ·ln 2 |
| Logarithm | (ln u)′ = u′/u | (ln x)′ = 1/x |
| Trig | (sin x)′ = cos x, (cos x)′ = −sin x, (tan x)′ = sec²x | (tan 2x)′ = 2sec²(2x) |
For a power where both base and exponent contain x, such as xˣ, none of these applies directly. Write it as e^(x·ln x) and use the chain and product rules; the calculator labels that step "logarithmic differentiation".
A worked example
The default input is f(x) = x²·sin(3x), evaluated at x = π/2.
- Power rule: (x²)′ = 2x.
- Chain rule: (sin 3x)′ = cos(3x)·3 = 3cos(3x).
- Product rule with u = x², v = sin(3x): f′(x) = 2x·sin(3x) + 3x²·cos(3x).
- At x = π/2, sin(3π/2) = −1 and cos(3π/2) = 0, so f′(π/2) = 2·(π/2)·(−1) + 0 = −π ≈ −3.14159.
- f(π/2) = (π²/4)·(−1) = −π²/4 ≈ −2.4674, so the tangent line is y = −πx + π²/4, or y = −3.14159x + 2.4674.
Higher derivatives
Choosing "Second" or higher differentiates the previous result again. For polynomials the process ends at zero: a cubic has a constant third derivative and a fourth derivative of 0. For eˣ it never ends, since every derivative is eˣ. For sin x the derivatives cycle through cos x, −sin x, −cos x and back to sin x every four steps.
Common mistakes
- Forgetting the chain rule. (sin 3x)′ is 3cos 3x, not cos 3x.
- Differentiating a product factor by factor. (x·sin x)′ is not 1·cos x; it is sin x + x·cos x.
- Sign slips in the quotient rule. It is u′v − uv′ on top, in that order.
- Treating eˣ like a power. The power rule needs a constant exponent; (eˣ)′ = eˣ, not x·eˣ⁻¹.
- Degrees. The trig rules only hold with x in radians, which is what the calculator uses.
Common questions
How do I differentiate a product like x² sin(3x)?
Use the product rule, (uv)′ = u′v + uv′, with u = x² and v = sin(3x). Here u′ = 2x, and v′ = 3cos(3x) by the chain rule, so the derivative is 2x·sin(3x) + 3x²·cos(3x). The working above shows each of those three rule applications as its own step.
When do I need the chain rule?
Whenever a function has something other than plain x inside it: sin(3x), e^(x²), √(x² + 1), ln(cos x). Differentiate the outside function, keep the inside as it is, then multiply by the derivative of the inside. For e^(x²) that gives e^(x²)·2x.
What does the second derivative tell me?
How the slope itself is changing. Where f″ > 0 the graph is concave up (it bends like a cup) and where f″ < 0 it is concave down. At a stationary point, f″ > 0 means a local minimum and f″ < 0 a local maximum. In physics, if f is position then f′ is velocity and f″ is acceleration.
Why does my answer look different from the textbook’s?
The same derivative can be written in many equivalent ways: 2sin(x)cos(x) and sin(2x) are equal, and so are (x⁴ + 3x²)/(x² + 1)² and x²(x² + 3)/(x² + 1)². To check, enter a value in "Evaluate at": equivalent forms give the same number at every point.
Is ln the same as log here?
Yes. Both ln(x) and log(x) mean the natural logarithm, whose derivative is 1/x. For the base-10 logarithm type log10(x); its derivative is 1/(x·ln 10).
Why is the derivative of |x| undefined at 0?
The graph of |x| has a corner at 0: the slope is −1 just to the left and +1 just to the right, so there is no single tangent line. The calculator gives |x|/x, which is −1 or 1 everywhere except x = 0, where it is undefined.
Related calculators
-
Partial derivative
∂f/∂x, ∂f/∂y and mixed second partials of a function of several variables.
-
Integral
Antiderivatives and definite integrals, the reverse of differentiation.
-
Limit
The limit that defines the derivative, and L’Hôpital’s rule.
-
Multivariable calculus
Gradient, Hessian, critical points and double integrals.
-
Graphing calculator
Plot a function to see where it rises, falls and turns.