Error in understanding the theorem about the invertibility of an element(coset) of a quotient ring

There's a theorem in Abstract Algebra which states that:

An element of a quotient ring $\mathbb{Z}/\langle n \rangle$ or $\mathbb{Z_n}$ that is a coset $\overline{a}$ is invertible iff $a$ and $n$ are relatively prime.

I'm having problem understanding this theorem.

My confusion is: can't there be situations where $a$ and/or $n$ are not primes but $\overline{a}$ is invertible.

I know I'm wrong but I like to know where I'm wrong.

Suppose there's an ideal of $\mathbb{Z}$ which is $\langle 6 \rangle$

Now here $n$ which is $6$ is not prime.

An element(one of the coset) of quotient ring $\mathbb{Z_6}$ is:

$$\overline{4} = \langle 6 \rangle + 4 = \{ \cdots, -8, -2, 4, 10, 16, \cdots \}$$

Here take a number from this set:

Say $4$ but $4$ is invertible in the sense that $4 - 4 = 0$ so it's inverse is $-4$ and $4$ is not prime.

Why's this invertible?

Can anyone kindly tell me the error in my thought process?

• you gotta think multiplicatively, so gonna make sense – janmarqz Jun 4 '13 at 19:57
• Inverse in this context is the multiplicative inverse. – Ayman Hourieh Jun 4 '13 at 19:57
• Also keep in mind that $a$ and $n$ being relatively prime is very different from $a$ and $n$ being prime. – Alex Becker Jun 4 '13 at 20:02

can't there be situations where $a$ and/or $n$ are not primes but $\overline a$ is invertible.
Relatively prime does not mean that the numbers themselves are prime. Integers $a$ and $n$ are said to be relatively prime if their greatest common divisor is $1$.
Also, the type of invertibility that the theorem you quote is talking about is multiplicative invertibility. It's true of every number that $a - a = 0$, but it's not always true that there's a $b$ such that $ab = 1 \pmod n$. That happens if and only if $a$ and $n$ are relatively prime.