Partial Derivative in LaTeX

The ∂ symbol is \partial. Put it in a fraction for the derivative: \frac{\partial f}{\partial x}. Second derivatives take a power on the top and on the variable: \frac{\partial^2 f}{\partial x^2}; mixed ones list both variables: \frac{\partial^2 f}{\partial x \, \partial y}.

Partial derivative notation

  • \partial
    ∂

    The ∂ symbol on its own.

  • \frac{\partial f}{\partial x}
    ∂ f ∂ x

    First partial derivative.

  • \frac{\partial^2 f}{\partial x^2}
    ∂ 2 f ∂ x 2

    Second partial derivative.

  • \frac{\partial^2 f}{\partial x \, \partial y}
    ∂ 2 f ∂ x ∂ y

    Mixed partial derivative.

  • \frac{\partial}{\partial x} \left( x^2 y \right)
    ∂ ∂ x ( x 2 y )

    Operator form, applied to an expression.

  • f_x, \; f_{xy}
    f x , f x y

    Subscript notation.

  • \partial_x f
    ∂ x f

    Short operator notation, common in physics.

  • \pdv{f}{x}
    Text mode, no math preview

    Shortcut from the physics package (the derivative package also defines \pdv); not available in MathJax or KaTeX.

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

Partial derivative 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.

  • First partial

    ∂ f ∂ x = 2 x y
    LaTeX
    \frac{\partial f}{\partial x} = 2xy
  • Mixed partial

    ∂ 2 f ∂ x ∂ y = ∂ 2 f ∂ y ∂ x
    LaTeX
    \frac{\partial^2 f}{\partial x \, \partial y} = \frac{\partial^2 f}{\partial y \, \partial x}
  • Heat equation

    ∂ u ∂ t = α ∂ 2 u ∂ x 2
    LaTeX
    \frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2}
  • Wave equation

    ∂ 2 u ∂ t 2 = c 2 ∂ 2 u ∂ x 2
    LaTeX
    \frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}
  • Evaluated at a point

    ∂ f ∂ x | ( x 0 , y 0 )
    LaTeX
    \left. \frac{\partial f}{\partial x} \right|_{(x_0, y_0)}

    \left. opens an invisible delimiter so \right| can draw a bar of the right height.

  • Held variable (thermodynamics)

    ( ∂ U ∂ S ) V = T
    LaTeX
    \left( \frac{\partial U}{\partial S} \right)_{V} = T
  • Inline-friendly slash form

    ∂ f / ∂ x
    LaTeX
    \partial f / \partial x

Writing higher and mixed partials

The order goes on the ∂ in the numerator and on the variable in the denominator: \frac{\partial^3 f}{\partial x^2 \, \partial y}. A thin space \, between the factors in the denominator keeps them from running together.

In running text a full fraction is tall; \partial f / \partial x or the subscript forms f_x and \partial_x f keep the line height normal.

Shortcut macros

If you write many partials, define a macro in the preamble: \newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}, then type \pd{f}{x}. This works in LaTeX and in MathJax, where macros can be defined in the page configuration.

The physics package provides \pdv{f}{x} and \pdv[2]{f}{x}, and the newer derivative package provides \pdv as well. They are convenient in Overleaf, but web renderers do not support them, so copy-paste into Markdown or a website fails.

LaTeX
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
% ...
\[ \pd{f}{x} + \pd{f}{y} = 0 \]

Common mistakes

  • A straight d means an ordinary derivative. Use ∂ when f depends on more than one variable.

    Instead of
    \frac{df}{dx}  (for a function of several variables)
    Write
    \frac{\partial f}{\partial x}
  • In the denominator the power belongs to the variable, because it stands for ∂x·∂x.

    Instead of
    \frac{\partial^2 f}{\partial^2 x}
    Write
    \frac{\partial^2 f}{\partial x^2}
  • \delta is the Greek letter δ, which means something else (a variation or a small change).

    Instead of
    \delta f / \delta x
    Write
    \partial f / \partial x

In Overleaf, MathJax and Word

  • Overleaf and pdfLaTeX

    \partial and \frac need no package. \pdv needs \usepackage{physics} or \usepackage{derivative}; pick one, since both define the same name.

  • MathJax and KaTeX

    MathJax and KaTeX render \partial and \frac fine. \pdv and \dv are not supported by default, so expand them to fractions for web pages, Jupyter and Obsidian.

  • Microsoft Word

    Pasted LaTeX is not converted reliably in Word. Write the derivative here and use Copy for Word to paste it as an editable Word equation with a real fraction.

Partial derivative in LaTeX: questions

What is the LaTeX command for the partial derivative symbol?
\partial, which draws ∂. It is used in math mode, for example $\partial f$.
How do I write a second partial derivative?
\frac{\partial^2 f}{\partial x^2} for the same variable twice, \frac{\partial^2 f}{\partial x \, \partial y} for a mixed partial.
How do I show where a partial derivative is evaluated?
Use an evaluation bar: \left. \frac{\partial f}{\partial x} \right|_{x = 0}.
Why does \pdv not work in my Markdown notes?
\pdv comes from the physics or derivative LaTeX packages. MathJax and KaTeX do not include them by default, so write the fraction out with \partial instead.

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