How to write the floor symbol in LaTeX?

# How to write the floor symbol in LaTeX?

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

This article aims to show you the simplest and easiest way to write the floor symbol in LaTeX.

This symbol is typically used in mathematics and computer science, usually when you are studying functions or creating code regarding functions. Today you will learn how to write this symbol in LaTeX.

## Floor function

In math and computer science, whenever the floor function is applied to a number, it returns the greatest integer less than or equal to the given real number value x. You can define it using “floor(x)” or with two “half” square brackets with the value x between them.

## Floor symbol in LaTeX

To write it we do not need extra packages, it is already by default in its built-in LaTeX symbols, that’s great news. First of all the math mode is mandatory for this expression, second we need two commands one for each side of the values used as arguments of the function, the first command is \lfloor (left side) and the second one is \rfloor (right side); therefore the argument will be between these two commands, for example

\documentclass{article}
\begin{document}
\begin{center}
\verb|lfloor| \verb|[argument]| \verb|rfloor|\\
$\lfloor 2, -3, 5 \rfloor$\\
$\lfloor x \rfloor$\\
\end{center}
\end{document}


Gives the output

We can notice what was mentioned before, the argument or value evaluated in the function is between both commands in the code.

In case we have a fraction or maybe the floor symbols do not fit, we can use two already known commands, \left and \right. Let’s look at an example

\begin{document}
\begin{center}
1) $\lfloor \dfrac{1}{x} \rfloor$ \\
\vspace{0.2cm}
2) $\left \lfloor \dfrac{1}{x} \right \rfloor$
\end{center}
\end{document}


Note: \vspace{} creates a vertical space between two lines, the height of the space is defined by the value inside the brackets.

## Ceiling Function and Ceiling Symbol in LaTeX

Just as we have the floor functions there is also the opposite of it. The ceiling function, also denoted ceil(x), returns the last integer greater than or equal to a given real number x. The symbols are the same as the floor function, except they are inverted,

In LaTeX we use \lceil and \rceil commands for each side of the ceiling function, the same principle from the floor function symbols apply for the ceil symbols. For example

\begin{center}
1) $\left \lceil \dfrac{x^2}{3} \right \rceil$\\
\vspace{0.2cm}
2) $\lceil 5.4 \rceil$
\end{center}
\end{document}


Here we have the basics  for writing these two symbols and respective functions in LaTeX. There could be packages to help you write these symbols in different ways but most of the time, simpler is better or at least that is what we want to transmit whenever we can.

I hope this post was helpful, and as always keep writing in LaTeX.

All the images were created with LaTeX by the author.