With,
$$U(n) = \lbrace k : (k, n) = 1 \space and \space 0 < k < n \rbrace.$$
For some $n$, each element of $U(n)$ will have itself as its own multiplicative inverse. As an example, for $n = 8$:
$$U(8) = \lbrace 1, 3, 5, 7 \rbrace$$ Inverse of $1, 3, 5, 7$ under multiplication modulo $8$ is respectively $1, 3, 5, 7$. And it is very weird, because in this case multiplication of $a$ with $b$ is same as division of $a$ with $b$.
My question is are there infinitely many $n$ such that $U(n)$ satisfies the property above? I wrote a script and tested this for all $n \lt 1000$ and found only the following solutions:
$$n = 1, 2, 3, 4, 6, 8, 12, 24$$
Are there any more solutions, or are they the only ones? How to show that?
You are asking for $k^2\equiv1\pmod n$ for all $k$ such that $(k,n)=1$.
Using any prime $p$ for $k$, this means either $n|p^2-1$ or $p|n$.
In particular, either $n|5^2-1=24$ or $5|n$.
If $5|n$ then $n$ does not divide $p^2-1$ for any $p\equiv2$ or $3\pmod5$,
so $p|n$ for all such $p$, which is absurd.