DigitHelm

Derivative Calculator | Find f′(x) Instantly

Compute 1st through 4th numerical derivatives of any function at any point. Shows tangent line equation, derivative table, and interactive chart.

Click to insert:

Supports: sin cos tan exp ln sqrt asin atan sinh cosh tanh, use ^ for powers, * for multiply

Enter = calculate · Esc = reset

What Is the Derivative Calculator | Find f′(x) Instantly?

The derivative of a function f(x) at a point x₀ measures the instantaneous rate of change, how fast the function's output is changing relative to its input at that exact location. Geometrically, f′(x₀) is the slope of the tangent line to the curve y = f(x) at the point (x₀, f(x₀)).

This calculator uses central finite differences, a numerical method that approximates the derivative without needing to know the symbolic formula. Instead of performing algebraic differentiation, it evaluates the function at two nearby points (x₀ + h and x₀ − h) and computes the average rate of change between them. As h shrinks toward zero, this average converges to the true derivative. With h = 10⁻⁵, the central difference formula achieves about 10 significant digits of accuracy for smooth, well-behaved functions.

Higher-order derivatives (2nd, 3rd, 4th) use wider stencils, evaluating the function at more points to estimate how the derivative itself is changing. The 2nd derivative indicates concavity: whether the curve is bending upward (bowl shape) or downward (dome shape). Combined with a zero 1st derivative, the 2nd derivative test identifies whether a critical point is a local minimum or maximum.

Formula

Numerical Differentiation, Central Difference Formulas

1st Derivative (central difference)

f′(x) ≈ [f(x+h) − f(x−h)] / 2h

Error order: O(h²), using h = 0.00001 gives ~10 correct digits for smooth functions.

2nd Derivative

f″(x) ≈ [f(x+h) − 2f(x) + f(x−h)] / h²

Used to determine concavity: f″ > 0 → concave up (local min); f″ < 0 → concave down (local max).

3rd and 4th Derivatives

f‴(x) ≈ [f(x+2h) − 2f(x+h) + 2f(x−h) − f(x−2h)] / 2h³

f⁽⁴⁾(x) ≈ [f(x+2h) − 4f(x+h) + 6f(x) − 4f(x−h) + f(x−2h)] / h⁴

Higher-order derivatives use 5-point stencils for better accuracy.

Tangent Line at (x₀, f(x₀))

y = f′(x₀) · (x − x₀) + f(x₀)

The tangent line is the best linear approximation to f(x) near x₀. Its slope equals f′(x₀).

SymbolMeaningNotes
f(x)The input functionAny expression using x, constants, and supported functions
x₀Evaluation pointThe x-value where the derivative is computed
hStep size0.00001 (10⁻⁵), small enough for accuracy, large enough to avoid floating-point cancellation
f′(x₀)1st derivative at x₀Instantaneous rate of change; slope of the tangent line
f″(x₀)2nd derivative at x₀Rate of change of f′; indicates concavity
f‴(x₀)3rd derivative at x₀Rate of change of f″; related to jerk in physics
f⁽⁴⁾(x₀)4th derivative at x₀Used in error analysis and Taylor series remainder terms
O(h²)Accuracy orderError shrinks as h², halving h reduces error by factor 4

How to Use

  1. 1Enter or pick a function: Type f(x) in the function field or choose from the preset dropdown. Use x as the variable. Supported: ^, *, /, sin, cos, exp, ln, sqrt, abs, pi, e.
  2. 2Set the evaluation point: Enter the x₀ value where you want the derivative computed. This can be any real number where f(x₀) is defined.
  3. 3Choose derivative order: Select 1st (f′), 2nd (f″), 3rd (f‴), or 4th (f⁽⁴⁾). All four are computed simultaneously, you can switch orders without recalculating.
  4. 4Calculate: Click Calculate or press Enter. Results show f(x₀), all four derivative values, the tangent line equation, and a derivative table.
  5. 5Read the chart: The SVG chart plots f(x) (solid line) and the tangent line (dashed) over a range around x₀. The highlighted dot marks (x₀, f(x₀)).
  6. 6Check the derivative table: The table shows f(x) and f′(x) at 11 evenly spaced points around x₀, with increasing/decreasing behaviour noted.
  7. 7Reset: Click Reset or press Esc to clear all inputs and start fresh.

Example Calculation

