Welcome to The Real Number System and Irrationality, the third course in our learning path! In the first two courses, we built a thorough understanding of rational numbers: what they are, how their decimal expansions behave, and how to convert between fractions and decimals. That foundation is about to pay off in a big way.
In this first lesson, we introduce a completely new family of numbers called irrational numbers. We will define them precisely, connect that definition to a specific kind of decimal expansion, and see why they are essential for completing the number line. Let's get started.
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal
As you may recall from our previous courses, a rational number is any number that can be written in the form ba, where a and b are both integers and b=0. This single requirement captures a wide variety of numbers: whole numbers like 5 (since 5=15), negative fractions like −73, and familiar decimals like 0.75 (which equals 43).
We also learned a useful fact about their decimal expansions: every rational number's decimal either terminates (ends after finitely many digits) or eventually repeats (settles into a block of digits that cycles forever). There is no third option for rationals. Keeping this fact in mind will be the key to understanding what comes next.
If rational numbers are those that can be written as ba with integers a and b=0, then the definition of an irrational number is refreshingly straightforward:
An irrational number is a real number that cannot be expressed as ba, where a and b are integers and b=0.
That's it. No matter how hard we try, there is no pair of integers whose ratio equals an irrational number. The classic example is 2, a number you encounter any time you measure the diagonal of a perfect square. If you have a square tile that is 1 foot on each side, its diagonal is exactly 2 feet. While 1014 and 100141 come close, no fraction of two integers will ever equal 2 exactly.
Because every rational decimal either terminates or eventually repeats, an irrational number must do something different. Its decimal expansion goes on forever without ever settling into a repeating cycle. This gives us a powerful equivalent way to characterize irrationals:
A number is irrational if and only if its decimal expansion neither terminates nor eventually repeats.
Let's look at a few examples side by side to make this concrete:
Number
Decimal Form
Behavior
Classification
43
0.75
Terminates
Rational
31
0.3
Eventually repeats
Rational
—
0.101001000100001…
Neither terminates nor repeats
Irrational
Notice that 0.3=0.333… has infinitely many digits, yet it is perfectly rational. This is a common misconception worth guarding against: having infinitely many decimal digits does not make a number irrational. What matters is whether those digits form a repeating pattern.
In 0.3, the digit 3 repeats forever in a predictable cycle, so it is rational. In 0.101001000100001…, the growing number of zeros between each 1 ensures that no fixed block of digits ever repeats, making it irrational.
Imagine plotting every rational number on the number line. You might expect the line to be completely filled, since between any two rationals there is always another rational. Surprisingly, even though rationals are packed that densely, they still leave gaps.
To visualize this, think of it like this: if you only used rational numbers, your number line would look like a solid fence that, under a microscope, is actually made of disconnected dots. Adding irrational numbers "welds" those dots together into a solid, continuous line.
Here is one way to see a gap. Consider the point on the number line that sits at a distance of exactly 2 from the origin. We know 2 is somewhere between 1 and 2 because 12=1 and 22=4. A more precise decimal approximation is 1.41421356…, and those digits continue forever without repeating. No rational number occupies that exact spot, so there is genuinely a "hole" in the rationals at that location.
Irrational numbers are precisely the numbers that fill these holes. When we combine all rational numbers and all irrational numbers together, we get the real numbers, and the real number line is truly complete, with no gaps remaining. This is why irrationals are not just a mathematical curiosity — they are essential for a continuous, unbroken number line that models real-world measurements like distances, lengths, and areas.
In this lesson you learned that an irrational number is one that cannot be written as ba with integers a and b=0, and equivalently, its decimal expansion neither terminates nor eventually repeats. We also saw that infinitely many decimal digits alone do not make a number irrational — the digits must lack any repeating cycle. Finally, we explored how irrational numbers fill the gaps that rationals leave on the number line, and how rationals and irrationals together form the complete set of real numbers.
Up next, you will put these ideas into practice with a set of exercises. You will identify correct definitions, classify the decimal behavior of specific numbers, and explain in your own words why the number line needs irrationals — so keep these core concepts fresh as you dive in!