# Prove that the square root of a positive integer is either an integer or irrational

Is my proof that the square root of a positive integer is either an integer or an irrational number correct?

The proof goes like this:

Suppose an arbitrary number n, where n is non-negative. If $\sqrt{n}$ is an integer, then $\sqrt{n}$ must be rational. Since $\sqrt{n}$ is an integer, we can conclude that n is a square number, that is for some integer a. Therefore, if n is a square number, then $\sqrt{n}$ is rational.

Suppose now that n is not a square number, we want to show that the square root of any non-square number is irrational.

We prove by contradiction. That is, we suppose that the square root of any non-square number is rational. So $\sqrt{n} = \frac{a}{b}$, where $a,b \in Z^+, b \neq 0$. We also suppose that $a \neq 0$, otherwise $\frac ab = 0$ , and n will be a square number, which is rational.

Hence $n = \frac {a^2}{b^2}$, so $nb^2 = a^2$.

Suppose $b=1$. Then $\sqrt n = a$ , which shows that n is a square number. So $b \neq 1$. Since $\sqrt n > 1$, then $a>b>1$.

By the unique factorization of integers theorem, every positive integer greater than $1$ can be expressed as the product of its primes. Therefore, we can write $a$ as a product of primes and for every prime number that exists in $a$, there will be an even number of primes in $a^2$. Similarly, we can express $b$ as a product of primes and for every prime number that exists in $b$, there will be an even number of primes in $b^2$.

However, we can also express $n$ as a product of primes. Since $n$ is not a square number, then there exist at least one prime number that has an odd number of primes. Therefore, there exists at least one prime in the product of $nb^2$ that has an odd number of primes. Since $nb^2=a^2$ , then this contradicts the fact that there is an even number of primes in $a^2$ since a number can neither be even and odd.

Therefore, this contradicts the fact that $\sqrt n$ is rational. Therefore, $\sqrt n$ must be irrational.

Is this sufficient? Or is there any parts I did not explain well?

• I think its correct and very well explained. Jan 30, 2017 at 14:25
• It's a bit wordy, but logically you've got a solid proof, the even-ness of the powers of each prime is exactly what you're going for. Jan 30, 2017 at 14:26
• The conclusion is not precise enough. Instead of "contradicts there is an even number of primes in $a^2$" we want to say that it contradicts the fact that the prime $p$ occurs to odd power in the unique factorization of $nb^2,\,$ but even power in $a^2,\,$ i.e. we are comparing the parity of the count of single prime, not the total of all primes Jan 30, 2017 at 14:28
• For example the argument shows that $\,\sqrt{3\cdot 5}\,$ is irrational because $\,3\,$ occurs to odd power in $\,3\cdot 5,\,$ but the total number of primes in $\,3\cdot 5\,$ is even. Jan 30, 2017 at 14:37
• On a side note, this result is known as Theaetetus' Theorem, and it's proven in Euclid's Elements here: aleph0.clarku.edu/~djoyce/elements/bookX/propX9.html "[S]quares which do not have to one another the ratio which a square number has to a square number also do not have their sides commensurable in length either." Jan 30, 2017 at 14:41

Your proof is very good and stated well. I think it can be made shorter and tighter with a little less exposition of the obvious. However, I would prefer students to err on the side of more rather than less so I can't chide you for being thorough. But if you want a critique:

"Suppose an arbitrary number n, where n is non-negative. If $\sqrt{n}$ is an integer, then $\sqrt{n}$ must be rational. Since $\sqrt{n}$ is an integer, we can conclude that n is a square number, that is for some integer a. Therefore, if n is a square number, then $\sqrt{n}$ is rational."

Suppose now that n is not a square number, we want to show that the square root of any non-square number is irrational.

This can all be said more simply and to argue that if $\sqrt{n}$ is an integer we can conclude $\sqrt{n}$ is rational or that $n$ is therefore a perfect square, is a little heavy handed. Those are definitions and go without saying. However, it shows good insight and understanding to be aware one can assume things and all claims need justification so I can't really call this "wrong".

But it'd be enough to say. "If $n$ is a perfect square then $\sqrt{n}$ is a an integer and therefore rational, so it suffices to prove that if $n$ is not a perfect square, then $\sqrt{n}$ is irrational.

We prove by contradiction. That is, we suppose that the square root of any non-square number is rational. So $\sqrt{n}$=ab , where a,b∈Z+,b≠0. We also suppose that a≠0, otherwise ab=0, and n will be a square number, which is rational.

