In short
The set of numbers you know was built up in layers. Counting things gave the natural numbers. Recording nothing gave zero. Subtracting freely gave the negatives. Sharing unevenly gave the fractions. And measuring lengths like the diagonal of a square gave the irrationals. All of them, taken together, form the real numbers — and they fit perfectly on a single straight line, with one number for every point and one point for every number.
Count the mangoes in a basket. Three. That number is doing something specific: it is matching a thing in your head — three — with a thing in the world. If there had been one more mango, you would have said four. If there had been one fewer, two. The number is keeping track of how many.
Now try the same trick on something that isn't a basket of mangoes. How tall are you? Maybe one hundred and sixty-three centimetres — but not exactly. Some number that is more than 163 and less than 164, somewhere in between. Counting is the wrong tool here. You are measuring, not counting, and measuring needs a different kind of number.
The history of numbers is the history of running into something the old numbers couldn't say, and inventing a new kind of number to say it. Each layer of the number system was forced into existence by a question the previous layer couldn't answer. This article walks through those layers in order, and ends at the picture that holds them all: a single straight line, with every number — counting, zero, negative, fractional, and otherwise — sitting at exactly one point on it.
Counting: the natural numbers
The first numbers are the ones you learned as a child: 1, 2, 3, 4, 5, \dots. They go on forever — there is no biggest one — and they have one job: to count discrete things. Three friends. Seven days in a week. One hundred runs.
These are the natural numbers, written \mathbb{N}. In some books \mathbb{N} starts at 1; in others it starts at 0. This article will say \mathbb{N} = \{1, 2, 3, \dots\} and treat 0 as a separate next step, because that is what historically happened — humans counted things for tens of thousands of years before they had a symbol for no things at all.
You can add two natural numbers and get a natural number: 3 + 4 = 7. You can multiply them: 3 \times 4 = 12. So far, the naturals are doing fine.
The trouble starts when you try to subtract. What is 3 - 3? There is no natural number for "no mangoes." What is 3 - 5? There is no natural number for "two fewer mangoes than you have." The set is too small to be closed under subtraction. To fix it, you have to add something.
Zero, and the whole numbers
The first patch is to add a single new symbol, 0, meaning nothing. This gives the whole numbers:
Easy to write. Hard to invent. The idea that nothing deserves its own number — that you need a symbol for the absence of things, and that this symbol should obey arithmetic — was a major intellectual leap. Brahmagupta, an Indian mathematician writing around 628 CE, was the first to lay down the formal arithmetic rules for zero in his Brahmasphutasiddhanta: a + 0 = a, a - 0 = a, a \times 0 = 0, and so on. He even tried to handle division by zero, and got most of it right. The number system you use today rests on that step.
Now 3 - 3 = 0 has an answer. But 3 - 5 still doesn't.
Negatives, and the integers
To handle 3 - 5, you need numbers smaller than zero. Mirror the natural numbers across zero: for every positive number, invent a negative counterpart, written with a minus sign in front. This gives the integers:
The symbol \mathbb{Z} comes from a German word meaning numbers.
Negatives feel strange the first time you meet them. How can you have less than nothing? The answer is that negatives don't represent amounts of stuff; they represent signed quantities. You don't owe negative two rupees of debt — you owe two rupees, which is recorded as a balance of -2. You don't have negative three steps — you took three steps in the opposite direction, recorded as -3. The negative sign is an arrow saying the other way.
With integers, 3 - 5 = -2 has an answer. Subtraction is now closed: any integer minus any integer is an integer.
But division still isn't. What is 7 \div 4? There is no integer that, multiplied by 4, gives 7. The closest you can do is one with three left over — and "left over" isn't a number, it is a remainder. To divide cleanly, you need another extension.
Fractions, and the rational numbers
Take an integer p and a non-zero integer q, and write \dfrac{p}{q}. The result is a rational number — rational not in the sense of sensible, but in the sense of ratio. The set of all such fractions is
The symbol \mathbb{Q} comes from quotient.
Several different fractions can name the same rational number: \dfrac{1}{2} and \dfrac{2}{4} and \dfrac{50}{100} are all the same number, just written with different scales. Every rational has a lowest-terms form where the top and bottom share no common factor — for \dfrac{50}{100}, that form is \dfrac{1}{2}.
Rationals include the integers, because every integer n can be written as \dfrac{n}{1}. They include 7 \div 4 = \dfrac{7}{4}. They include -\dfrac{3}{5} and \dfrac{0}{8} = 0. Division by anything except zero is now closed.
What rationals look like as decimals
Every rational number has a decimal expansion. To find it, do long division. Two things can happen.
Case 1: the division ends. You divide, you carry, you eventually hit a remainder of zero, and the decimal stops.
These are terminating decimals.
Case 2: the division never ends, but it eventually starts repeating a fixed block of digits.
These are recurring decimals. The repeating block is sometimes shown with a bar overhead: 0.\overline{3}, 0.\overline{142857}, 0.\overline{45}.
Why are these the only two possibilities? Think about the long-division process. At every step, you write down a digit and you carry a remainder — some integer between 0 and q - 1. There are only q possible remainders. Once the same remainder shows up a second time, the digits from that point on must repeat exactly the same pattern that came before, because long division is deterministic. So one of two things has to happen first: either you hit a remainder of 0 (and the decimal stops), or you hit a remainder you have seen before (and the digits start cycling). There is no third option.
This is the first deep theorem of number systems: a decimal represents a rational number exactly when it terminates or eventually repeats. The other direction — that any terminating or repeating decimal can be written as a fraction — is the content of Example 1 below.
The picture below shows what each of these options looks like in practice. Two rational decimals (one that stops, one that repeats), and one decimal that does neither — a sneak preview of what comes next in this article.
But what about a decimal that never terminates and never repeats? Could such a thing even exist?
The diagonal of the square
Draw a square whose sides are exactly 1 unit long. Now draw the diagonal from one corner to the opposite corner.
How long is the diagonal? By the Pythagorean theorem, if a right triangle has two legs of length 1, the hypotenuse has length \sqrt{1^2 + 1^2} = \sqrt{2}.
So \sqrt{2} is a real, physical length. You can hold a ruler against the diagonal and measure it. It is somewhere a little bigger than 1.4. There clearly is a number describing how long that diagonal is.
Question: is \sqrt{2} a rational number? Is there some pair of integers p and q — maybe huge ones, but integers — such that \dfrac{p}{q} = \sqrt{2}?
The answer is no. There is no such pair of integers, anywhere, no matter how large. And the proof of this is one of the most famous arguments in mathematics. It is short, and it is worth seeing in full.
Suppose, just for the sake of argument, that \sqrt{2} is rational. Then you can write
where p and q are integers and the fraction is in lowest terms — that is, p and q share no common factor.
Square both sides:
The right-hand side is two times an integer, so p^2 is even. If p^2 is even, then p itself is even, because the square of an odd number is always odd. So p = 2k for some integer k.
Substitute back:
Now q^2 is also even, so q is also even.
But this is impossible: you started by saying p and q had no common factor, and now you have shown that they are both even, which means they share a factor of 2. The two statements cannot both be true. The only assumption that can be wrong is the very first one — that \sqrt{2} could be written as a fraction at all.
So \sqrt{2} is not a rational number. There is a perfectly real, perfectly measurable length — the diagonal of a unit square — that cannot be written as any ratio of integers, no matter how clever you are.
Irrationals, and the real numbers
A number that is not rational is called irrational. The name is unfortunate — it makes irrationals sound unreasonable or strange — but it just means not a ratio.
\sqrt{2} is one example. There are many more. \sqrt{3}, \sqrt{5}, and indeed the square root of any positive integer that isn't a perfect square. The number \pi \approx 3.14159\dots that gives the circumference of a circle in terms of its diameter. The number e \approx 2.71828\dots that turns up in growth, decay, and compound interest. None of these are fractions. Their decimal expansions go on forever and never settle into a repeating pattern.
The real numbers, written \mathbb{R}, are everything: rationals and irrationals together. Every length you can measure, every position on a continuous scale, every value a smoothly changing quantity can take — all of these are real numbers.
The full hierarchy nests cleanly:
Each new layer contains everything from the previous layer and adds the things that were missing. The picture below is the entire story of this article in one image.
The number line
There is a single picture that holds all of this. Draw a horizontal straight line. Pick a point on it and call it 0. Pick another point to the right and call it 1. The distance from 0 to 1 is now your unit. Everything else is forced.
The integers are evenly spaced: 1 is one unit to the right of 0, 2 is one unit to the right of 1, and so on. The negatives are evenly spaced going the other way: -1 is one unit to the left of 0, -2 is two units to the left, and so on.
Each rational \dfrac{p}{q} sits at exactly one point. To find \dfrac{3}{4}, take the segment from 0 to 1, divide it into four equal pieces, and walk three of them to the right. To find -\dfrac{7}{2}, walk seven half-segments to the left of 0.
The irrationals fit in the gaps — real gaps that the rationals leave behind, even though there are infinitely many rationals. \sqrt{2} sits at one specific point a little past 1.4. \pi sits at one specific point a little past 3.14. Neither point is occupied by any rational number.
The deep claim, which you can take on trust for now: every point on the line is exactly one real number, and every real number is exactly one point on the line. No gaps, no ambiguity, no double-counting. This is what makes the real numbers the right setting for measurement.
The picture below shows four points of four different kinds — an integer, a rational, and two irrationals — sitting peacefully on the same line. They look the same. They are all just points. The line does not care which kind of number you are.
You can also try this directly. Drag the red point along the line below — it follows your finger to whatever real number you pick. The readout shows your position to six decimal places, and the second line shows how far you are from \sqrt{2}. You can get arbitrarily close to \sqrt{2} but, no matter how carefully you drag, that distance never quite hits zero, because \sqrt{2} is not a number your dragging can land on by accident — it is one specific point in the gap between rationals.
Worked examples
Two examples to make this concrete. The first shows how to convert a recurring decimal back into a fraction — proving that a repeating pattern, no matter how long the period, is rational. The second shows how to construct an irrational length on the number line, using a ruler and a compass, with no decimal arithmetic at all.
Example 1: convert $0.272727\dots$ to a fraction
The decimal 0.272727\dots keeps repeating the block 27. By the theorem above, it must be a rational number. The trick is to use a little algebra to subtract the repeating tail away.
Step 1. Give the decimal a name.
Why: you cannot manipulate "the decimal 0.272727\dots" directly, but you can manipulate x. Naming the unknown is the first move in any algebra problem.
Step 2. Multiply by a power of 10 that shifts the repeating block past the decimal point.
The block is two digits long, so multiply by 100:
Why: you want a second copy of the decimal that has the same repeating tail. Shifting by exactly the length of the repeating block lines the tails up perfectly.
Step 3. Subtract the original from the shifted version.
Why: the two decimals have identical tails after the shift, so subtracting cancels the entire infinite mess in one step. Everything to the right of the decimal point disappears, leaving only an integer on the right-hand side.
Step 4. Solve for x.
Why: ordinary algebra. The fraction simplifies because 27 and 99 share a common factor of 9.
Result: 0.272727\dots = \dfrac{3}{11}.
The trick generalises. Given any recurring decimal with a repeating block of length n, multiplying by 10^n shifts the tail by exactly one period, and the subtraction wipes the tail out. So every recurring decimal is the ratio of two integers — it must be rational. That is the converse direction of the theorem from earlier.
Now turn the problem around. Instead of starting with a decimal and finding a fraction, start with a length and find where it goes on the number line. If the length is rational, no surprise — count off the right number of equal pieces. But what if the length is irrational? You cannot write it as a fraction. You cannot count off pieces. You need a geometric construction.
Example 2: place $\sqrt{2}$ on the number line
You want to find the exact point on the number line that corresponds to \sqrt{2}. You cannot use a decimal, because \sqrt{2}'s decimal expansion goes on forever without ever repeating. You need a construction that picks out the point directly.
Step 1. Build a unit square sitting on the number line.
Mark the points 0, 1, and 2 on the line. Above the segment from 0 to 1, draw a square with sides of length 1. The square's corners are at (0,0), (1,0), (1,1), and (0,1) — the bottom edge sits flat on the number line.
Why: you want to manufacture a length of exactly \sqrt{2}. Pythagoras gives you a way to do that geometrically with nothing but a ruler.
Step 2. Draw the diagonal of the square from (0, 0) to (1, 1).
By the Pythagorean theorem, the length of this diagonal is
Why: this diagonal is a line segment of length \sqrt{2}, sitting right there on the page. You have built the irrational number out of two ordinary integer-length sides.
Step 3. Swing the diagonal down onto the number line.
Place the point of a compass at (0, 0). Set the compass radius equal to the length of the diagonal — that is, to \sqrt{2}. Swing an arc from the top corner (1, 1) downward until it hits the number line.
Why: a circle is the set of all points at one fixed distance from a centre. By spinning the diagonal around the corner (0, 0), you carry its length onto the number line without ever computing a single decimal digit.
Step 4. Read off the location.
The arc meets the number line at exactly one point. By construction, that point is the same distance from 0 as the diagonal was — namely \sqrt{2}, which numerically is about 1.41421\dots. So the point on the number line is at exactly \sqrt{2}.
Result: The point at \sqrt{2} on the number line is the foot of the arc swung from (1,1) with the diagonal as radius.
Look at what just happened. With a ruler and a compass — no calculator, no decimals — you found the precise spot where an irrational number lives. The same construction works for \sqrt{3} (start from a 1-by-\sqrt{2} rectangle), for \sqrt{5} (start from a 1-by-2 rectangle), and so on. Geometry gives you a way to handle irrational lengths that decimal arithmetic cannot.
Absolute value
One more idea before the deeper section: the absolute value, also called the modulus.
The absolute value of a real number x, written |x|, is the distance from x to 0 on the number line. Distance is always non-negative, so the absolute value is always non-negative.
Absolute value
For any real number x,
Reading the definition: if x is already non-negative, |x| leaves it alone. If x is negative, |x| flips the sign, turning it positive. Either way, the result is non-negative.
A few quick values:
The geometric reading is the more useful one. |x| is the distance from 0 to x on the number line. More generally, |x - y| is the distance from x to y — the gap between them, always counted as a positive number, no matter which is bigger. So |5 - 3| = 2 and |3 - 5| = |{-2}| = 2. The order didn't matter. Distance has no direction.
That is the version of "absolute value" to keep in your head. Not "remove the minus sign." Distance.
Common confusions
A few things that students reliably trip on the first time they meet number systems.
-
"Every infinite decimal is irrational." False. 0.333\dots is infinite but it equals \dfrac{1}{3}, which is rational. The rule is non-terminating and non-repeating. Both conditions are needed before a decimal can be irrational.
-
"Irrational means weird or unreasonable." No. Rational is short for ratio. Irrational means not a ratio of integers. There is nothing mysterious or strange about \sqrt{2} — it is the diagonal of a square with side 1. It is as concrete as anything in geometry.
-
"Zero is positive." Or "zero is negative." Neither. Zero is the boundary between the positives and the negatives. It is the only real number whose absolute value is itself with no sign-flip needed.
-
"Negative numbers are smaller, but -1000 is bigger than -1 because 1000 > 1." No. Smaller on the number line means further to the left. The point -1000 is much further left than -1, so -1000 < -1. The size of the number — what you would write as |x| — is not the same as its position on the line.
-
"|x| just means deleting the minus sign." A handy shortcut for plain numbers, but it misleads when the thing inside is an expression. |x - 3| is not "x - 3 with the minus sign removed." It is the distance from x to 3 on the number line. If x = 1, that distance is 2, so |1 - 3| = 2 — and the minus sign was never the point.
-
"Fractions and decimals are different things." They are two notations for the same numbers. \dfrac{1}{2} and 0.5 are the same point on the number line, just spelled differently. Every rational has both a fraction form and a decimal form, and you can convert between them in either direction.
Going deeper
If you came here to know what the layers of numbers are and how they fit together, you have it — counting, then zero, then negatives, then fractions, then the things in the gaps, all on one line. The rest of this article is for readers who want the rigorous version, the historical thread, and a hint at where this gets strange.
Density of the rationals — and why it isn't enough
The rationals are dense on the number line. Pick any two distinct rationals — even ones very close together, like \dfrac{1}{1000000} and \dfrac{1}{999999}. There is always another rational between them. (Take their average: it is a fraction whose numerator and denominator are computable from the two given ones, so it is also rational, and it sits exactly in the middle.)
So between any two rationals, however close, there is a third rational. And between those two, a fourth. And between those two, a fifth. The rationals are packed into the number line with no smallest gap.
You might think this means the rationals fill the line completely. They do not. Density and completeness are two different properties.
Here is the picture. You showed above that \sqrt{2} is irrational and that it sits at a specific point on the number line. That point is not a rational. Yet it has rationals arbitrarily close to it on both sides — 1.41,\; 1.414,\; 1.4142,\; 1.41421,\; \dots from below, and 1.42,\; 1.415,\; 1.4143,\; 1.41422,\; \dots from above. The rationals get arbitrarily close to \sqrt{2} without ever actually reaching it.
You can watch the trap close around \sqrt{2} by zooming in. Each interval below has rational endpoints. Each is narrower than the one before. Each still contains \sqrt{2}. And you could keep going forever without the rational endpoints ever pinning \sqrt{2} down.
You can do the zooming yourself. The number line below is centred on \sqrt{2}. Click the + button on the right to zoom in by a factor of 5, or - to zoom out. The black ticks are the rationals at the current zoom level. The red bar is \sqrt{2}. Watch what happens to it as you zoom — the rational ticks rearrange around it, but it never lands on one.
So the rationals leave a hole at the point \sqrt{2} — a hole with rationals crowding around it from both sides but no rational sitting inside. There is one such hole at every irrational. Plugging all those holes is what the irrationals do. Together, the rationals and irrationals make a line with no holes left. That property is called completeness, and it is the single most important thing about the real numbers. The article on Real Numbers — Properties walks through what it really means and why it matters.
The Sulba Sutras' approximation of \sqrt{2}
You cannot write \sqrt{2} exactly as a fraction. But you can write down a fraction that is very close to it.
Around 800 BCE, the Indian mathematicians who composed the Sulba Sutras — manuals for constructing fire altars, where geometry was needed for ritual precision — wrote down this approximation:
Compute it. The first three terms give 1 + 0.3333\dots + 0.0833\dots = 1.41666\dots. Subtract \dfrac{1}{408} = 0.00245\dots and you get 1.41421568\dots.
The actual value of \sqrt{2} is 1.41421356\dots. The Sulba Sutras' approximation is correct to five decimal places — off by about two parts in a million. The authors had no calculators, no decimal notation, and no algebra in the modern sense. They had a need to build square altars accurately, and they figured out how to manufacture this fraction.
It is the kind of result that should change how you think about the history of mathematics — and about how much can be done with how little.
A teaser: the rationals are countable, but the reals are not
One last thing, just as a marker for later. You might think "there must be way more rationals than integers, because between any two integers there are infinitely many rationals." That intuition is wrong. The rationals can be put into a one-to-one correspondence with the natural numbers — there are exactly as many rationals as counting numbers. Both sets are called countably infinite.
But the real numbers cannot be put into such a correspondence. There are strictly more real numbers than there are natural numbers, in a precise sense that can be made rigorous. The irrationals account for almost all of the excess. In a way you will see in a much later article, almost every real number is irrational — the rationals you grew up with are a vanishingly thin scattering inside a much vaster sea.
That is a strange thing to say, but it is true. The kind of numbers you have known all your life — counting numbers and fractions — turn out to be the rare exception, not the rule.
Where this leads next
The number line is the foundation everything else in mathematics is built on. The articles below take it in different directions.
- Operations and Properties — what addition, subtraction, multiplication, and division actually do to numbers, and the rules they obey (commutative, associative, distributive).
- Fractions and Decimals — converting between the two notations, operating on fractions, and rationalising denominators that contain irrationals.
- Roots and Radicals — how to manipulate irrational expressions like \sqrt{2} and \sqrt[3]{5} symbolically, without ever turning them into decimals.
- Real Numbers — Properties — the formal version of completeness, density, and what makes the real number line the right setting for limits and calculus.
- Complex Numbers — even the real number line is not the end of the story. The equation x^2 = -1 has no solution among the reals, which forces one more extension.