Partial Derivative Calculator (Numerical)

A partial derivative measures how a function of two variables changes when one variable is varied while the other is held fixed. This calculator numerically estimates df/dx and df/dy for any function f(x,y) using the central difference formula: df/dx is approximately (f(x+h,y) minus f(x-h,y)) divided by (2h), where h is a small step size defaulting to 0.0001. Enter your function using standard mathematical notation, the point (x,y) to evaluate at, and optionally a custom step size. The calculator also shows the gradient vector (df/dx, df/dy). Supported operations include +, -, *, /, power (use ** or ^), sqrt(), sin(), cos(), tan(), exp(), log() (natural logarithm), and abs(). Use x and y as the variable names. For example, to compute the partial derivatives of x squared plus 3xy at the point (2, 1), enter x**2 + 3*x*y for the function. The result df/dx = 7 and df/dy = 6. Partial derivatives are fundamental in multivariate calculus, gradient descent optimisation, thermodynamics, and differential geometry.

Use x and y as variables. Example: x**2 + 3*x*y or Math.sin(x)*Math.cos(y)
7.00
7.00
6.00
(7.00, 6.00)
9.22

Numerical partial derivative formula

Central difference approximation:
df/dx ≈ (f(x+h, y) - f(x-h, y)) / (2*h)
df/dy ≈ (f(x, y+h) - f(x, y-h)) / (2*h)
Error is O(h^2); default h = 0.0001 gives ~8 sig. figs.
Gradient: grad(f) = (df/dx, df/dy)

Partial derivatives: frequently asked questions

What is a partial derivative?

A partial derivative of a function f(x,y) with respect to x (written df/dx or partial-f/partial-x) is the rate of change of f as x changes while y is held constant. It treats y as a constant and differentiates only with respect to x. For example, if f(x,y) = x^2 + 3xy, then df/dx = 2x + 3y.

What is the central difference method?

The central difference approximation computes df/dx as (f(x+h,y) - f(x-h,y)) / (2*h) for a small h. This is more accurate than the forward difference (f(x+h,y) - f(x,y))/h because the error is proportional to h^2 instead of h. A typical h of 0.0001 gives about 8 significant figures of accuracy.

What is the gradient vector?

The gradient of f(x,y), written grad(f) or nabla(f), is the vector (df/dx, df/dy). It points in the direction of steepest ascent of f at a given point. The magnitude of the gradient equals the maximum rate of change. The gradient is used in optimization, machine learning (gradient descent), and physics (fields and potentials).

When does a partial derivative not exist?

A partial derivative may not exist when the function has a sharp corner, discontinuity, or vertical tangent along the direction of differentiation at that point. Numerically, this shows up as a very large or inconsistent value when h is made smaller. Symbolic differentiation tools can detect non-existence analytically.

What functions can I use in the formula?

This calculator accepts JavaScript mathematical expressions. You can use: +, -, *, / for arithmetic; ** or ^ for powers; Math.sqrt(), Math.sin(), Math.cos(), Math.tan(), Math.exp(), Math.log() (natural log), Math.abs(). Use x and y as variable names. Example: x**2 + 3*x*y + Math.sin(y).

Sources

Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.