LatexNotes

Prime / derivative (′) in LaTeX

A prime is typed with a straight apostrophe in math mode, so is f-prime, the usual notation for a derivative. Repeat it for higher derivatives: and .

LaTeX command

f'

Not the symbol you meant? Draw it to find the command →

Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →

In math mode you type a prime simply as an apostrophe: gives f with a prime mark, most often the first derivative . LaTeX automatically raises the apostrophe to the superscript position and uses the proper prime glyph rather than a quote character. Repeat the apostrophe for (second derivative) and (third).

If you need a prime together with an explicit superscript, use \prime inside a superscript group: x^{\prime} gives the same mark. Writing ^2 can be ambiguous, so when both a prime and a power appear, brace the primed symbol first, as in {}^{2}.

Beyond three primes the notation is hard to read, so most authors switch to a parenthesised order such as f^{(4)} for the fourth derivative. The apostrophe approach is preferred over a literal Unicode prime because it is portable and KaTeX-safe.

Other forms

f''double prime
x^{\prime}explicit prime

Examples

$f'(x)$

the first derivative

$f''(x)$

the second derivative

$y' = 2x$

a derivative in y notation

$f^{(4)}(x)$

the fourth derivative, avoiding four primes

$x^{\prime}$

an explicit prime via \prime

Tips and common mistakes

Working from handwritten notes?

LatexNotes turns a photo or PDF of handwritten mathematics into LaTeX, graphs and all. It is built with real pdflatex before you see it, and the .tex file is yours to edit or take to Overleaf. Free to try, no sign-up.

See how handwriting to LaTeX works, step by step, or go from GoodNotes to LaTeX if you write on an iPad (Notability works the same way).

Convert your maths to LaTeX →

FAQ

How do I write f prime in LaTeX?

Type an apostrophe in math mode: . LaTeX raises it to a proper prime mark denoting the derivative.

How do I write the second and third derivatives?

Repeat the apostrophe: and . For the fourth and beyond, prefer .

How do I combine a prime with an exponent?

Group the primed symbol before adding the power, for example , to avoid an ambiguous ordering.

See also