The elements of #ZZ_8# are #hat 0#, #hat 1#, #hat 2#, #hat 3#. #hat 4#, #hat 5#, #hat 6# and #hat 7#. Now:

The inverse of #hat 1# is the same #hat 1# since #hat 1# * #hat 1# = #hat 1#. Similarly:

The inverse of #hat 3# is the same #hat 3# since #hat 3# * #hat 3# = #hat 1#

The inverse of #hat 5# is the same #hat 5# since #hat 5# * #hat 5# = #hat 1#

The inverse of #hat 7# is the same #hat 7# since #hat 7# * #hat 7# = #hat 1#. So these elements are invertible.

Now, let's consider #hat 2#. The possible products are:

#hat 2# * #hat 0# = #hat 0#

#hat 2# * #hat 1# = #hat 2#

#hat 2# * #hat 2# = #hat 4#

#hat 2# * #hat 3# = #hat 6#

#hat 2# * #hat 4# = #hat 0#

#hat 2# * #hat 5# = #hat 2#

#hat 2# * #hat 6# = #hat 4#

#hat 2# * #hat 7# = #hat 6#

We can see that no product gives us #hat 1#. The same way we can prove that #hat 4# and #hat 6# have no inverses. By definition #hat 0# is not invertible.

Therefore, the only invertible elements are #hat 1#, #hat 3#, #hat 5# and #hat 7#

In general terms, invertible elements in these rings are the ones coprime with the order (8 in this case) of the ring