The contradiction method used to prove that the square root of a prime is irrational The contradiction method given in certain books to prove that sqare root of a prime is irrational also shows that sqare root of $4$ is irrational, so how is it acceptable?
e.g. Suppose $\sqrt{4}$ is rational,
$$\begin{align}
       \sqrt{4} &=p/q        \qquad\text{where pand q are coprimes} \\
        4 &=p^2/q^2\\
      4q^2&=p^2       \tag{1} \\
         4&\mid p^2\\
         4&\mid p\\
     \text {let }p&=4m  \qquad\text{for some natural no. m}  \\
       p^2&=16m^2\\
      4q^2&=16m^2   \qquad\text{(from (1) )}\\
       q^2&=4m^2\\
         4& \mid q^2\\
         4&\mid q
\end{align}
$$
but this contradicts our assumption that $p$ and $q$ are coprime since they have a common factor $p$. Hence  $\sqrt{4}$ is not rational. But we know that it is a rational. Why?

The step from $4\mid p^2$ to $4\mid p$ is wrong.  For example, take $p=6$.  Then $4\mid 6^2$ but it is not true that $4\mid 6$.
In general, $q\mid p^2$ implies $q\mid p$ only for squarefree $q$.  A number $q$ is "squarefree" if it is not divisible by any square larger than 1.
