1. ## subgroups and cosets

Show that the nonzero elements in Z_n form a group under the product [a][b]=[ab] if and only if n is a prime. I know that they definitely do not form a group when n is not prime but I am not sure how to prove otherwise. Please show steps. Thank you!

2. ## Here is a start

What you are trying to show is that $\mathbb{Z}_p^{\times}$ is a group.

Multiplication is well defined and that is pretty easy to show. just show that $(a+pz)(b+py)=ab+apy+bpz+p^2yz = ab + p( ay + bz + pyz) \equiv ab (mod p)$
so it is closed under multiplication

You just gotta show it has an inverse. But this too is easy, if $0 \not = a\in \mathbb{Z}_p$, then you know p and a are relatively prime. Otherwise p would not be prime as a and p would share a divisor.

but this means there exist integers x and y so that
$ax+py=1$ but this tells you when you reduce mod p
$ax \equiv 1 (mod p)$
so x reduced mod p is the inverse of a. Thus you have shown it to be a group

3. Thank you sooo much! Very helpful!