Spivak Calculus 4-th Ed., Chapter 2, Exercise 13a, Understanding the proof of $\sqrt3$ being irrational. Problem Statement:
Prove that $\sqrt3$ is irrational. Hint: To treat $\sqrt3$, for example, use the fact that every integer is of the form $3n$, $3n+1$ or $3n+2$.
Solution from the "Answers" Chapter:
Since
$$
\\
(3n+1)^2 = 9n^2 +6n + 1 = 3(3n^2+2n)+1
\\
(3n+2)^2 = 9n^2 +12n + 4 = 3(3n^2+4n +1)+1
$$
He proceeds then to state that if $k^2$ is divisible by 3, then so is $k$.
I have a hard time understanding what $k$ he is talking about in these equations, it hasn't been defined earlier. He then proceeds:
Supose $\sqrt3$ were rational, and let $\sqrt3 = p/q$, where $p$ and $q$ have no common factor. Then $p^2=3q^2$, so $p^2$ is divisible by 3, so $p$ must be. Thus, $p=3p'$ for some natural number $p'$ and consequently $(3p')^2=3q^2$, or $3(p')^2=q^2$. Thus, $q$ is also divisible by 3, a contradiction.
I have a hard time linking the first part where he states that "$k^2$ being divisible by 3 leads to $k$ being divisible by 3" and the second part. Where does the first conclusion come from?
NOTE:
Problem statement in the book in the same manner requests the proof of $\sqrt5$ and $\sqrt6$ being irrational. However, in this question I'm interested in the proof for the case of $\sqrt3$.
 A: Let $k$ be an integer. It can take one of the following forms: $3n$ or $3n+1$ or $3n+2$ where $n$ is simply the quotient in the euclidean division of $k$ by $3$.
Now:


*

*if $k=3n$ then $k^2 = 9n^2$

*if $k=3n+1$, then $k^2 = 3\times ... +1$ (we don't really care of the exact value of $...$), thus $k^2$ isn't multiple of $3$

*if $k=3n+2$, then $k^2 = 3\times ... +1$, thus $k^2$ isn't multiple of $3$.


Thus, if $k^2$ is multiple of 3, then $k$ can't be of the form $3n+1$ or $3n+2$. Hence, it must be of the form $3n$, that is, $k$ must be multiple of 3.
Hence, if $k^2$ is multiple of $3$, then $k$ is also multiple of $3$.
A: The state ment

If $k^2$ is divisible by $3$ then so is $k$.

holds for all integers $k$. He uses this fact below for $k=p$ and for $k=q$.
A: In the first part, Spivak proves that of a number is not a multiple of $3$ (that is, if it is of the type $3n+1$ or $3n+2$), then its square is not a multiple of $3$. Therefore, if the square is a multiple of $3$, then the number itself must be a multiple of $3$ too.
