This is proved by a reductio in absurdum, i. e. by assuming
that the opposite is true, and showing that this leads to a logical
contradiction.
Let the square root of two, assumed to be a fraction, be = p/q, where
p is the numerator and q the denominator of the fraction. The fraction
is assumed to have been reduced to its simplest form, so that there
are no common factors between p and q. (For instance 3/12 would already
have been simplified to 1/4.)
Then p2/q2 = 2 by definition, or p2
= 2q2.
This means that p2 is an even number (a multiple of 2).
In that case p itself must be an even number, for if it were
an odd number, then p2 would also be an odd number. So let
us write p = 2r, where r is an integer.
We now have 4r2 = 2q2, or 2r2 = q2.
So by the same argument that led us to conclude that p was an even number,
q must be an even number. But this means that both p and q are
divisible by 2, which contradicts our initial assumption.
So the square root of 2 cannot be a fraction.