Gradient, Divergence, and Curl Calculator
Enter a scalar or vector field in 2D or 3D and instantly compute its gradient, divergence, and curl with symbolic formulas and numeric evaluation at a point.
Interactive Vector Calculus Tool
Use ^ for powers, sin(),
cos(), exp(), ln(),
etc. Variables: x, y, z.
For 2D fields, leave the third component blank or 0.
Leave blank to skip numeric evaluation.
Results
Enter a field and click “Compute” to see gradient, divergence, and curl. Results will appear here with both symbolic expressions and numeric values at the chosen point.
Gradient, divergence, and curl: definitions
Gradient, divergence, and curl are the three core differential operators in vector calculus. They describe how scalar and vector fields change in space.
Gradient of a scalar field
For a scalar field \( f(x,y,z) \), the gradient is a vector field defined by
- \(\nabla f\) points in the direction of steepest increase of \(f\).
- \(\|\nabla f\|\) is the maximum rate of change of \(f\) at that point.
- Level surfaces \(f(x,y,z)=\text{const}\) are always orthogonal to \(\nabla f\).
Divergence of a vector field
For a vector field \( \mathbf{F}(x,y,z) = (F_1, F_2, F_3) \), the divergence is a scalar field
- Physically, divergence measures net outflow per unit volume at a point.
- \(\nabla \cdot \mathbf{F} > 0\): the point behaves like a source.
- \(\nabla \cdot \mathbf{F} < 0\): the point behaves like a sink.
- \(\nabla \cdot \mathbf{F} = 0\): the field is divergence-free (locally volume-preserving), e.g. incompressible fluid flow or magnetic fields.
Curl of a vector field
For a vector field \( \mathbf{F}(x,y,z) = (F_1, F_2, F_3) \), the curl is another vector field
- Curl measures the local rotation or “swirl” of the vector field.
- The direction of \(\nabla \times \mathbf{F}\) is the axis of rotation (right-hand rule).
- The magnitude \(\|\nabla \times \mathbf{F}\|\) is proportional to the angular speed of that rotation.
- If \(\nabla \times \mathbf{F} = \mathbf{0}\), the field is called irrotational.
2D vs 3D formulas
In 2D, we usually work with variables \(x, y\) and treat the field as living in the plane.
2D gradient
2D divergence
2D curl (scalar “out of plane”)
In 2D, the curl of a planar vector field is a scalar representing the component of the 3D curl in the \(z\)-direction:
This scalar is often interpreted as the vorticity perpendicular to the plane.
Worked examples
Example 1: Gradient of a quadratic potential
Let \( f(x,y,z) = x^2 + y^2 + z^2 \). Then
At the point \((1,2,3)\),
The gradient points radially outward and grows linearly with distance from the origin.
Example 2: Divergence and curl of a radial field
Consider the vector field \( \mathbf{F}(x,y,z) = (x, y, z) \).
Divergence:
The divergence is constant and positive: the field behaves like a uniform source everywhere.
Curl:
The field has zero curl: it has no local rotation, only radial expansion.
Example 3: Pure rotation field
Take the 2D vector field \( \mathbf{F}(x,y) = (-y, x) \), which represents rotation around the origin.
Divergence:
There are no sources or sinks: the flow is incompressible.
2D curl (out-of-plane component):
The curl is a positive constant, indicating uniform counterclockwise rotation.
Key vector calculus identities
Some important identities involving gradient, divergence, and curl:
- Gradient of a scalar multiple: \(\nabla (af) = a \nabla f\) for constant \(a\).
- Divergence of a gradient (Laplacian): \(\nabla \cdot (\nabla f) = \nabla^2 f\).
- Curl of a gradient: \(\nabla \times (\nabla f) = \mathbf{0}\) (gradients are irrotational).
- Divergence of a curl: \(\nabla \cdot (\nabla \times \mathbf{F}) = 0\) (curls are divergence-free).
These identities underpin many results in physics, such as Maxwell’s equations in electromagnetism and the Navier–Stokes equations in fluid dynamics.
FAQ
How do I enter functions in this calculator?
Use standard programming-style syntax:
-
Powers:
x^2,y^3,(x^2 + y^2)^(1/2) -
Functions:
sin(x),cos(y),tan(z),exp(x*y),ln(x),sqrt(x^2 + y^2) - Constants:
pi,e
When should I use gradient vs divergence vs curl?
- Use the gradient when you have a scalar field (e.g. temperature, potential) and want the direction and rate of steepest change.
- Use divergence when you have a vector field (e.g. fluid velocity, electric field) and want to detect sources and sinks.
- Use curl when you have a vector field and want to measure local rotation or vorticity.
What is the Laplacian and how is it related?
The Laplacian of a scalar field is defined as
It measures how \(f\) compares to its average value in a small neighborhood and appears in diffusion, heat conduction, and wave equations.