Gradient in LaTeX

The gradient symbol ∇ is \nabla: write \nabla f for the gradient of f. Divergence and curl use a dot and a cross, \nabla \cdot \mathbf{F} and \nabla \times \mathbf{F}, and the Laplacian is \nabla^2 f or \Delta f.

Vector calculus operators

  • \nabla
    ∇

    Nabla (del), the ∇ symbol.

  • \nabla f
    ∇ f

    Gradient of a scalar field.

  • \nabla \cdot \mathbf{F}
    ∇ ⋅ F

    Divergence of a vector field.

  • \nabla \times \mathbf{F}
    ∇ × F

    Curl of a vector field.

  • \nabla^2 f
    ∇ 2 f

    Laplacian.

  • \Delta f
    Δ f

    Laplacian written with a capital delta.

  • \operatorname{grad} f
    grad f

    Gradient written as an operator name (amsmath).

  • \nabla_{\mathbf{x}} L
    ∇ x L

    Gradient with respect to one variable, common in optimization.

Try it live

Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.

Templates

Gradient (nabla) examples

Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.

  • Gradient as a vector

    ∇ f = ( ∂ f ∂ x , ∂ f ∂ y , ∂ f ∂ z )
    LaTeX
    \nabla f = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}, \frac{\partial f}{\partial z} \right)
  • Gradient as a column

    ∇ f ( x ) = [ ∂ f ∂ x 1 ⋮ ∂ f ∂ x n ]
    LaTeX
    \nabla f(\mathbf{x}) = \begin{bmatrix} \dfrac{\partial f}{\partial x_1} \\ \vdots \\ \dfrac{\partial f}{\partial x_n} \end{bmatrix}

    \dfrac keeps the fractions full size inside the matrix.

  • Divergence

    ∇ ⋅ F = ∂ F x ∂ x + ∂ F y ∂ y + ∂ F z ∂ z
    LaTeX
    \nabla \cdot \mathbf{F} = \frac{\partial F_x}{\partial x} + \frac{\partial F_y}{\partial y} + \frac{\partial F_z}{\partial z}
  • Curl

    ∇ × E = − ∂ B ∂ t
    LaTeX
    \nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}
  • Laplacian

    ∇ 2 u = ∂ 2 u ∂ x 2 + ∂ 2 u ∂ y 2
    LaTeX
    \nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}
  • Gradient descent step

    w t + 1 = w t − η ∇ w L ( w t )
    LaTeX
    \mathbf{w}_{t+1} = \mathbf{w}_t - \eta \, \nabla_{\mathbf{w}} L(\mathbf{w}_t)
  • Directional derivative

    D u f = ∇ f ⋅ u ^
    LaTeX
    D_{\mathbf{u}} f = \nabla f \cdot \hat{\mathbf{u}}

Gradient, divergence and curl

\nabla is a normal math symbol, so it combines with the operators you already know: nothing for the gradient (\nabla f), \cdot for divergence and \times for curl. Write vector fields in bold (\mathbf{F}) or with an arrow to tell them apart from scalars.

Some texts, especially in physics, write the gradient as a bold nabla. \boldsymbol{\nabla} works in LaTeX (amsmath) and in MathJax.

grad, div and curl as words

European textbooks often use the names instead of the symbol. Write them with \operatorname so they come out upright and spaced like \sin, or declare them once in the preamble.

LaTeX
\usepackage{amsmath}
\DeclareMathOperator{\grad}{grad}
\DeclareMathOperator{\divg}{div}
\DeclareMathOperator{\curl}{curl}
% ...
\[ \grad f, \quad \divg \mathbf{F}, \quad \curl \mathbf{F} \]

Common mistakes

  • Δ is the Laplacian or a difference; the gradient uses the upside-down triangle ∇.

    Instead of
    \Delta f  (meaning the gradient)
    Write
    \nabla f
  • Typed letters are set as italic variables g·r·a·d.

    Instead of
    grad f
    Write
    \operatorname{grad} f
  • \div already exists (the ÷ sign), so \newcommand stops with an error; pick another name.

    Instead of
    \newcommand{\div}{…}
    Write
    \DeclareMathOperator{\divg}{div}

In Overleaf, MathJax and Word

  • Overleaf and pdfLaTeX

    \nabla, \cdot, \times and \Delta need no packages. \operatorname, \DeclareMathOperator, \boldsymbol and \dfrac need amsmath.

  • MathJax and KaTeX

    MathJax and KaTeX render \nabla, \operatorname{grad} and \boldsymbol{\nabla} directly. \DeclareMathOperator belongs in a LaTeX preamble; on the web define macros in the renderer configuration or use \operatorname.

  • Microsoft Word

    Word’s equation editor has a nabla symbol, but pasted LaTeX is not converted reliably. Write the expression here and use Copy for Word to paste an editable equation.

Gradient (nabla) in LaTeX: questions

What is the LaTeX command for the gradient symbol?
\nabla, which draws ∇. The gradient of f is \nabla f.
How do I write the upside-down triangle in LaTeX?
That symbol is nabla: \nabla. The upright triangle Δ is \Delta.
How do I write divergence and curl?
Divergence is \nabla \cdot \mathbf{F} and curl is \nabla \times \mathbf{F}.
How do I write the Laplacian?
Either \nabla^2 f or \Delta f; both are in common use.

Have the formula as a picture?

Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.

Convert an image to LaTeX