Modulus in LaTeX (|z|)

∣z∣|z|
LaTeX command
|z|
Package
No package needed: built into LaTeX
Mode
Text and math mode

Where it is used

Modulus (absolute value) of z, its distance from the origin: √(a² + b²) for z = a + bi.

Bare vertical bars work for simple cases but are ambiguous to TeX, which cannot tell opening from closing; that causes bad spacing in expressions like |-z|. Use \lvert z \rvert, or define a macro, to get correct spacing, and \left| \frac{z}{w} \right| when the content is tall. Never use \mid here: it is a relation with wide spacing. Key properties are |zw| = |z||w| and the triangle inequality |z + w| \leq |z| + |w|. In vector contexts the double bars \| \| denote a norm instead.

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

∣zw∣=∣z∣∣w∣\lvert z w \rvert = \lvert z \rvert \lvert w \rvert
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Modulus: $|z|$

\[ \lvert z w \rvert = \lvert z \rvert \lvert w \rvert \]
\end{document}

Related symbols

All Complexe Getallen →

Frequently asked questions

How do I write Modulus in LaTeX?
Type |z| in math mode, for example $\lvert z w \rvert = \lvert z \rvert \lvert w \rvert$. It works in plain LaTeX without loading any package.
Which package do I need for |z|?
None. |z| is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use |z| in text mode, or only in math mode?
Both. |z| compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredSchrijf LaTeX met AI

Beste AI LaTeX Editor, Overleaf Alternatief

Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI

  • Genereer mooie TikZ-diagrammen met AI
  • Upload afbeelding en converteer naadloos naar LaTeX
  • Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen