Root 2 is irrational - proof by prime factors

By Martin McBride, 2024-03-02
Tags: irrational number square root prime factors
Categories: number theory


There are several proofs that the square root of 2 is irrational. The earliest dates back to Euclid, around 300 BC. In this article, we will look at an alternative proof, based on prime factors.

This proof has several advantages:

  • It is simpler.
  • It can be easily applied to other numbers.
  • It provides a good explanation of why perfect squares are a special case.
  • It can be easily applied to higher powers.
  • It can also be used to prove the stronger statement that any integer root of an integer value is either an integer or irrational.

Proof by contradiction

We will use a proof by contradiction. We will start by assuming that the square root of 2 is rational, and prove that this leads to a contradiction, so root 2 cannot be rational.

If root 2 was rational, then by definition, there must be some positive integers a and b for which:

Proof by contradiction

Squaring both sides gives:

Proof by contradiction

So for root 2 to be rational, there must be positive integer values a and b such that:

Proof by contradiction

If we can prove that no such integer values can exist, then we have proved that the root of 2 cannot be rational and therefore must be irrational.

Prime factors

According to the fundamental theorem of arithmetic, every positive integer greater than 1 can be uniquely represented as a product of prime numbers. For example:

Prime factors

The theorem tells us two things. The first is that any positive number greater than 1 can be expressed as a product of one or more prime numbers. The second thing it tells us is that, for any particular number, there is only one way to do it. For instance, 45 can be expressed as 3 squared times 5, and there is no other way to express 45 as a product of primes.

The reason this only applies to numbers greater than 1 is that 1 itself is not a prime number.

For many numbers, the same prime number might appear as a factor more than once. For example, 1960 has three factors of 2, and two factors of 7. These can either be written as repeated multiplications or as powers (both are shown in the examples above). For this article, expressing them as powers is more useful, so we will use that notation from now on.

The number of times each prime appears in the factorisation is called the order of the factor. So in the example of 1960, we would say that 2 is a prime factor of order 3, 5 is a prime factor of order 1, and 7 is a prime factor of order 2. We could also say that 11 is a prime factor of order 0 because it doesn't appear in the factorisation at all.

In general, we can represent any integer n, greater than 1, as the product of a set of prime numbers p each raised to a positive integer power r:

Prime factors

Squaring a number using prime factors

The square of an integer n can be found by multiplying n by itself:

Squaring a number

We can rearrange the product, by grouping each pair of factors for each prime:

Squaring a number

Now we know from basic arithmetic that when we multiply powers of the same base, we just add the exponents:

Squaring a number

In our case, the exponents are equal, so we get this:

Squaring a number

So to calculate n squared, we take the prime factors of n and double each of the powers. But the really important thing we get from this is that for a perfect square, the exponent of every prime factor is an even number. For example:

Squaring a number

Proof that the square root of 2 is irrational

We previously discovered that root 2 cannot be rational unless there are some positive integer values a and b such that:

Proof by contradiction

We also know from the fundamental theorem of arithmetic that for two positive integers x and y to be equal, they must have identical prime factors.

In particular, if x has 2 as a factor of order m (that is, if 2 appears m times in the factorisation) then y must also have 2 as a factor of order m:

Equality condition

Of course, all the other prime factors must also have identical orders. But we will only look at the powers of 2 because if we can prove they are different, then that is sufficient to prove that x and y are not equal.

Now recall that, for a perfect square, every prime factor must have an even order. This means that for a squared, the order of prime factor 2 must be even:

Equality condition

The order can be zero, of course, meaning that 2 isn't a prime factor at all - zero is an even number. For b squared, the order of prime factor 2 must be also even:

Equality condition

But what about 2 times b squared? Since we have multiplied by 2, the order of prime factor 2 must be odd:

Equality condition

So now let's compare the a and b terms:

Equality condition

2s must be even, and 2t + 1 must be odd, so those two values can never be equal. This means that a squared can never equal 2 times b squared for any positive integer values of a and b.

