Partial Derivative Calculator

A partial derivative tells you how a function of two variables changes when you move along just one of those variables while holding the other fixed. If you have a surface defined by z = f(x, y), the partial derivative with respect to x gives you the slope of that surface in the x direction at a specific point, and the partial derivative with respect to y gives the slope in the y direction. Together they form the gradient vector, which points in the direction of steepest ascent on the surface. Partial derivatives appear throughout multivariable calculus, mathematical physics, engineering optimisation, and machine learning, where gradients are used to train models by descending a loss surface. This calculator takes a function of x and y written in standard notation, for example x^2 + 3*x*y, and a point (x, y) at which to evaluate it. It returns df/dx, df/dy, the gradient vector as an ordered pair, and the mixed second partial d2f/dxdy. Calculations use central difference numerical differentiation, which is accurate to around twelve significant figures for smooth functions. You can use standard operators: +, -, *, /, and ^ for powers, along with Math functions such as sin, cos, exp, log, sqrt, and abs. Enter the function and the point below to see all four results instantly.

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.00
df/dx at (x, y)
df/dy6.00
Gradient vector(7.00, 6.00)
d2f/dxdy2.98
f(x, y)10.00

Numerical results use central difference with h = 1e-7. Use * for multiplication and ^ for powers.

How it works

The calculator evaluates your function using JavaScript's Function constructor, which allows standard Math operations without any external library. The partial derivative with respect to x uses central difference: df/dx is approximately (f(x+h, y) minus f(x-h, y)) divided by 2h, with h = 1e-7. The same method applies in the y direction to find df/dy. The mixed partial d2f/dxdy is found by applying the central difference formula in x to the df/dy values evaluated at x+h and x-h. The gradient vector collects (df/dx, df/dy) into an ordered pair, and f(x, y) is the function value at the given point.

Worked example

For f(x, y) = x^2 + 3*x*y at the point x = 2, y = 1: differentiating with respect to x gives df/dx = 2x + 3y, which at (2, 1) equals 2(2) + 3(1) = 7.00. Differentiating with respect to y gives df/dy = 3x, which at (2, 1) equals 3(2) = 6.00. The gradient vector is (7.00, 6.00), the mixed partial d2f/dxdy = 3.00, and f(2, 1) = 4 + 6 = 10.00. These match the defaults pre-filled above.

Related calculators