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 Complex Numbers →

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 poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers