Assume that
$$3 = \frac{p^2}{q^2}$$
So,
$$ 3 q^2 = p^2$$
So $p^2$ is divisible by $3$. How we can conclude this?
Assume that
$$3 = \frac{p^2}{q^2}$$
So,
$$ 3 q^2 = p^2$$
So $p^2$ is divisible by $3$. How we can conclude this?
Since $p$ is divisible by $3$, it is $3$ times some number, let's say $m$. Then we substitute, and we get $$ 3q^2 = (3m)^2 = 9m^2 $$ $$ q^2 = 3m^2 $$ Now $q$ has to be divisible by 3, so by the same argument, for some $n$, $$ (3n)^2 = 3m^2 $$ $$ 3n^2 = m^2 $$ And then you can keep dividing by $3$ indefinetely, and still end up with integers, but this is a contradiction, so there can be no such $p$ and $q$ in the first place.
$p^2$ is divisible by 3 because $p^2 = 3 q^2$, and $3 q^2$ is divisible by 3.
Any rational number can be expressed as $\frac P Q$ where $P,Q$ are integers and $Q\ne 0$. Now, we can always find $p,q$ such that $\frac P p=\frac Q q=\gcd(P,Q)\implies \gcd(p,q)=1$
Let $\sqrt 3=\frac p q\implies p^2=3q^2\implies 3\mid p^2\implies 3\mid p$ So, $p=3r$(say) for some integer $r$, So, $3q^2=9p^2\implies q^2=3r^2\implies 3\mid q\implies 3\mid \gcd(p,q)$, but $\gcd(p,q)=1$
Since $p^2 = 3q^2$, then $p^2$ is a multiple of $3$, and therefore divisible by $3$. To go further, from this now you see $p$ is divisible by $3$. Therefore $p = 3a$ for some integer $a$. Now, substituting back into your original equation you have $9a^2 = 3q^2 \rightarrow 3a^2 = q^2$. By the same exact reasoning as above, then you have $q$ is divisible by $3$. And hence, $gcd(p,q) \neq 1$. This is a contradiction!!
Every number can be written uniquely as the product of primes, since $3q^2 = p^2$ their representation as the product of the primes must be the same, and since 3 is in the representation of the left hand side, it must also be in the representation of the right hand side, $p^2$ and so it divides $p^2$