TITLE: Equivalence relation in finite subset of $\mathbb N$
QUESTION [6 upvotes]: Let $R$ be the relation in $A:=\{1,2,3,...,23,24,25\}$ defined as $nRm$ $\iff$ $nm$ is a square number in $\mathbb N$. Prove that $R$ is an equivalence relation and determine the partition in $A$ defined by the relation $R$.
I am having problems with two parts of the exercise: 1) proving transitivity and determining the partition. So here's what I've done so far:
If a relation $R$ is reflexive, symmetric and transitive then $R$ is an equivalence relation. So I have to prove that $R$ is reflexive, symmetric and transitive.
Reflexivity: Let $n \in \mathbb A$, $nRn \iff nn$ is a square natural number. But $nn=n^2$ which is a square number and is natural by closure of multiplication in $\mathbb N$.
Symmetry: Let $n,m$ $\in A$. Suppose $nRm \implies nm$ is a square natural number. But $nm=mn$, which means $mn$ is a square natural number $\implies$ $mRn$.
Transitivity: Let $n,m,p \in A$ and suppose $nRm$ and $mRp$, this means $nm=s^2$ and $mp=t^2$. Then $m \vert s^2$ and $m\vert t^2$ so $np=\frac{s^2t^2} {m^2} \in \mathbb N$. I couldn't prove that $np$ is a square number.
For the last part of the exercise, I could figure out the partition but the problem is that I don't know how to formally justify my result. For $1$,$1Rn \implies 1n=n$ is a natural square number. By this condition it's immediate that $\overline 1=\{1,4,9,16,25\}$. For $2$, $2Rn \implies 2n$ is a square natural number. Well, I could see that $\overline 2=\{2,,8,18\}$. I don't know how to put it in symbols that this has to be the equivalent class $2$. Similarly, I had problems to justify all the other equivalent set classes. For example, $6=\{6,24\}$ and for any $p \in A$ with p a prime greater than $5$, I got that $\overline p=\{p\}$. Could someone help me to explain it correctly and in mathematical language?

REPLY [5 votes]: You're almost done.
For $np$, you have that
$$np=\left(\frac{st}m\right)^2$$
and that $m^2\,|\,s^2t^2$. If you write it up using prime factorization of all entities, you will find, that it implies $m\,|\,st$, so that $st/m\in\Bbb N$, and that $np$ is thus a square number.
For the other part, I guess, it is enough just to write up the concrete equivalence classes in $A$, as you started.

REPLY [5 votes]: First of all, just a little nit picking: $\mathbb{N}$ isn't a group, and the set you defined certainly isn't a subgroup. It is a subset though. 
With that out of the way, let's prove transitivity. Using your notation, we have that
$$np=\frac{(nm)(mp)}{m^2}=\frac{s^2t^2}{m^2}=\left(\frac{st}{m}\right)^2.$$
We know that this is a natural number, since $np$ is natural. Now, it is easy to prove that if a positive rational number squared is natural, then the rational number itself is natural. Therefore $st/m$ is natural and so $np$ is the square of $st/m$.
Your analysis of the partition is good. Let's see what happens to the partition that contains a number $r$. Write $r=p_1^{r_1}\cdots p_s^{r_s}$ as the decomposition of $r$ into prime factors. Then $n=p_1^{n_1}\cdots p_s^{n_s}$ (by assuming that $r_i$ and $n_i$ could possibly be 0, we can assume they have the same factors). So 
$$rn=p_1^{n_1+r_1}\cdots p_s^{n_s+r_s},$$
and this is square if and only if $2\mid n_i+s_i$ for all $i$. So, for example, if you have a prime number $p$, then the partition that contains $p$ is going to consist of all numbers that have $p$ as a factor with an odd exponent, and such that all the other primes appear with an even exponent. I don't know how much more explicit one can be....