Example 1, Polynomial: f(x) = x² + 3x − 4

  • Enter: x^2 + 3*x - 4, at x₀ = 2.
  • f(2) = 4 + 6 − 4 = 6.
  • f′(x) = 2x + 3, so f′(2) = 4 + 3 = 7. The calculator returns ≈ 7.000000.
  • f″(x) = 2 (constant). The calculator returns ≈ 2.000000.
  • Tangent line: y = 7(x − 2) + 6 = 7x − 8.
  • Since f″ > 0 everywhere, the parabola is concave up, the vertex is a global minimum.
  • Vertex x = −b/(2a) = −3/2 = −1.5. Enter x₀ = −1.5 to confirm f′(−1.5) ≈ 0.

Example 2, Trigonometric: f(x) = sin(x)

  • Enter: sin(x), at x₀ = π/4 ≈ 0.7854.
  • f(π/4) = sin(π/4) = √2/2 ≈ 0.70711.
  • f′(x) = cos(x), so f′(π/4) = cos(π/4) = √2/2 ≈ 0.70711. Confirmed.
  • f″(x) = −sin(x), so f″(π/4) ≈ −0.70711 (concave down, approaching the maximum at π/2).
  • Try x₀ = π/2 ≈ 1.5708: f′ ≈ 0 (critical point), f″ < 0 → local maximum.
  • Try x₀ = 0: f′ = cos(0) = 1, maximum slope; f(0) = 0, inflection point.

Example 3, Exponential: f(x) = exp(−x²)

  • This is the Gaussian bell curve shape. Enter: exp(-x^2), at x₀ = 1.
  • f(1) = e⁻¹ ≈ 0.36788.
  • f′(x) = −2x · exp(−x²), so f′(1) = −2 · e⁻¹ ≈ −0.73576. Function is decreasing.
  • f″(x) = (4x² − 2) · exp(−x²). At x=1: f″(1) = (4−2) · e⁻¹ ≈ 0.73576 (concave up).
  • Inflection points are where f″ = 0: 4x² − 2 = 0 → x = ±1/√2 ≈ ±0.7071.
  • Enter x₀ = 0 to find the maximum: f′(0) = 0, f″(0) = −2 (concave down → global maximum).
  • The calculator instantly confirms all these analytical results numerically.

Understanding Derivative | Find f′(x) Instantly

Common Derivative Rules (Reference)

Function f(x)Derivative f′(x)Notes
xⁿn · xⁿ⁻¹Power rule, works for any real n
sin(x)cos(x)x in radians
cos(x)−sin(x)x in radians
tan(x)sec²(x) = 1/cos²(x)Undefined at x = π/2 + nπ
eˣ (exp(x))The only function that equals its own derivative
ln(x)1/xDomain: x > 0
log₁₀(x)1 / (x · ln 10)≈ 0.4343/x
asin(x)1 / √(1 − x²)Domain: |x| < 1
acos(x)−1 / √(1 − x²)Domain: |x| < 1
atan(x)1 / (1 + x²)Domain: all reals
√x (sqrt(x))1 / (2√x)Domain: x > 0
|x| (abs(x))x / |x| = sign(x)Not differentiable at x = 0
sinh(x)cosh(x)Hyperbolic sine
cosh(x)sinh(x)Hyperbolic cosine

Differentiation Rules

  • Sum rule: (f + g)′ = f′ + g′. Derivative distributes over addition.
  • Product rule: (f · g)′ = f′g + fg′. Used for expressions like x·sin(x).
  • Quotient rule: (f/g)′ = (f′g − fg′) / g². Applied to 1/x, sin(x)/x, etc.
  • Chain rule: (f(g(x)))′ = f′(g(x)) · g′(x). Used for sin(x²), exp(−x²), etc.
  • Constant multiple: (cf)′ = c · f′. Constants factor out of derivatives.

Applications of Derivatives

  • Optimization: Find where f′(x) = 0 to locate maxima and minima. Used in engineering design, economics (cost minimisation, profit maximisation), and machine learning (loss minimisation).
  • Physics, kinematics: Position → velocity (1st derivative) → acceleration (2nd derivative) → jerk (3rd derivative). Every motion equation in classical mechanics involves derivatives.
  • Newton's method: Uses f(xₙ)/f′(xₙ) to iteratively approach a root of f. Converges quadratically, see the Newton's Method Calculator.
  • Taylor series: Any smooth function can be approximated as a polynomial using its derivatives at a point: f(x) ≈ f(x₀) + f′(x₀)(x−x₀) + f″(x₀)/2! · (x−x₀)² + …
  • Related rates: Differentiate both sides of an equation with respect to time to find how one rate relates to another (e.g., how fast a shadow grows as someone walks).
  • Signal processing: Derivatives detect edges in images (change in pixel intensity), identify peaks in spectra, and measure the rate of change in time-series data.

Frequently Asked Questions

