decomposing a factor group into a direct sum of cyclic groups

Let $\mathbb{Z}_n ^*$ be the set of all units in $\mathbb{Z}_n$ and $(\mathbb{Z}_n ^*)^2$ = $\{ a^2 | a \in \mathbb{Z}_n ^*\} $

Then, decompose the factor group $\mathbb{Z}_n ^* / (\mathbb{Z}_n ^*)^2$

1.when $n$ is an odd prime

2.when $n$ is a product of two distinct odd primes $p, q$

I solved the first as following: In $\mathbb{Z}_p$, since $x^2=(p-x)^2$ holds, the order of $(\mathbb{Z}_n ^*)^2$ is exactly the half of that of $\mathbb{Z}_n ^*$.

Thus, the answer is $\mathbb{Z}_2$.

However the second is more complicated. I didn't know that. Please help me to solve this.


Hints:

With your notation:

$$\Bbb Z_{pq}^*=\Bbb Z^*_p\times\Bbb Z^*_q$$

The above's based on the well known property of Euler's Totient Function

$$\phi(pq)=\phi(p)\phi(q)=(p-1)(q-1)$$


$\mathbb{Z}_{pq}^\ast = \mathbb{Z}_p^\ast \times \mathbb{Z}_q^\ast$, and $(\mathbb{Z}_{pq}^\ast)^2 = (\mathbb{Z}_p^\ast)^2 \times (\mathbb{Z}_q^\ast)^2$.