Number Systems

Last modified: 2026-11-03 15:17:03 (PST)

Remark. Probability and statistics count with the integers and natural numbers and measure with the real numbers. This page defines those number systems. It also defines the words that sort their members: even and odd integers, and rational and irrational real numbers. Finally, it defines divisibility, primes and congruence, and the factorial of a non-negative integer.

1 Natural numbers

Exercise 1 (Which numbers are natural?) List the elements of the set \(\mathopen{}\left\{n \in \mathbb{N}: n < 3\right\}\mathclose{}\). Is your answer the same in every textbook?

Solution 1. The answer depends on whether the source counts \(0\) as a natural number:

  • if \(\mathbb{N}\) starts at \(0\), the set is \(\mathopen{}\left\{0, 1, 2\right\}\mathclose{}\);
  • if \(\mathbb{N}\) starts at \(1\), the set is \(\mathopen{}\left\{1, 2\right\}\mathclose{}\).

Both conventions are in common use, so the answer is not the same in every textbook.

Definition 1 (Integers) The integers [1] are the whole numbers, together with their negatives and \(0\):

\[\mathbb{Z} \stackrel{\text{def}}{=}\mathopen{}\left\{\ldots, -3, -2, -1, 0, 1, 2, 3, \ldots\right\}\mathclose{}\]

An integer is an element of \(\mathbb{Z}\).

Definition 2 (Positive integers) The integers (Definition 1) greater than \(0\) are the positive integers.

Definition 3 (Negative integers) The integers (Definition 1) less than \(0\) are the negative integers.

Example 1 (Integers and non-integers)  

  • \(-7\), \(0\), and \(12\) are integers.
  • \(\frac{1}{2}\) and \(-2.5\) are not integers.
  • \(\frac{6}{3}\) is an integer, because \(\frac{6}{3} = 2\).

Definition 4 (Even integer) An integer (Definition 1) \(n\) is even [2] if \(n = 2k\) for some integer \(k\).

Definition 5 (Odd integer) An integer (Definition 1) \(n\) is odd [2] if \(n = 2k + 1\) for some integer \(k\).

Example 2 (Even and odd integers)  

  • \(6\) is even, because \(6 = 2 \cdot 3\).
  • \(0\) is even, because \(0 = 2 \cdot 0\).
  • \(-3\) is odd, because \(-3 = 2 \cdot(-2) + 1\).
  • \(7\) is odd, because \(7 = 2 \cdot 3 + 1\).
  • \(2.5\) is neither even nor odd, because it is not an integer.

Definition 6 (Natural numbers (our convention)) In these notes, the natural numbers [3] are the positive integers (Definition 2):

\[\mathbb{N}\stackrel{\text{def}}{=}\mathopen{}\left\{1, 2, 3, \ldots\right\}\mathclose{}\]

Definition 7 (Non-negative integers) The non-negative integers are the natural numbers (Definition 6) together with \(0\):

\[\mathbb{N}_0 \stackrel{\text{def}}{=}\mathopen{}\left\{0, 1, 2, 3, \ldots\right\}\mathclose{} = \mathbb{N}\cup \mathopen{}\left\{0\right\}\mathclose{}\]

Example 3 (Natural numbers in a data analysis)  

  • Observation indices start at \(1\), so we write \(i \in \mathopen{}\left\{1, \ldots, n\right\}\mathclose{}\) with \(n \in \mathbb{N}\).
  • A count outcome, such as the number of hospital visits in a year, can be \(0\), so the set of values it can take is \(\mathbb{N}_0\), not \(\mathbb{N}\).

Other conventions for the natural numbers

Other sources may define \(\mathbb{N}\) differently, so check each source’s definition before reading its formulas:

  • Many sources include \(0\) in \(\mathbb{N}\). The international standard ISO 80000-2 defines \(\mathbb{N}\) to include \(0\), continuing the earlier standard ISO 31-11 (1978).
  • Other sources start \(\mathbb{N}\) at \(1\), as these notes do.
  • To remove the ambiguity, some sources write \(\mathbb{N}_1\) or \(\mathbb{Z}^+\) for \(\mathopen{}\left\{1, 2, 3, \ldots\right\}\mathclose{}\), and \(\mathbb{N}_0\) or \(\mathbb{Z}^{0+}\) for \(\mathopen{}\left\{0, 1, 2, \ldots\right\}\mathclose{}\).
  • The words vary too. “Positive integers” (\(\mathopen{}\left\{1, 2, 3, \ldots\right\}\mathclose{}\)) and “non-negative integers” (\(\mathopen{}\left\{0, 1, 2, \ldots\right\}\mathclose{}\)) are unambiguous. “Whole numbers” usually includes \(0\), but can also mean all of the integers, negative ones included. “Counting numbers” usually starts at \(1\), but some sources include \(0\).
  • Some older texts write \(J\) for the natural numbers.

