Q:

Question about a specific part of proving $\sqrt 7$ is irrational

I have a question that wants me to prove that the square root of $7$ is irrational. So I know we need to use proof by contradiction, then $7 = \frac{a^2}{b^2}$ where $a$ and $b$ are coprime. Then $a^2 = 7b^2$. So $7$ is a factor of $a^2$. Therefore $7$ is a factor of $a$. So $a$ can be written in the form of $a = 7k$ and so on.
My question is, to answer this question, aren't we supposed to prove that if $7$ is a factor $a^2$ then $7$ is a factor of $a$, in order to proceed onto the next step? If so, how would we go about proving that? If proving it is unnecessary, why is that so? I've seen such questions answered so many times in the exact same method, and it is always assumed that if $x$ is a factor of $a^2$ then $x$ is a factor of $a$.

A:

It has been assumed it has been proven and the student accepts that if $p$ is prime and $p|ab$ then either $p|a$ or $p|b$. (Thus as $7$ is prime and $7|a \times a$ then $7|a$ or ...   $7|a$.)
Proof: The unique prime factorization theorem states that $a$ and $b$ have unique prime factorizations. Either i)$p$ is a factor of $a$ or ii) $p$ is a factor of $b$ iii) $p$ is a factor of both $a$ and $b$ or iv) $p$ is not a factor of either. We need to show iv) is not possible.
$ab$ has a unique factorization and it is simply the product of the unique prime factors of $a$ times the unique factors of $b$. So if $p$ is not a prime factor of either $a$ or $b$ it will not be a factor of $ab$ whose prime factors are just the combined collection of the prime factors of $a$ and $b$. So if $p\not \mid a$ and $p\not \mid b$ then $p \not \mid ab$.
In other words iv) is impossible.
====
Note for this result $p$ MUST be prime. If $x = pq$, and $a = pm$ and $b = qn$ then $x|ab$ but $x \not \mid ab$ (in general).
====
So how the prove the unique prime factorization theorem?...  Oh, I'll let you Google that. 

