$n \in \mathbb{N}$
Prove that if $3\mid n^2 $ then $3\mid n $
I want to prove this in a accepted formal way, I thought about the fact that every integer can be written as multiplication of prime numbers. and if we raise this integer to the power two we will get multiples of each prime. $3\mid n^2 $, it means that this $"3"$ must have been in $"n"$ before raising it to the power. I am going to the right direction? and if yes, can someone hint how can I write it formally?
Your proof is correct.
Every number $n$ has a unique decomposition in primes: $$ n = p_1^{k_1} p_2^{k_2} \dots p_m^{k_m} $$ hence $$ n^2 = p_1^{2k_1} p_2^{2k_2} \dots p_m^{2k_m}. $$ If 3 divides $n^2$ then one of the $p_i$s is equal to $3$ and the corresponding exponent $2k_i$ is different from zero. Hence $k_i$ is different from zero and also $n$ is divisible by 3.