When a formula’s meaning depends on whether \(0\) is included, we write the set out explicitly, for example \(\mathopen{}\left\{0, 1, 2, \ldots\right\}\mathclose{}\) or \(\mathopen{}\left\{1, \ldots, n\right\}\mathclose{}\).

Source: Wikipedia, “Natural number”, “Terminology and notation” and “Zero as natural number”, which cites ISO 80000-2:2019 and the textbooks using each notation.

Definition 8 (Factorial) For a non-negative integer \(n\), the factorial of \(n\) [4], written \({{n}!}\), is \(1 \cdot 2 \cdots n\), the natural numbers from 1 to \(n\) multiplied together. For \(n = 0\) there is nothing to multiply, and \({{0}!} = 1\).

Example 4 (Factorials)  

2 Divisibility, primes and congruence

Definition 9 (Divides) Let \(a\) and \(b\) each be an integer. We say that \(a\) divides \(b\), written \(a \mid b\), if \(b = a c\) for some integer \(c\). When \(a\) does not divide \(b\), we write \(a \nmid b\).

Example 5 (Divisors and non-divisors)  

  • \(3\) divides \(12\), \(3 \mid 12\), because \(12 = 3 \cdot 4\) and \(4\) is an integer.
  • \(5 \nmid 12\), because \(5 \cdot 2 = 10 < 12 < 15 = 5 \cdot 3\), so no integer \(c\) has \(5 c = 12\).
  • Every integer \(a\) divides \(0\), because \(0 = a \cdot 0\).

Definition 10 (Prime number) An integer \(n \ge 2\) is prime if no positive integer other than \(1\) and \(n\) divides it [5].

Example 6 (Primes and non-primes)  

  • \(7\) is prime: none of \(2\), \(3\), \(4\), \(5\) and \(6\) divides \(7\), and no integer above \(7\) does, so its only positive divisors are \(1\) and \(7\).
  • \(9\) is not prime, because \(3\) divides \(9\).
  • \(1\) is not prime, because the definition requires \(n \ge 2\).

Definition 11 (Congruence modulo \(n\)) Let \(a\) and \(b\) be integers, and let \(n\) be a positive integer. We say that \(a\) is congruent to \(b\) modulo \(n\), written \(a \equiv b \pmod{n}\), if \(n\) divides \(a - b\), written \(n \mid (a - b)\), [6]. When \(a\) is not congruent to \(b\) modulo \(n\), we write \(a \not\equiv b \pmod{n}\).

Example 7 (Clock arithmetic)  

  • \(17\) is congruent to \(5\) modulo \(12\), \(17 \equiv 5 \pmod{12}\), because \(17 - 5 = 12\) and \(12 \mid 12\). On a 12-hour clock, hour 17 is 5 o’clock.
  • \(17 \not\equiv 4 \pmod{12}\), because \(17 - 4 = 13\) and \(12 \nmid 13\).

3 Rational, real, and irrational numbers

Definition 12 (Rational numbers) A rational number [7] is a number that can be written as a fraction \(\frac{a}{b}\), where \(a\) and \(b\) are integers (Definition 1) and \(b \ne 0\). The set of rational numbers is written \(\mathbb{Q}\):

\[\mathbb{Q} \stackrel{\text{def}}{=}\mathopen{}\left\{\frac{a}{b} : a \in \mathbb{Z},\ b \in \mathbb{Z},\ b \ne 0\right\}\mathclose{}\]

Example 8 (Rational numbers)  

  • \(\frac{3}{4}\) is rational, with \(a = 3\) and \(b = 4\).
  • \(0.75\) is rational, because \(0.75 = \frac{3}{4}\).
  • Every integer is rational: for example, \(-5 = \frac{-5}{1}\).
  • \(0.333\ldots\), with the \(3\)s repeating forever, is rational, because \(0.333\ldots = \frac{1}{3}\).

