Derivative Calculator

This calculator finds the numerical derivative of any mathematical function at a point you choose, using the central difference method. The derivative of a function at a point tells you the instantaneous rate of change at that exact location on the curve: how steeply the function is rising or falling, and in which direction. In formal terms it is the slope of the tangent line to the graph of f(x) at x equals your chosen value. Rather than finding a symbolic formula for the derivative (which requires algebraic manipulation), numerical differentiation evaluates the function at two nearby points and divides the change in output by the change in input. The central difference method is the most accurate simple approach: it evaluates f at x plus a tiny step h and at x minus the same step, then computes (f(x+h) minus f(x-h)) divided by 2h. This calculator uses h equal to 0.0000001, giving results accurate to roughly six decimal places for most smooth functions. You type the function using standard maths notation (for example x*x+3*x, sin(x)*cos(x) or exp(-x*x)), enter the point x where you want the derivative, and the result appears instantly. Supported functions include sin, cos, tan, log (natural logarithm), exp, sqrt, abs and pow. The tool is aimed at calculus students, engineers checking gradient values, and data analysts looking at the rate of change of a modelled curve. Results are numerical approximations only; they may be less accurate near sharp discontinuities or where the function is undefined at or near the chosen point.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page
7.000000
f ′(x) at the given point
f(x) at this point10.000000
Step size h0.0000001

Type expressions using * for multiply, pow(x,n) or x*x for powers, and standard Math functions: sin, cos, tan, log, exp, sqrt.

How it works

The central difference formula is f′(x) = (f(x + h) − f(x − h)) / (2h). With a step size h of 0.0000001, the truncation error is proportional to h squared, making this method far more accurate than the simple forward difference formula for the same step size. The function you enter is evaluated using JavaScript's Function constructor with the Math library in scope, so you can use any expression that a JS Math object supports. If your expression contains a syntax error or evaluates to a non-finite number, the calculator shows an error message rather than an incorrect result.

Worked example

Set f(x) to x*x+3*x and x to 2. The true derivative of x squared plus 3x is 2x plus 3, so at x equals 2 the exact answer is 7. The calculator evaluates f(2.0000001) and f(1.9999999), divides their difference by 2 times 0.0000001, and returns 7.000000, matching the exact result. f(2) itself equals 4 + 6 = 10.000000. These match the default values pre-filled in the calculator above.

Related calculators