Complex numbers in LaTeX
A complex number z = a + bi needs no special command; the commands come in for its conjugate, \bar{z} or z^{*}, its parts, \operatorname{Re}(z) and \operatorname{Im}(z), and the set of all of them, \mathbb{C}.
LaTeX command
z = a + biNot the symbol you meant? Draw it to find the command →
Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →
Type the number as it reads: or . Some fields set the imaginary unit upright, \mathrm{i}, to keep it apart from an index i; electrical engineering writes j. Whichever you choose, use it throughout.
The conjugate is written with a bar, \bar{z}, in most of mathematics, or with a star, z^{*}, in physics. For a conjugate over more than one letter, \overline{z + w} draws a bar across the whole expression, where \bar would stay short.
LaTeX's own \Re and \Im print the Fraktur letters ℜ and ℑ. Many writers prefer upright Re and Im, written \operatorname{Re}(z) and \operatorname{Im}(z). The modulus is \lvert z \rvert, the argument \arg z, and polar form uses the exponential, as in the examples below.
Other forms
\bar{z}complex conjugate, barz^{*}complex conjugate, star\operatorname{Re}(z)real part, upright Re\operatorname{Im}(z)imaginary part\lvert z \rvertmodulus\mathbb{C}the complex numbers, amssymbExamples
$z = a + bi$a complex number
$\bar{z} = a - bi$its conjugate
$\lvert z \rvert = \sqrt{a^2 + b^2}$the modulus
$z = r e^{i\theta} = r(\cos\theta + i\sin\theta)$polar form
$\operatorname{Re}(z) = \frac{z + \bar{z}}{2}$the real part from the conjugate
$\overline{z + w} = \bar{z} + \bar{w}$a long bar over a sum
Tips and common mistakes
- Use
\overlinefor a conjugate over more than one letter;\baris sized for one. - Write
\operatorname{Re}and\operatorname{Im}for upright parts;\Reand\Imprint Fraktur ℜ and ℑ. \mathbb{C}needs amssymb, like the other number sets.- Choose i or an upright
\mathrm{i}for the imaginary unit and keep it the same throughout. - Write the modulus with
\lvertand\rvertso the bars are spaced as a pair.
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 the complex conjugate in LaTeX?
Use \bar{z} for a bar, or z^{*} for a star. Over a longer expression use \overline{z + w}.
How do I write the real and imaginary parts?
Write \operatorname{Re}(z) and \operatorname{Im}(z). The built-in \Re and \Im give Fraktur letters instead.
How do I write the set of complex numbers?
Use \mathbb{C} with the amssymb package.
How do I write a complex number in polar form?
Write z = r e^{i\theta}, or r(\cos\theta + i\sin\theta).