Definition 13 (Real numbers) A real number [8] is a number that can be written as a decimal expansion: an integer part, followed by a decimal point and a finite or infinite list of decimal places after it. Equivalently, the real numbers are the points on the number line. The set of real numbers is written \(\mathbb{R}\).

Remark 1 (A working definition). Definition 13 is a working definition, not a construction: it does not say what an infinite decimal expansion is, or how to add or multiply two of them. Rudin [9], Appendix to Chapter 1 constructs the real numbers rigorously. Some real numbers have two decimal expansions: for example, \(0.999\ldots\) and \(1.000\ldots\) are the same real number, \(1\).

Example 9 (Real numbers)  

  • \(3\), \(-0.5\), and \(\frac{1}{3} = 0.333\ldots\) are real numbers.
  • \(\pi = 3.14159\ldots\) is a real number.
  • Every rational number (Definition 12) is a real number, so \(\mathbb{N}\subseteq \mathbb{Z} \subseteq \mathbb{Q} \subseteq \mathbb{R}\).

Definition 14 (Floor) The floor \(\mathopen{}\left\lfloor x\right\rfloor\mathclose{}\) of a real number \(x\) [10] is the largest integer that is at most \(x\).

Example 10 (Floors)  

  • \(\mathopen{}\left\lfloor 2.7\right\rfloor\mathclose{} = 2\), by the definition of the floor.
  • \(\mathopen{}\left\lfloor 3\right\rfloor\mathclose{} = 3\), because \(3\) is already an integer.
  • \(\mathopen{}\left\lfloor-1.5\right\rfloor\mathclose{} = -2\), because \(-2 \le -1.5 < -1\).

The graph of \(\mathopen{}\left\lfloor x\right\rfloor\mathclose{}\) is a staircase: each step starts at an integer, with a filled dot, and stops before the next integer, at an open dot.

[Code]
# one step per integer k, from x = k to x = k + 1 at height k
k <- -3:2
steps <- tibble::tibble(x = k, xend = k + 1, y = k)

floor_plot <- ggplot2::ggplot(steps) +
  ggplot2::geom_segment(ggplot2::aes(x = x, xend = xend, y = y, yend = y)) +
  ggplot2::geom_point(ggplot2::aes(x = x, y = y), size = 2) +
  ggplot2::geom_point(
    ggplot2::aes(x = xend, y = y),
    size = 2, shape = 21, fill = "white"
  ) +
  ggplot2::labs(x = "x", y = "floor of x")

floor_plot

The graph of the floor function from -3 to 3. It is a staircase of horizontal steps one unit long. Each step starts with a filled dot at an integer k at height k and ends with an open dot at k + 1.

Definition 15 (Irrational numbers) An irrational number [11] is a real number (Definition 13) that is not rational (Definition 12).

Example 11 (Irrational numbers)  

  • \(\sqrt{2} = 1.41421\ldots\), the square root of \(2\), is irrational: no fraction of integers \(\frac{a}{b}\) squares to \(2\) [12].
  • \(\pi = 3.14159\ldots\) is irrational [13].
  • \(1.5\) is not irrational, because \(1.5 = \frac{3}{2}\) is rational.
[1]
Wikipedia contributors, “Integer — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Integer
[2]
Wikipedia contributors, “Parity (mathematics) — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Parity_(mathematics)
[3]
Wikipedia contributors, “Natural number — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Natural_number
[4]
Wikipedia contributors, “Factorial — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Factorial
[5]
Wikipedia contributors, “Prime number — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Prime_number
[6]
Wikipedia contributors, “Modular arithmetic — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Modular_arithmetic
[7]
Wikipedia contributors, “Rational number — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Rational_number
[8]
Wikipedia contributors, “Real number — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Real_number
[9]
W. Rudin, Principles of mathematical analysis, 3rd ed. in International series in pure and applied mathematics. New York: McGraw-Hill, 1976.
[10]
Wikipedia contributors, “Floor and ceiling functions — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Floor_and_ceiling_functions
[11]
Wikipedia contributors, “Irrational number — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Irrational_number
[12]
Wikipedia contributors, “Square root of 2 — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Square_root_of_2
[13]
Wikipedia contributors, “Proof that pi is irrational — Wikipedia, the free encyclopedia.” 2026. Available: https://en.wikipedia.org/wiki/Proof_that_%CF%80_is_irrational