Almost every claim in this course names which numbers it's talking about before it says anything else — "for every natural number n," "there is an integer k." Getting sloppy about which set a variable lives in is one of the fastest ways to write a false statement by accident, so this section is a fast, precise refresher on the four sets you'll name constantly: \mathbb{N}, \mathbb{Z}, \mathbb{Q}, and \mathbb{R}.
Picture four nested boxes. The innermost box holds the counting numbers, what you'd use to count apples. The next box opens the door to negative numbers, useful once debt or a temperature below zero shows up. The third box opens the door to fractions, useful once a whole number can't answer "how much." The outermost box holds everything on the number line, fractions and the gaps between them alike. You never leave a box once you're in it. You only ever open the next one out.
\mathbb{N} = \{0, 1, 2, 3, \ldots\}, the natural numbers (this course includes 0; some texts don't — check the convention before assuming). \mathbb{Z} = \{\ldots, -2, -1, 0, 1, 2, \ldots\}, the integers, extend \mathbb{N} with negatives. \mathbb{Q}, the rationals, are every ratio \frac{a}{b} with a, b \in \mathbb{Z} and b \neq 0. \mathbb{R}, the reals, are every point on the number line, rational or not. Each set sits entirely inside the next: \mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R} — every natural number is an integer, every integer is rational (as \frac{n}{1}), and every rational is real. Which set a claim quantifies over changes what it means: "every n \in \mathbb{N} satisfies n \geq 0" is true, while the same inequality over \mathbb{Z} is false the moment n is negative — the symbol under the quantifier is doing real work, not decoration. Read each symbol as naming a whole set, never a single number: \mathbb{N} isn't "a natural number," it's the entire collection of them.
Which is the smallest set containing this number?
Sort each number into the SMALLEST of N, Z, Q, R that actually contains it -- e.g. -3 is an integer, not merely rational or real, even though it also belongs to those larger sets.
Loading interactive…
Where each set actually sits
Drag the probe across the line -- notice N and Z land only on marked whole-number points, while Q and R fill in between them.
Loading interactive…
Worked example
Name the smallest set containing a number
-
1
Which of \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R} is the smallest set containing -\frac{6}{2}?
-
2
Simplify first — -\frac{6}{2} = -3, so this is really asking about -3, not a genuine fraction.
-
3
-3 is a whole number but negative, so it's not in \mathbb{N} (no negatives there). It is an integer, so \boxed{-3 \in \mathbb{Z}} \text{ (the smallest of the four containing it)} Writing a number as a fraction doesn't automatically make \mathbb{Q} the right answer — simplify first and check whether it's secretly a whole number.
Worked example
A number that skips two sets entirely
-
1
Which of \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R} is the smallest set containing \pi?
-
2
\pi is not an integer (it's not a whole number at all), so \mathbb{N} and \mathbb{Z} are both out immediately.
-
3
Is \pi a ratio of two integers? No — this is a famous, non-obvious fact (proved formally in advanced courses, not here) that \pi cannot be written as any fraction \frac{a}{b}. So \mathbb{Q} is out too.
-
4
\pi is still a specific point on the number line, so \boxed{\pi \in \mathbb{R}} \text{ (and nowhere smaller)}
Loading interactive…
Who uses this
Software engineering
Choosing the right number set is a real design decision in code, not just
notation: a loop counter or an array index is naturally a member of
\mathbb{N} (or \mathbb{Z}, if it can go negative), so a language's int
type models it directly. A price or a measurement is naturally a member of
\mathbb{Q} or \mathbb{R}, and representing it with the wrong type — a
whole-number int for money, say — either truncates fractions of a cent
or forces awkward workarounds. Knowing which set a quantity actually lives
in, before writing a single line of code, heads off an entire category of
"off by a fraction" bugs.
Check your understanding (counts toward your progress)
How many of \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R} contain the number \frac{8}{2}?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Why
\frac{8}{2}=4, a natural number -- and every natural number is also an integer, rational, and real, so all four sets contain it.
Correct answer
Also accepted:
Why
Which containment is FALSE?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
This containment is actually true -- every natural number is an integer.
This containment is actually true -- every integer is rational, as n/1.
This containment is actually true -- every rational number is real.
Why
\mathbb{R} is the largest of the four; it reverses the correct containment to claim it is a subset of \mathbb{Q}, since irrationals are real but not rational.
What is the smallest of \mathbb{N}, \mathbb{Z}, \mathbb{Q}, \mathbb{R} containing -4?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
N (in this course) is {0,1,2,...} -- no negatives, so -4 is not in N.
Why
-4 is a negative whole number -- an integer, but not a natural number in this course's convention.
Why is \sqrt{4} classified as a natural number rather than merely a real number?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
That is false in general -- sqrt(2) is irrational, not natural. Each case must be checked, not assumed.
Why
Simplify before classifying: \sqrt4 evaluates to the whole number 2, so the smallest containing set is N, not merely R.