So I have a group of order $p^2$ (where $p$ is a prime number) and I'm wondering how many subgroups it can have. By Lagrange's theorem I know that if a subgroup exists its order has to divide the order of the group i.e. $p^2$ in other words it has to be of order $1$, $p$ or $p^2$. Of order $1$ we have only the trivial group and of order $p^2$ the group itself while the existence of subgroups of order $p$ is enstablished by Cauchy's theorem but how many of them are there?
I tried to reduce the problem to a combinatorial one however I'm not too familiar with this branch. I reasoned as it follows:
i) I have to choose $p$ element from a set which has $p^2$
ii) the unit must be in the subgroup so we have only to choose $p-1$ elements from a set which has $p^2-1$
iii) for every element the inverse must be in the subgroup so we have only to choose $\frac {p-1}2$ elements (if $p\neq 2$) from a set which has $p^2-1$
iv) for every two elements their composition must be in the subgroup however I don't know how to use this fact and so I don't know how to end the problem. Maybe using the criterion for subgroups can shorten the computation but I'm not sure how to use it.
Tell me if my reasoning is correct and how I should end this exercise
The reasoning is correct, but (iv) is where all the real power is, and what will ultimately lead you forward. If you consider one non-identity element of the subgroup, and keep composing it with itself, it must generate more elements of the subgroup. So ultimately it generates a subgroup (of unknown order k), of the subgroup (of order p). By Lagrange's Theorem again, k=1 or k=p, and we deliberately ruled out the former. Thus this one element must generate the whole subgroup of order p.
So if you pick just one element of order p from the original group, then you get a subgroup. There are p-1 such elements for each subgroup of order p. So if there are k elements of order p on the group, then there are k/(p-1) subgroups of order p, or k/(p-1)+2 subgroups total. Now you just need to count elements of order p in the group.