Terminologistically, to say "$n$ is a square number" is to mean $n$ is the square of an integer. If $n = (\frac ab)^2$ we don't usually refer to $n$ as a square (although it is "a square of a rational") We'd never call $13$ a square because $13 = (\sqrt{13})^2$.

Also you don't make the usual specification that $a$ and $b$ have no common factors. As it turns out you didn't need to but it is a standard.

Suppose b=1 . Then $\sqrt{n}$=a , which shows that n is a square number. So b≠1. Since $\sqrt{n}$>1, then a>b>1

This was redundant as $b=1 \implies$ $a/b$ is an integer and we are assuming that $n$ is not a perfect square.

.

By the unique factorization of integers theorem, every positive integer greater than 1 can be expressed as the product of its primes. Therefore, we can write a as a product of primes and for every prime number that exists in a, there will be an even number of primes in a2. Similarly, we can express b as a product of primes and for every prime number that exists in b, there will be an even number of primes in b2

Bill Dubuque in the comments noted what you meant to say was "each prime factor will be raised to any even power".

.

However, we can also express n as a product of primes. Since n is not a square number, then there exist at least one prime number that has an odd number of primes. Therefore, there exists at least one prime in the product of nb2 that has an odd number of primes. Since nb2=a2 , then this contradicts the fact that there is an even number of primes in a2 since a number can neither be even and odd.

Ditto:

Overall I think your proof is very good.

But I should point out there is a simpler one:

Assume $n = \frac {a^2}{b^2}$ where $a,b$ are positive integers with no common factors (other than 1). If $p$ is a prime factor of $b$ and $n$ is an integer, it follows that $p$ is a prime factor of $a^2$ and therefore of $a$. But that contradicts $a$ and $b$ having no common factors. So $b$ can not have any prime factors. But the only positive integer without prime factors is $1$ so $b = 1$ and $n= a^2$ so $\sqrt{n} = a$. So either for any integer either $n$ is a perfect square with an integer square root, or $n$ does not have a rational square root.

And a slight caveat: I'm assuming that your class or text is assuming that all real numbers have square roots (and therefore if there is not rational square root the square root must be irrational). It's worth pointing out, that it is a result of real analysis that speaking of a square root actually makes any sense and that we can claim every positive real number actually does have same square root value. But that's probably beyond the range of this exercise.

But if I want to be completely accurate, you (and I) have actually only proven that positive integer $n$ either has an integer square root or it has no rational square root at all. Which is the same thing as saying if positive integer $n$ has a square root, the root is either integer or irrational. But we have not actually proven that positive integer $n$ actually has any square root at all.

• Thank you for the critique! It definitely helped me a lot! Jan 31, 2017 at 11:00
• Can you explain or state a case where we cannot find the square root of a positive integer $n$ (as you state in the last line)? Apr 15, 2017 at 12:56
• I didn't say there are positive integers without square roots. (There aren't.) I said we haven''t proven that the square root of any integer exists. And we haven't. To prove that we have to prove that $K = \{q \in \mathbb Q| q^2 < n\}$ is not empty, and bounded above and that if $z = \sup K$ then $z^2 - n$. All we have proven so far is that either there is an integer so that $m^2 = n$ or there is no rational $q$ so that $q^2 = n$. We have not proven that there is an irrational $z$ so that $z^2 = n$. Apr 15, 2017 at 15:54
• If $n$ can not be written as $\frac {a^2}{b^2}$ then, by definition, $n$ does not have a rational square root. If $n$ has a rational square root then that rational square root can be written as $\frac ab$. That is what rational means. And if the square root is $\frac ab$ then $n = (\frac ab)^2 =\frac {a^2}{b^2}$. That is what square root means. So if $n$ can't be written that way then it does not have a rational square root. For example: $3$ can not be written that way and does not have a rational square root. Neither does ANY other non-square. Jan 21, 2019 at 22:31
• This is a prove that IF a square root is rational then it must be an integer. We are not concerned about irrational square root (not even to the extent of questioning whether they exist). And IF a square root is rational it can be written as $\frac ab$. Which means $n$ can be written as $\frac {a^2}{b^2}$. If it can't be, then it does not have a rational square root. Jan 21, 2019 at 22:35

