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 →
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 primex^{\prime}explicit primeExamples
$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
- Just type an apostrophe in math mode: is enough, and you do not need ^{
\prime} for the common case. - For four or more derivatives switch to f^{(n)}; long strings of primes become unreadable.
- To combine a prime with a power, brace it as {}^{2} rather than ^2.
- Use
\primeonly inside a superscript, for example a^{\prime}; on its own\primegives an oversized floating symbol. - Do not paste the Unicode prime character; the apostrophe in math mode is the portable, KaTeX-safe way.
Working from handwritten notes?
LatexNotes turns a photo or PDF of handwritten mathematics into clean, compilable LaTeX - graphs and all. Free to try, no sign-up.
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.