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.
 A: 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.
A: 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.
A: 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.
