Introduction
This gradient calculator finds the gradient of a function with two or more variables. Type a function like x^3 + y^5, and the tool takes the partial derivative with respect to each variable, then collects those parts into one vector, written as ∇f.
You can also enter a point, such as (1, 7). The calculator plugs those numbers in and returns the gradient at that spot, along with the length (magnitude) of the vector and the unit vector, which points the way the function grows the fastest.
Open the Steps tab to see the work one line at a time, with the rules used along the way, like the power rule, product rule, quotient rule, and chain rule. The Graph tab draws a gradient vector field, so you can see the arrows and how strong they are in each area.
The tool handles powers, roots, fractions, trig functions, logs, and exponentials. Use the math keyboard if you do not want to type symbols, or click any example to load it right away. Use it to check homework, study for a calculus test, or see how partial derivatives work.
How to use our Gradient Calculator
Type a function of two or more variables, and this gradient calculator finds each partial derivative, the full gradient vector, its magnitude, the direction of steepest ascent, step-by-step work, and a vector field graph.
Function f(x, y, z, …): Enter your function in the first box. Use ^ for powers, * for times, and / for divide. You can also use sin, cos, tan, ln, log, exp, sqrt, and abs. Example: x^3 + y^5.
Variable Order (optional): List your variables with commas, like x, y, z. This sets the order of the gradient parts. Leave it blank and the calculator finds the variables for you and puts them in alphabetical order.
Evaluate at Point (optional): Type one number for each variable, in the same order, like 1, 7. The calculator then gives the gradient value at that point. Leave it blank to get only the symbolic answer.
Math Keyboard: Click "Open Math Keyboard" to add roots, powers, trig functions, logs, and Greek letters without typing them.
Calculate Gradient: Click this button to see your answer. Use the Solution, Steps, and Graph tabs to view the result, the full work, and the gradient vector field. Click Reset to start over, or click any example to try a ready-made problem.
What Is a Gradient?
The gradient of a function is a vector that holds all of its partial derivatives. It is written with the symbol ∇ (called "nabla" or "del"), so the gradient of a function f is written ∇f. It only works for functions with two or more variables, like f(x, y) or f(x, y, z).
What Is a Partial Derivative?
A partial derivative is the derivative with respect to just one variable. You treat every other variable as a plain number. For example, with f(x, y) = x³ + y⁵:
- ∂f/∂x = 3x² (here y⁵ acts like a constant, so it goes to 0)
- ∂f/∂y = 5y⁴ (here x³ acts like a constant, so it goes to 0)
Put them in a list and you get the gradient: ∇f = (3x², 5y⁴).
How to Find a Gradient
- List your variables in order, such as x, y, z.
- Take the partial derivative for each one, holding the others still.
- Write the answers as a vector: ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z).
- If you have a point, plug the numbers into each part.
What the Gradient Tells You
The gradient points in the direction where the function grows the fastest. This is called the direction of steepest ascent. Think of standing on a hill: the gradient points straight uphill. The opposite direction points straight downhill.
The magnitude (length) of the gradient tells you how steep that climb is. You find it with the square root of the sum of the squares:
‖∇f‖ = √((∂f/∂x)² + (∂f/∂y)² + …)
Divide the gradient by its magnitude and you get the unit gradient vector, which shows only the direction, with length 1.
Rules You Will Use
- Power rule: the derivative of xⁿ is n·xn−1
- Constant rule: terms with no chosen variable become 0
- Product rule: for two parts multiplied together
- Quotient rule: for a fraction of two parts
- Chain rule: for a function inside another function, like sin(x²)
Zero Gradient and Critical Points
If every partial derivative is 0 at a point, the gradient is the zero vector. That spot is a critical point. It may be a peak, a valley, or a saddle. At a critical point the surface is flat, so there is no steepest direction.
Where Gradients Are Used
- Machine learning: gradient descent moves down the gradient to lower error.
- Physics: heat, electric, and gravity fields flow along gradients.
- Maps and terrain: the gradient shows the slope of the land.
- Optimization: finding the biggest or smallest value of a function.
Gradient vs. Directional Derivative
A directional derivative gives the rate of change in one chosen direction. The gradient does more: it gives the best direction and the fastest rate at once. In fact, the largest possible directional derivative at a point equals the magnitude of the gradient there.