This proves that the square root of 2 cannot be rational and, therefore must be irrational.

Proof for square roots of other numbers

It is quite easy to see how this can be applied to other numbers. For example, is the square root of 3 rational? If we follow the same logic as before, it requires us to find integers a and b such that:

Proof for square root 3

This time, we can observe that a squared must have an even power of 3, whereas 3 times b squared must contain an odd power of 3, so again the square root of 3 cannot be rational:

Proof for square root 3

Is the square root of 4 rational? Of course, we know that it is! But it is useful to see how this plays out using the previous logic. This time we need to find integer solutions to the equation:

Proof for square root 4

Notice that we have expanded the value 4 into its prime factors, that is 2 squared. We didn't need to do that previously because those values (2 and 3) were primes anyway.

In this example, again, we are concerned with powers of 2. As before, we observe that a squared must contain an even power of 2, and b squared must contain an even power of 2. But is this case 4 times b squared must contain an even power of 2:

Proof for square root 4

So this time, both sides of the original equation contain an even power of 2, so a solution might be possible. And in fact, it is solved by a = 2, b = 1, meaning that the square root of 4 is 2.

In general (not proven here), to find out if the square root of integer x is rational, first find its prime factors. If all the prime factors have an order that is an even number, then x is a perfect square and so has a rational result (actually an integer result, as we will see later). If any of the prime factors have an odd order, the square root is irrational.

Proof for cube roots and higher

Is the cube root of 2 rational? We won't look at this in great detail, but we will sketch out the basic idea as to why it is not. This follows very similar lines to the proof for the square root.

This time we need to find a, b such that:

Proof for cube root

The value of a cubed must contain a power of 2 that is a multiple of 3 (which, again, can be 0). Similarly b cubed must contain a power of 2 that is a multiple of 3. And 3 times b cubed must contain a power of 2 that is a multiple of 3 plus 1:

Proof for cube root

So a cubed cannot have the same prime factors as 3 times b cubed, so they cannot be equal, therefore the cube root of 2 must be irrational.

The root of an integer value is either an integer or irrational

We know that the square root of a positive integer is sometimes an integer, and sometimes not. When the result is not an integer, we have seen that it might be an irrational number.

We can go further than that, and say that the result will always be either an integer or an irrational number. That is to say, it cannot possibly be a rational fraction.

We can prove this for the general case:

Integer or irrational

Let's assume a/b has been reduced to its simplest form, so that a and b have no common factors other than 1. Then we raise both sides to the power W:

Integer or irrational

Now since n is a positive integer, and since a and b have no common factors, then b must equal 1, otherwise n would not be an integer. Therefore, the positive integer w root of a positive integer n cannot be a rational fraction.

So it can only be either an integer or an irrational number.

See also



Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

adder adjacency matrix alu and gate angle area argand diagram binary maths cartesian equation chain rule chord circle cofactor combinations complex modulus complex polygon complex power complex root cosh cosine cosine rule cpu cube decagon demorgans law derivative determinant diagonal directrix dodecagon eigenvalue eigenvector ellipse equilateral triangle euler eulers formula exponent exponential exterior angle first principles flip-flop focus gabriels horn gradient graph hendecagon heptagon hexagon horizontal hyperbola hyperbolic function hyperbolic functions infinity integration by parts integration by substitution interior angle inverse hyperbolic function inverse matrix irrational irregular polygon isosceles trapezium isosceles triangle kite koch curve l system line integral locus maclaurin series major axis matrix matrix algebra mean minor axis nand gate newton raphson method nonagon nor gate normal normal distribution not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutations polar coordinates polynomial power probability probability distribution product rule proof pythagoras proof quadrilateral radians radius rectangle regular polygon rhombus root sech set set-reset flip-flop sine sine rule sinh sloping lines solving equations solving triangles square standard curves standard deviation star polygon statistics straight line graphs surface of revolution symmetry tangent tanh transformation transformations trapezium triangle turtle graphics variance vertical volume volume of revolution xnor gate xor gate