Why contrapositive is wrong for the proof: if $x$ is irrational, then $\sqrt{x}$ is irrational

Prove or disprove: If $$x$$ is irrational, then $$\sqrt{x}$$ is irrational.

$$p:\:x$$ is irrational

$$q: \:\sqrt{x}$$ is irrational

Prove by contrapositive: $$(p \Rightarrow q) \iff (\lnot q \Rightarrow \lnot p)$$

Proof: Suppose $$\sqrt{x}$$ is rational, let $$\sqrt{x}=\frac{m}{n}$$ for some integer $$m, n$$, and $$n \ne 0$$.
Then, $$x= (\sqrt{x})^2 = \frac{m^2}{n^2}$$. Since $$m, n$$ are integers, then $$\frac{m^2}{n^2}$$, so, $$x$$ is rational. $$\blacksquare$$

What is wrong with this proof?
Someone gave a counterexample: let $$x=-\sqrt{2}$$, then $$\sqrt{x}$$ is not a real number. Hence, irrational. But, my contrapositive proof seems perfectly fine though.

• Your proof assumes that $\sqrt x$ is defined in $\mathbb R$ which means you are assuming that $x\geq 0$. In this case your proof is valid. When $x<0$ there are two square roots of $x$. With either one of the square roots your argument is still valid. – Kavi Rama Murthy Oct 23 '20 at 23:13
• @Kavi The premise p that $\sqrt x$ is rational requires $x\geq 0$ to be true. And as the OP proved, in that case, q is also true, so the implication (contrapositive) is true. If $x\lt 0$, $\sqrt x$ is clearly not rational, and in that case, then the contrapositive is trivially true, because a false premise p means $p\to q$ is true, no matter the truth of q. – amWhy Oct 23 '20 at 23:22
• No, the proof is fine. If $\sqrt{x}$ is rational, however you define $\sqrt{x}$, then $x$ must be rational as well. Note that $a^2$ is well-defined for any $a \in \mathbb{C}$. Meanwhile $x=-\sqrt{2}$ is not a counterexample for the proof the OP gave, for that matter neither would $x=-2$ be either. – Mike Oct 23 '20 at 23:27
• That someone in my post is the instructor's solution. Maybe he is wrong? – user13985 Oct 23 '20 at 23:30
• @Kavi do you not understand that an implication $a\to b$ is true whenever a is false? – amWhy Oct 23 '20 at 23:39

Usually "irrational" is only attributed to real numbers. Thus, for negative $$x$$, property $$(q)$$ is undefined and it does not make sense to prove $$(p) \Rightarrow (q)$$ for all $$x \in \mathbb R$$.

You should replace $$(q)$$ by

$$(q')$$ If $$y$$ is real number such that $$y^2 = x$$, then $$y$$ is irrational.

Then you proof is correct, but $$x = - \sqrt 2$$ is no longer a counterexample.

• I guess you meant: if the problem had another condition "$\sqrt{x}$ must be a real number", then my proof is correct? – user13985 Oct 24 '20 at 20:05
• @user13985 Yes, that is true! – Paul Frost Oct 24 '20 at 22:28
• Thanks, accepted! – user13985 Oct 26 '20 at 15:11

We wish to prove or disprove $$\text{If } x \text{ is irrational, then } \sqrt{x}\text{ is irrational.}\tag{1}$$

To disprove it, we need only find a counterexample:

$$\text{There exists an }x \text{ such that } x \text{ is irrational and }\sqrt{x}\text{ is not irrational.}$$

A contrapositive proof aims to show that no such counterexample exists.

$$\text{For all }x \text{, if } \sqrt{x}\text{ is not irrational, then }x\text{ is not irrational.}\tag{2}$$

Statement $$(2)$$ is completely equivalent to statement $$(1)$$. Your proof of $$(2)$$ is valid and thus your proof of $$(1)$$ is complete.

What if not irrational $$\not =$$ rational?

There is some discussion in the comments about whether imaginary numbers are irrational or not. If imaginary numbers are irrational then, in the domain of complex numbers, the complement of the irrationals is still the rationals. Your proof remains valid. If imaginary numbers are not irrational then the given example is actually a counterexample to (and disproof of) both $$(1)$$ and $$(2)$$. Hopefully your professor's proof wasn't much longer than his counterexample.

• The "somone" in my post was the professor. He gave the counterexample, rather than proving it. That's why I felt so strange about myself. – user13985 Oct 24 '20 at 4:19
• Both rational and irrational numbers are in $\mathbb{R}$ according to this post math.stackexchange.com/a/823981/44802. Assuming that, then my proof is perhaps wrong. And the counterexample "If $x=-\sqrt{2}$, then $\sqrt{x}$ is imaginary" is valid to disprove. – user13985 Oct 24 '20 at 19:30

An irrational number by definition is a real number that is not rational. $$x=−\sqrt 2$$ is irrational because it is real and not rational. But $$\sqrt x$$ in this case is not real. Hence it is not an irrational number. So it is a valid counterexample. The statement "x is irrational" is equivalent to "x is real and x is not rational". Hence its negation is actually "x is not real or x is rational"

If I label the set of irrational numbers as: $$I = \mathbb{R}$$\ $$\mathbb{Q}$$

Then we can rewrite your initial statement as:

$$x \in I \implies \sqrt x \in I$$

The contrapositive is:

$$\sqrt x \notin I \implies x \notin I$$

We can see that $$x = -\sqrt 2$$ is a valid counterexample to these two equivalent statements.

• That's what I am thinking, but people here on SE seems to say the proof is right and counterexample is not needed. – user13985 Oct 24 '20 at 19:32