Vertical bar sign in Discrete mathematics

The sign $|$ has a few uses in mathematics

$$\text{Sets }\{x\in\mathbb N\mid\exists y\in\mathbb N:2y=x\}$$

Here it the sign means "such that", the colon also means "such that" in this context

Note that in this case it is written \mid in LaTeX, and not with the symbol |.


$$a\mid b$$

In this case the $\mid$ sign means that $a$ divides $b$, or that $\frac ba$ is an integer

Note that in this case it is written \mid in LaTeX, and not with the symbol |.


$$|x|$$

Here it means the absolute value of $x$, ie. $|x|=\left\{\begin{array}{ll}x\quad&\text{if }x\ge0\\-x&\text{if }x<0\end{array}\right.$

In this case it is written with just the | symbol. Note that sometimes you need to put {} around the contents to get the correct spacing, ie.

  • |-2| gives $|-2|$
  • |{-2}| gives $|{-2}|$

$ ls -l | grep "Aug"

This use is from the unix terminal where it means that the output of the ls -l command is redirected to the command grep "Aug", which shows all files last edited in august.

Note that this last one isn't really mathematics but I included it as you mentioned it.


In number theory the sign $\mid$ denotes divisibility. But you need to carefully note that this is definitely not the same as division.

  • "$2$ divided by $6$" can be written $2/6$ or $2\div6$. Its value is one third, or $0.333\ldots\,$.
  • "$2$ divides $6$" can be written $2\mid6$. This is a statement and does not have any numerical value. It says that $2$ goes into $6$ exactly with no remainder, or that $6$ is an integer times $2$. This statement is true.
  • Likewise, $3\mid7$ is the statement that $3$ goes into $7$ exactly with no remainder. This statement is false.

It is very important to note (especially if English is not your first language) that "$a$ divides $b$" is very different from "$a$ divided by $b$". Other ways of saying "$a$ divides $b$" are "$a$ is a factor of $b$" and "$b$ is a multiple of $a$".

Hope this helps!