What is a derivative and what does it tell you?

  • The derivative f′(x₀) is the instantaneous rate of change of f at the point x₀.
  • Geometrically: it is the slope of the tangent line to the curve y = f(x) at (x₀, f(x₀)).
  • If f measures position vs time, f′ measures velocity. If f measures velocity, f′ measures acceleration.
  • A positive f′(x₀) means f is increasing at x₀. Negative means decreasing. Zero means a flat tangent (possible extremum).
  • The derivative is the core concept of differential calculus and underpins optimization, physics, economics, and engineering.

Why use numerical differentiation instead of symbolic differentiation?

  • Symbolic differentiation applies algebraic rules (power rule, chain rule, product rule) to produce an exact formula.
  • Numerical differentiation evaluates the function at nearby points and estimates the derivative, no algebra required.
  • Numerical methods work on any computable function, including those too complex for closed-form differentiation.
  • For data-driven functions (tabulated data, black-box simulations) there is no formula to differentiate symbolically.
  • The trade-off: numerical results are approximate, while symbolic results are exact. For most practical purposes the approximation is more than adequate.

How accurate is the central difference formula?

  • Central difference has O(h²) accuracy, the error is proportional to h². Using h = 10⁻⁵ gives error ≈ 10⁻¹⁰.
  • In practice you get ~10 correct decimal digits for smooth functions, more than enough for engineering and science.
  • Accuracy degrades near discontinuities, cusps, or where the function changes very rapidly.
  • Very small h (like 10⁻¹⁵) causes floating-point cancellation errors, subtraction of nearly equal numbers loses precision.
  • h = 10⁻⁵ is a well-tested balance between truncation error (wants small h) and rounding error (wants large h).

What is the second derivative used for?

  • Concavity: f″(x) > 0 means the curve is concave up (bowl), f″(x) < 0 means concave down (dome).
  • Second derivative test: if f′(x₀) = 0 and f″(x₀) > 0, then x₀ is a local minimum; if f″(x₀) < 0, it's a local maximum.
  • Inflection points occur where f″ changes sign (not just where f″ = 0).
  • In physics: if f is position, f′ is velocity, f″ is acceleration. Newton's second law relates f″ to force.
  • In economics: the second derivative of a cost or utility function determines diminishing returns.

What is the tangent line and why is it useful?

  • The tangent line touches the curve at exactly one point and has the same slope as the curve at that point.
  • Equation: y = f′(x₀) · (x − x₀) + f(x₀). It is the best linear approximation to f near x₀.
  • Linear approximation (linearisation): for x close to x₀, f(x) ≈ f(x₀) + f′(x₀)(x − x₀). Used in Newton's method and differential approximation.
  • In optics: Snell's law of refraction follows the tangent to a wavefront.
  • In machine learning: gradient descent moves along the (negative) tangent direction of the loss function.

How do I identify critical points and classify them?

  • Critical points are where f′(x₀) = 0 or f′(x₀) is undefined.
  • Step 1: Use the calculator to find x₀ where f′ ≈ 0. Try the derivative table to scan across a range.
  • Step 2: Check f″(x₀). If f″ > 0 → local minimum. If f″ < 0 → local maximum. If f″ ≈ 0 → inconclusive, check f‴.
  • If f′ changes sign from + to − across x₀: local maximum. From − to +: local minimum. No change: inflection point.
  • Global extrema must also check function values at domain boundaries (if the domain is bounded).

What functions and syntax are supported?

  • Variable: x (lowercase). Use any real number as the evaluation point.
  • Arithmetic: + − * / ^ (power). Implicit multiplication: 2x, 3sin(x), (x+1)(x+2) all work.
  • Trig: sin, cos, tan, asin, acos, atan (arguments in radians).
  • Exponential / log: exp (eˣ), ln (natural log), log or log10 (base-10 log).
  • Other: sqrt, abs, ceil, floor, round, sinh, cosh, tanh.
  • Constants: pi (≈ 3.14159), e (≈ 2.71828).
  • Example expressions: x^3 - 2*x, sin(x^2), exp(-x^2), ln(x+1), sqrt(4*x+1).

Why does the derivative fail near some points?

  • Non-differentiable points: abs(x) at x = 0 has a corner, the left and right derivatives differ (−1 vs +1).
  • Vertical tangents: sqrt(x) at x = 0 has f′ = ∞, the tangent line is vertical.
  • Discontinuities: 1/x at x = 0 is undefined; tan(x) at x = π/2 has a vertical asymptote.
  • Domain restrictions: ln(x) requires x > 0; sqrt(x) requires x ≥ 0. Evaluating outside the domain returns NaN.
  • If you see "undefined" or "∞" in the results, the function is likely not differentiable at that point, try a nearby value.

Related Calculators