I arrived at this classical problem by following the links provided in the "duplicate" marks, starting with this question, and then finally resorting to searching for questions addressing the fact that $$\sqrt b \notin \Bbb Q$$ unless $$0 \ne b \in \Bbb N$$ is a perfect square. I wanted a proof which as much as possible stuck to the basics, avoiding even such august results as the fundamental theorem of arithmetic, and I wanted to generalize to $$\sqrt[n]b, n \ge 2$$. So this is what I got:

Note: For the present purposes, I assume we allow $$0 \in \Bbb N$$. End of Note.

Suppose

$$\sqrt [n] b = \dfrac{r}{s} \in \Bbb Q \setminus \Bbb Z, \; 2 \le n \in \Bbb N, \tag 1$$

with

$$\gcd(r, s) = 1; \tag 2$$

it then follows that

$$r > s > 1; \tag 3$$

from (1),

$$bs^n = r^n, \tag 4$$

whence

$$s \mid r^n; \tag 5$$

by (2),

$$\exists x,y \in \Bbb Z, \; xr + ys = 1; \tag 6$$

thus, multiplying by $$r^{n - 1}$$,

$$xr^n + ysr^{n - 1} = r^{n - 1}, \tag 7$$

which implies, via (5),

$$s \mid r^{n - 1}; \tag 8$$

now suppose we have

$$k \in \Bbb N, 0 \le k \le n - 2, \tag 9$$

with

$$xr^{n - k} + ysr^{n - k - 1} = r^{n - k - 1} \tag{10}$$

and

$$s \mid r^{n - k}; \tag{11}$$

then it follows from (10) and (11) that

$$s \mid r^{n - k - 1} = r^{n - (k + 1)} \tag{12}$$

and

$$xr^{n - k - 1} + ysr^{n - k - 2} = r^{n - k - 2}; \tag{13}$$

by induction we thus conclude

$$s \mid r^{n - k}, \; 0 \le k \le n - 1; \tag{14}$$

in particular, we have

$$s \mid r \Rightarrow \Leftarrow \gcd(r, s)= 1; \tag{15}$$

from this contradiction we infer that (1) is false, and hence that

$$\sqrt[n]b \in \Bbb R \setminus \Bbb Q, \tag{16}$$

that is, that $$\sqrt[n]b$$ is an irrational number.

• How did you get to (8) from (5) and (7)? I think I'm missing something obvious. Sep 21, 2019 at 12:29
• @Tanachat: From (5), $s \mid r^n$ and obviously $s \mid ysr^{n - 1}$, so $s$ must divide the sum of $xr^n$ and $ysr^{n - 1}$, which is $r^{n - 1}$ by (8). Sep 21, 2019 at 15:46

We know that $\sqrt{4} = 2$ and $\sqrt{2} = 1.414...$ are rational and irrational respectively, so all we have to do is to show that if $n\in \mathbb{Z+}$ such that $\sqrt{n} = \dfrac{a}{b}$ where $a$ and $b$ are positive integers and the expression $\dfrac{a}{b}$ is in its simplest form then $\sqrt{n}$ is integral. Squaring both sides of the expression we get that $n = \dfrac{a^2}{b^2}$ since $a$ and $b$ have no common factors other than $1$ then $a^2 = n$ and $b^2 = 1$ therefore $b = 1$ hence $\sqrt{n}$ if rational it's an integer.

• How is that a critique of the OP's proof? Jan 30, 2017 at 18:51
• The op shows (correctly) that the square root of a non square is irrational. There is no need to show that rational roots are integers. Assuming n is not square makes perfect sense and the case for square n's has been covered. Your objections are not valid. Meanwhile you post is just ... weird. What do $\sqrt 4$ and $\sqrt 2$ have to do with anything. And your statement $n = a^2/b^2$ implies $a^2 = n$ and $b^2 =1$ is said without justification when the justification is the entire point. And you are merely pointing out an easier proof. Which is not a valid critique. Jan 30, 2017 at 22:57

Let me offer an alternative proof. A generalisation of Euclid's lemma states that if $$n$$ divides $$ab$$ and $$n$$ is coprime to $$a$$, then $$n$$ divides $$b$$. Using this lemma, it is easy to prove directly that if $$x$$ is rational and $$x^2$$ is an integer, then $$x$$ is an integer.

Suppose that $$\left(\frac{p}{q}\right)^2=m$$, where $$p$$ and $$q$$ are coprime. Then $$p^2=mq^2$$, so $$q$$ divides $$p^2$$. By the above lemma, $$q$$ divides $$p$$. But $$p$$ and $$q$$ are coprime, so $$q=1$$ and $$m=p^2$$.