From counting to fractions: ℕ, ℤ and ℚ
P82.rationals.01 · Audience: Guest, IT/ML learner, Language professional
Where next?
Later in The Rational Numbers
This module unlocks
P82.rationals.01 · Audience: Guest, IT/ML learner, Language professional
Later in The Rational Numbers
This module unlocks
Welcome to Mathematics, and to its first question: what is a number? The goal of this lesson is to see that each new kind of number was invented to answer an equation the numbers before it could not, and to meet the fractions properly: what makes two of them equal, and why there is always another one between any two. You need school arithmetic and nothing else.
The first numbers anyone meets are the ones you count with: 0, 1, 2, 3, and so on without end. Mathematicians call them the natural numbers and write the whole collection as ℕ (a bold or double-struck N). Some books start ℕ at 1; this course starts it at 0, because "how many?" can have the answer "none".
Add two natural numbers and you get a natural number. Multiply two and you get one again. But ask a simple question and ℕ has no answer:
Which number, added to 3, gives 1?
In symbols, solve x + 3 = 1. No natural number works: adding 3 to anything
in ℕ gives at least 3.
The answer is to invent the numbers below zero. Put the negative numbers −1,
−2, −3, … beside the natural numbers and you have the
integers, written ℤ (from the German Zahlen,
"numbers"). Now x + 3 = 1 has the answer x = −2: think of a debt of 2 that
three coins pay off and leave one over.
In ℤ you can add, subtract and multiply and never leave ℤ. Division is where it stops:
Which number, multiplied by 3, gives 1?
3x = 1 has no answer among the integers: 3 × 0 is 0 and 3 × 1 is already 3.
The answer this time is the fraction 1/3: one thing shared between three. A rational number is a number you can write as a fraction p/q, with p and q integers and q not zero. The whole collection is written ℚ (for quotient, the result of a division). Every integer is already in ℚ, since 5 is 5/1.
The pairs (1, 2), (2, 4) and (50, 100) are different pairs, yet 1/2, 2/4 and 50/100 are the same number. The rule is a cross-multiplication:
a/b and c/d are equal exactly when a × d = b × c.
So 2/4 = 1/2 because 2 × 2 = 4 × 1. A rational number is really the whole family of pairs that pass this test with one another, and we usually name it by its simplest member. A fraction is in lowest terms when the top and bottom have no common factor bigger than 1: 1/2 is in lowest terms, 50/100 is not. Every fraction has exactly one way to be written in lowest terms with a positive bottom, and you reach it by dividing top and bottom by their largest common factor.
Python has this idea built in. Its fractions module stores exact fractions and
always keeps them in lowest terms:
from fractions import Fraction
print(Fraction(50, 100)) # 1/2
print(Fraction(2, 4) == Fraction(1, 2)) # True
print(Fraction(1, 3) + Fraction(1, 6)) # 1/2, exact: no 0.333...
Here is the property that makes ℚ feel finished, as if nothing were missing. Take any two different fractions, say 1/3 and 1/2. Their average is a fraction, and it sits strictly between them:
(1/3 + 1/2) ÷ 2 = (2/6 + 3/6) ÷ 2 = 5/12
and indeed 1/3 = 4/12 < 5/12 < 6/12 = 1/2. Nothing about 1/3 and 1/2 was special: the average of any two fractions is a fraction, and it lies between them. Repeat the trick and you find a fraction between 1/3 and 5/12, then another, without end. This is called density: between any two rational numbers there is always a third, so there are infinitely many between any two.
Compare the integers: between 2 and 3 there is no integer at all.
Say a < b. Then a + a < a + b < b + b, which is 2a < a + b < 2b. Halving every part keeps the order: a < (a + b)/2 < b. If a and b are fractions, so is their sum, and so is half of it. That is a complete proof, and it is the first one in this course.
The rule "q is not zero" is not a technicality. Here is a famous "proof" that 1 = 2, where every line looks innocent:
Lines 1 to 4 are all true. Line 5 is where it breaks: cancelling (a − b) means dividing both sides by it, and since a = b, (a − b) is zero. "Divide by zero" is not a step algebra allows, because 0 × 5 = 0 × 7 would then "prove" 5 = 7. The exercise below has you find the broken line mechanically, by evaluating every line with numbers.
Three sets, each inside the next: ℕ ⊂ ℤ ⊂ ℚ (the sign ⊂ reads "is contained in"). Each one answered a question:
| Set | Answers | Example |
|---|---|---|
| ℕ, natural numbers | "how many?" | 3 |
| ℤ, integers | x + 3 = 1 | −2 |
| ℚ, rational numbers | 3x = 1 | 1/3 |
ℚ looks like the end of the story: you can add, subtract, multiply and divide
(by anything but zero) and never leave it, and it is dense. The next lesson asks
one more question, x² = 2, and shows that ℚ has no answer to it.
Fill each gap. These are short, and each one says why after you check.
Loading the exercise...
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Two coding rungs in your browser. They ask for a little Python (functions and loops); if that is new, Beginner Python teaches it. Run checks the visible tests; Submit grades against hidden tests, which try cases you have not seen.
Loading exercise…
Loading exercise…
Loading your notes...