LatexNotes

QED / end of proof (∎ □) in LaTeX

The QED symbol, a small box at the end of a proof, comes free with the amsthm proof environment; by hand, \blacksquare gives a filled box ∎ and \square a hollow one □.

LaTeX command

\blacksquare

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

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

Mathematicians end a proof with a small box, called the tombstone or Halmos symbol, or with the letters QED. In LaTeX the box is almost never typed by hand: the amsthm package adds it for you, and the sections below show how, how to keep it on a final equation, and how to change its look.

Outside a proof, in a worked solution or on a slide, \blacksquare and \square from amssymb print the box anywhere in maths mode, and \hfill before it pushes it to the right margin of a line of text.

The proof environment (amsthm)

Load amsthm and write the proof inside the proof environment. LaTeX starts it with an italic 'Proof.' and sets a hollow box at the right margin of the last line. An optional argument changes the opening words, as in \begin{proof}[Proof of Lemma 2].

\usepackage{amsthm}
\begin{proof} ... \end{proof}

The box on the last line of an equation: \qedhere

When a proof ends with a displayed equation, the box drops to an empty line under it. Put \qedhere at the end of the equation, inside the display, and the box moves up onto the equation's line.

\[ a^2 + b^2 = c^2. \qedhere \]

A filled box instead of a hollow one

Redefine \qedsymbol once in the preamble and every proof follows. \blacksquare comes from amssymb, so load it as well. The same line can print words instead, such as Q.E.D.

\usepackage{amssymb}
\renewcommand{\qedsymbol}{$\blacksquare$}

Other forms

\squarea hollow box (□), amssymb
\qedherethe box on a final equation's line, amsthm
\qedthe box by hand, amsthm

Examples

$\blacksquare$

a filled box, the tombstone

$\square$

a hollow box, amsthm's default look

$\therefore\ x = 2 \quad \blacksquare$

a box after the final line of a worked solution

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 add a QED symbol in LaTeX?

Load amsthm and put the proof in \begin{proof} ... \end{proof}; the box is added at the end automatically.

How do I make the QED box filled?

Redefine \qedsymbol in the preamble to print \blacksquare, with amssymb loaded; the exact line is in the section above.

Why is my QED box on its own line?

The proof ends with a displayed equation. Put \qedhere at the end of that equation to move the box onto its line.

What is the end of proof symbol called?

It is often called the tombstone or Halmos symbol, after Paul Halmos, who brought it into mathematical writing.

See also