Gradient Calculator

Calculate the gradient vector of a multivariable function, evaluate it at a point, find its magnitude, and determine the direction of steepest ascent.

Examples: x^2+y^2, x*y+sin(y), x^2+y^2+z^2
For two variables use 2,3. For three variables use 1,2,3.

What Is the Gradient?

The gradient is a vector containing all first partial derivatives of a scalar-valued multivariable function. It describes how the function changes with respect to each independent variable.

For a function of two variables, \(f(x,y)\), the gradient is

\[ \nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right) \]

For a function of three variables, \(f(x,y,z)\), the gradient is

\[ \nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right) \]

Gradient Calculator Example

Consider

\[ f(x,y)=x^2+xy+y^2 \]

Its partial derivatives are

\[ \frac{\partial f}{\partial x}=2x+y \] \[ \frac{\partial f}{\partial y}=x+2y \]

Therefore,

\[ \nabla f=(2x+y,\ x+2y) \]

At \(P=(1,2)\),

\[ \nabla f(1,2)=(4,5) \]

and \[ \|\nabla f(1,2)\|=\sqrt{41}. \]

Geometric Meaning of the Gradient

Greatest Increase

The gradient points in the direction in which the function increases most rapidly.

Maximum Rate

The magnitude of the gradient gives the maximum rate of increase per unit distance.

Level Curves

At a regular point, the gradient is perpendicular to the level curve of the scalar function.

Gradient and Directional Derivatives

If \(\mathbf u\) is a unit vector, then the directional derivative is

\[ D_{\mathbf u}f = \nabla f\cdot\mathbf u \]

The maximum directional derivative occurs when \(\mathbf u\) points in the same direction as the gradient.

\[ \max_{\|\mathbf u\|=1} D_{\mathbf u}f = \|\nabla f\| \]

See the Directional Derivative Calculator for directional-change calculations.

Gradient of a Function of Three Variables

For a scalar field \(f(x,y,z)\), the gradient is a three-dimensional vector.

\[ \nabla f = (f_x,f_y,f_z) \]

For example,

\[ f(x,y,z)=x^2+y^2+z^2 \]

has gradient

\[ \nabla f=(2x,2y,2z) \]

and therefore

\[ \nabla f(1,2,3)=(2,4,6). \]

Supported Mathematical Input

Variables

x, y, z

Operators

+, -, *, /, ^

Implicit multiplication is supported: 2x, 3sin(x), x(y+1).

Trigonometric Functions

sin, cos, tan, sec, csc, cot

Other Functions

ln, log, log10, exp, sqrt, asin, acos, atan

Try These Gradient Examples

Click an example to fill the calculator. You still need to press Calculate Gradient.

Quadratic Function

\(f=x^2+y^2\)

Point: (2,3)

Mixed Quadratic

\(f=x^2+xy+y^2\)

Point: (1,2)

Product and Sine

\(f=xy+\sin(y)\)

Point: (1,2)

Three-Variable Function

\(f=x^2+y^2+z^2\)

Point: (1,2,3)

Related Multivariable Calculus Calculators

Directional Derivative Calculator

Calculate the rate of change of a function in a specified direction.

Divergence Calculator

Calculate the divergence of a vector field.

Curl Calculator

Calculate the curl of a three-dimensional vector field.

Jacobian Calculator

Calculate the Jacobian matrix of vector-valued functions.

Hessian Calculator

Calculate the matrix of second-order partial derivatives.

Critical Point Calculator

Find and analyze critical points of multivariable functions.

Frequently Asked Questions

The gradient is a vector containing the first partial derivatives of a scalar function. For \(f(x,y)\): \[ \nabla f=(f_x,f_y) \]

At a point where the gradient is nonzero, it points in the direction of greatest increase of the scalar function.

The gradient magnitude is \(\|\nabla f\|\). It represents the maximum directional derivative at that point.

Yes. At a regular point, the gradient is perpendicular to the level curve of the scalar function passing through that point.

Yes. If the function contains x, y, and z, the calculator returns \[ (f_x,f_y,f_z). \]