Gradient Vector Calculator
Calculate the gradient vector of f(x,y) = ax² + by² + cxy at any point. Shows magnitude and direction of steepest ascent.
About this calculator
This calculator finds the gradient vector ∇f = (∂f/∂x, ∂f/∂y) of the quadratic surface f(x,y) = ax² + by² + cxy at a single (x, y) point you choose, then reports its magnitude and direction. The two partial derivatives are computed directly — ∂f/∂x = 2ax + cy and ∂f/∂y = 2by + cx (lines 14-15) — so each is driven by exactly two of the five inputs. With the cross-term coefficient c left at its default of 0, cy drops out of ∂f/∂x and cx drops out of ∂f/∂y entirely, decoupling the two partial derivatives: a (Coefficient of x²) and the x Point move only ∂f/∂x, while b (Coefficient of y²) and the y Point move only ∂f/∂y.
Because each partial derivative is a plain product of two inputs (2·a·x, for instance), a proportional nudge to either factor moves it by the same proportional amount — a and x pull exactly evenly on ∂f/∂x, with neither one driving it more than the other. Magnitude and Direction combine both partials, so both x-side and y-side inputs affect them. The calculator does compute f(x,y) itself internally (fValue, line 24), but it never displays that value or the level curve through the point as an output, even though it derives the level-curve slope too (levelSlope, line 27) — and it is restricted to the quadratic form ax²+by²+cxy — a cubic or higher-order surface is outside its model.
Inputs
Results
∂f/∂x
4
∂f/∂y
6
How to Use This Calculator
- Enter the coefficients a, b, and c that define f(x,y) = ax² + by² + cxy.
- Enter the x and y coordinates of the point where you want to evaluate the gradient.
- The calculator computes the partial derivatives ∂f/∂x = 2ax + cy and ∂f/∂y = 2by + cx at that point.
- Gradient magnitude |∇f| = √((∂f/∂x)² + (∂f/∂y)²) tells you how steep the function is at that point.
- Direction gives the angle (in degrees) of the gradient vector, pointing toward the steepest ascent of f.
- The bar chart displays ∂f/∂x, ∂f/∂y, and |∇f| side by side to compare their magnitudes.
How the result changes with Coefficient of x² (a)
| Coefficient of x² (a) | ∂f/∂x | ∂f/∂y |
|---|---|---|
| 0.5 | 2 | 6 |
| 0.75 | 3 | 6 |
| 1.5 | 6 | 6 |
| 2.5 | 10 | 6 |
What each input means
- Coefficient of x² (a)
- Coefficient of x²
- Coefficient of y² (b)
- Coefficient of y²
- Coefficient of xy (c)
- Coefficient of the cross term xy
- x Point
- x coordinate of the evaluation point
- y Point
- y coordinate of the evaluation point
How this is calculated
Worked example, using the default values
- Identify Input Parameters4 parametersCoefficient of x² (a) = 1, Coefficient of y² (b) = 1, Coefficient of xy (c) = 0, x Point = 2 = 5 input(s) provided
- Calculate ∂f/∂x∂f/∂x4 = 4
- Calculate ∂f/∂y∂f/∂y6 = 6
- Calculate Magnitude |∇f|Magnitude |∇f|7.2111 = 7.2111
- Calculate DirectionDirection = directionDeg56.31 = 56.31
Engine last updated . Checked against 2 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Does the Coefficient of y² (b) affect ∂f/∂x?
No. With the cross-term coefficient c at its default of 0, ∂f/∂x = 2ax + cy (line 14) reduces to 2ax, which never references b or the y Point at all. b and the y Point only move ∂f/∂y in that case, and only reappear in ∂f/∂x once you set the cross-term coefficient c to a nonzero value.
Which matters more for ∂f/∂x — the coefficient a or the x Point?
Neither dominates. ∂f/∂x = 2ax + cy is a plain product of a and x when c is 0 (line 14), so a proportional change to either one moves ∂f/∂x by the identical proportional amount. There's no asymmetry to exploit here, unlike calculators where one input is scaled much larger than another by default.
What does the Direction output actually measure?
It's the angle, in degrees, of the gradient vector itself, computed via Math.atan2(∂f/∂y, ∂f/∂x) (line 20) measured from the positive x-axis. It points toward the direction of steepest ascent of f(x,y) at your chosen point, not toward any particular axis or coefficient by itself.
Does the calculator show the function's value at the point, or its level-curve slope?
No. fValue and levelSlope are both computed internally (lines 24 and 27) but never exposed as outputs — only ∂f/∂x, ∂f/∂y, Magnitude, and Direction are shown. The level-curve slope -(∂f/∂x)/(∂f/∂y) stays invisible on the page even though the engine derives it every time you change an input.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Partial Derivative Calculator
Calculate partial derivatives of f(x,y) = axy + bx² + cy² + d. Find df/dx, df/dy, and the gradient magnitude.
Calculus ToolsDerivative Calculator
Calculate the derivative of polynomial, trigonometric, exponential, and logarithmic functions at any point.
Machine Learning & AISupport Vector Machine Calculator
Calculate SVM parameters, support vectors, margin width, and complexity for support vector machines.
Calculus ToolsArc Length Calculator
Calculate the arc length of linear, quadratic, and circular curves between two points using numerical integration.
More in Math & Statistics.