Rational and irrational numbers

Most readers of this blog probably know what a rational number is: it’s a number that can be represented as a ratio (hence rational) of two integers. In other words, a fraction. Examples are 3/4, 99/2, and -20837/231, and even 4 (it can be represented as the ratio 4/1). The only restriction is that you can’t have zero in the denominator (the bottom of the ratio) since division by zero, of course, is undefined.

You’ve probably also heard of irrational numbers, which, of course, are numbers that aren’t rational. But are you sure that irrational numbers exist? Why? Just because some teacher told you, or you’ve heard of them before? The ancient Greeks thought irrational numbers didn’t exist—that every quantity could be described by a ratio—and they were in for a rude surprise when they themselves proved this to be false! I won’t go into that history in more detail here; it’s actually quite confused and unclear as to who did what when and so on. Maybe I’ll try writing about that in a future post. For now, I’ll just offer some incontrovertible proof that at least one number exists which isn’t rational. Probably many of you have seen it already, but it’s a good place to start, as I intend to write more posts on this topic in the near future.

Ready? OK, I’m thinking of a number which we’ll call s. In particular, s is the length of one side of a square whose area is 2. This is how the Greeks would have thought of it, and certainly no one can argue that it isn’t a number! There obviously must be a square with an area of 2, and the sides of that square obviously must have a length, and that length is a number. (Astute readers will note that I’m playing rather fast and loose with the term “number”. Which is true. So sue me.) In more modern terms, we would say that s is the positive solution to the equation s^2 = 2, or just s = \sqrt{2}.

Now, suppose that s is a rational number, so that s can be represented by a ratio s = p/q. Remember, we want to show that s isn’t rational, so I’ll show that making this assumption leads to an absurdity, from which we can conclude that it was an incorrect assumption in the first place. This is called a proof by contradiction—assume the logical opposite of what you want to prove, and show that this leads to an absurdity, like 1 = 2, or something being both true and not true at the same time.

We’ll assume that p/q is in lowest terms, that is, that p and q have no common factors. It’s ok to assume this, since any rational number can always be turned into an equivalent one in lowest terms.

We know that squaring s yields 2, so substituting p/q for s gives us the equation p^2/q^2 = 2. Rearranging, we find that p^2 = 2q^2, so p^2 is even. But if p^2 is even, so is p (you should convince yourself of this), so we can write p = 2r for some other integer r. Substituting, we find that (2r)^2 = 4r^2 = 2q^2, and therefore 2r^2 = q^2. But this means that q^2 is even, and therefore so is q—but this is absurd, because we assumed that p and q have no common factor, so they can’t both be even! Therefore, our original assumption—that s is rational—must be false.

In upcoming posts I plan to explore this and other related topics, possibly including: the connection between rational numbers and decimal expansions, the period of repeating decimals, repunits, set cardinality and orders of infinity, some famously irrational numbers (like \pi and e), and maybe even some continued fractions. There are many fascinating topics connected in one way or another to this distinction between rational and irrational numbers, so it should be interesting—I hope you’ll come along for the ride!

As a further challenge, can you extend the above proof to show that the square root of any prime number is irrational? What about the square root of any positive integer which is not a perfect square? (This second one is a bit trickier, because if n is not prime, you cannot assume that if n divides p^2 then it must divide p as well—for example, 12 divides 6^2 = 36, but it does not divide 6.)

About Brent

Associate Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in algebra, challenges, number theory, proof and tagged . Bookmark the permalink.

11 Responses to Rational and irrational numbers

  1. Joshua Zucker says:

    Yeah, when I taught this to high school students, we’d do sqrt(2) in class, then sqrt(3) for homework, and then on the test I’d have them prove sqrt(4) is irrational. When most of them did it, following the same method, I think that showed they didn’t really understand the key step of the proof.

  2. Brent says:

    Haha, that’s sneaky! I like it. =)

  3. Tim McKenzie says:

    “no one can argue that it isn’t a number!”
    Kronecker can.

  4. Sid says:

    That’s clever, Josh 😉

  5. Hi Brent,

    Thanks for the post!

    I’d like to contribute with an alternative, calculational proof:


    Dijkstra once wrote that

    “Beware of the reductio ad absurdum: when used it is a warning not to be ignored, for only too often it is a symptom on mental laziness!”,

    which I partially agree. I’ve got nothing against proofs by contradiction, but I prefer to use direct (calculational) proofs.

    I’m looking forward for your next post,

  6. Brent says:

    Hi Joao,

    Thanks for the cool direct proof! Reductio ad absurdum is actually more “historically accurate” here, since that’s pretty much exactly what the greeks did. But (especially given my my love of Curry-Howard) I like constructive proofs too. =)

  7. John Gabriel says:

    Since the time of the ancient Greeks, our understanding of irrational numbers has not changed. To define a number that cannot be expressed as a/b as irrational is a poor definition. It says what an irrational number is ‘not’, i.e. a number in the form of a/b, the definition does not say what an irrational number ‘is’. It is true that an irrational number is stilll undefined today as it was then. We still use rational numbers to approximate irrational numbers. See my blog called ‘Exactly what is an irrational number?’

    When I teach irrational numbers (I am a twelfth grade math teacher), I demonstrate only that such numbers do exist but can only be approximated using rational numbers. The underlying problem is about the humble concept of ‘average’.


  8. JM says:

    Hi! I’m new here, but I have a simpler proof of the irrationality of the square root of two.

    First, we’ll assume that p/q is in lowest terms. If this is true, then p^2/q^2 is in lowest terms. (This is true because the prime factorization of squares is the original’s repeated twice.) Now, if p^2/q^2=2 and is in lowest terms, then q^2 is 1. Thus, q is 1 (or -1). Going back to the fraction p/q, we see that if q equals 1, p equals the square root of two. However, if p isn’t an integer, then p/q isn’t a fraction.

    I hope you liked my ideas! Tell me what you think.

  9. Brent says:

    Hi JM, welcome! And nice proof, that’s quite clever. =)

  10. Tirth says:

    Questions :
    Consider a the number line I can see root of 2 finishing at an intersection which is discrete but I cannot represent it through a number. Why ?

    • Brent says:

      Tirth: I am not sure I understand your question. What do you mean by “finishing at an intersection which is discrete”?

Comments are closed.