Ceiling in LaTeX (\lceil x \rceil)
- LaTeX command
\lceil x \rceil- Package
- No package needed: built into LaTeX
- Mode
- Math mode only
Where it is used
Rounds x up to the smallest integer greater than or equal to it: the ceiling function.
Ceilings show up in algorithm analysis (\lceil \log_2 n \rceil comparisons, \lceil n/2 \rceil in merge sort), in number theory, and in counting problems like the pigeonhole principle, where some box holds at least \lceil n/k \rceil items. For negative inputs remember that \lceil -2.5 \rceil = -2. When the argument is a fraction or a tall expression, use \left\lceil ... \right\rceil so the brackets grow. Do not substitute square brackets [x]: older texts used [x] for the floor, which makes it ambiguous.
Also listed under: Number Theory, Computer Science
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Ceiling: $\lceil x \rceil$
\[ \left\lceil \frac{n}{k} \right\rceil \ge \frac{n}{k} \]
\end{document}Related symbols
- Floor Left
\lfloor - Ceiling Right
\rceil - Floor Right
\rfloor - Ceiling Left
\lceil - Floor
\lfloor x \rfloor - Angle Brackets
\langle x \rangle
Frequently asked questions
- How do I write Ceiling in LaTeX?
- Type \lceil x \rceil in math mode, for example $\left\lceil \frac{n}{k} \right\rceil \ge \frac{n}{k}$. It works in plain LaTeX without loading any package.
- Which package do I need for \lceil x \rceil?
- None. \lceil x \rceil is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use \lceil x \rceil in text mode, or only in math mode?
- Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\lceil x \rceil$ in running text.
Best AI LaTeX Editor, Overleaf Alternative
Octree helps researchers from 15+ universities write research papers faster using AI
- Generate beautiful TikZ diagrams using AI
- Upload image and convert it to LaTeX seamlessly
- Get instant assistance with writing and formatting research papers