Explain the proof that the root of a prime number is an irrational number Though the proof of this is done in a previous question, I have some doubt about  a certain concept. So I ask to clarify it.  
In the proof we say that $\sqrt{p} = \frac{a}{b}$ (In their lowest form).
Now 
$$p = a^2 / b^2\\p\cdot b^2 = a^2.$$
Hence $p$ divides $a^2$ so $p$ divides $a$. We say that the above mentioned condition ("Hence $p$ divides $a^2$ so $p$ divides $a$") is valid as $p$ is a prime number. I didn't get the fact that why this is only true for prime numbers. Could someone please me this?
 A: What is used in the proof is: IF $p$ is prime THEN "$p$ divides $a^2$ so $p$ divides $a$". 
It is not claimed (nor used) that only prime numbers have this property. 
In fact, if $p$ is the product of distinct prime number then it is also true that "$p$ divides $a^2$ so $p$ divides $a$". This fact can be used to prove, for instance, that $\sqrt{6}$ is irrational. 
A: The square root of a positive integer $n$ is either a positive integer or irrational. To see this, suppose $n=\left(\frac pq\right)^2$ where $p,q\in\mathbb Z$, $p,q>0$, and $\gcd(p,q)=1$. Then $p\nmid q$, and $q\nmid p$, so $p^2\nmid q^2$ and $q^2\nmid p^2$ (this is easy to see from the prime factorizations). This implies that $\left(\frac pq\right)^2$ is not an integer, a contradiction.
(And clearly a prime number does not have an integer as a square root.)
A: The prime numbers have the following property:
If $p$ is prime and $a, b$ are integers such that $p \mid ab$ then either $p \mid a$ or $p \mid b$.
Here in the question the case $a = b$ has been used. The above property can be proved using the concept of GCD (greatest common divisor). The property does not hold if $p$ is not a prime number. For example $6 \mid 3\cdot 4$ but $6$ does not divide any of $3$ and $4$.
On the other if we deal with the specific statement
If $ p \mid a^{2}$ then $p \mid a$.
then this statement is true even if $p$ is not a prime but a product of distinct primes. This can be handled via the prime factorization of $a$. Suppose $p$ is a product of distinct primes and assume on the contrary that $p \nmid a$. It means that some of the prime factors of $p$ are not prime factors of $a$. Now $a^{2}$ has same prime factors as $a$ but repeated twice. Hence as before there will some prime factors of $p$ which are not a factor of $a^{2}$. So $p \nmid a^{2}$.

On the other hand we don't need so much complication in proving irrationality of certain square roots of integers.
If $n$ is a positive integer which is not a perfect square then $\sqrt{n}$ is irrational.
We can prove the above easily by assuming the contrary that $\sqrt{n} = a/b$ where $a, b$ are positive integers with no common factors between them and $b > 1$. So by "unique factorization theorem" $a$ and $b$ have different prime factors. Hence it follows that any powers of $a$ and $b$ have different prime factors.
Now on squaring we get $n = a^{2}/b^{2}$. Since $a^{2}$ and $b^{2}$ have different prime factors and $b > 1$ it follows that $a^{2}/b^{2}$ is not an integer whereas $n$ is an integer. This contradiction shows that $\sqrt{n}$ is irrational.
