Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let $R$ be a ring. An element $x$ in $R$ is said to be idempotent if $x^2=x$. For a specific $n\in{\mathbb Z}_+$ which is not very large, say, $n=20$, one can calculate one by one to find that there are four idempotent elements: $x=0,1,5,16$. So here is my question:

Is there a general result which tells the number of the idempotent elements of ${\mathbb Z}_n$?

share|improve this question
(Number of prime factors)! +2 My observation! –  UNM Aug 11 '13 at 3:31

3 Answers 3

up vote 14 down vote accepted

If $n=p_1^{m_1}\cdots p_k^{m_k}$ is the factorization of $n$ as a product of powers of distinct primes, then the ring $\mathbb Z/n\mathbb Z$ is isomorphic to the product $\mathbb Z/p_1^{m_1}\mathbb Z\times\cdots\times \mathbb Z/p_k^{m_k}\mathbb Z$. It is easy to reduce the problem of counting idempotent elements in this direct product to counting them in each factor.

Can you do that?

share|improve this answer
I don't know much about abstract algebra but some basic definitions. I guess the idea is similar/related to the Fundamental Theorem of Finite Abelian Groups, isn't it? –  Jack Jun 16 '11 at 16:43
(I guess you mean the idea of the isomorphism I mentioned?) It is related to that. It is, in fact, a form of the Chinese Remainder Theorem (see Wikipedia, for example) –  Mariano Suárez-Alvarez Jun 16 '11 at 16:45
What do you mean by "counting them in each factor"? Do you mean counting the idempotent elements in each ${\bf Z}_{p_i^{m_i}}$ and then add them up? –  Jack Jun 16 '11 at 16:59
@Jack: I mean that if you know how many idempotents there are in each factor it is not hard to know how many idempotents there are in the product. This follows from the following simple observation: an element $(a,b)$ in a direct product of two rings $A\times B$ is idempotent if and only if $a$ is idempotent in $A$ and $b$ is idempotent in $B$. –  Mariano Suárez-Alvarez Jun 16 '11 at 17:02
Fair enough. Now I see. Thanks! –  Jack Jun 16 '11 at 17:06

In $\Bbb{Z}_n$ the relation $x^2=x$ is equivalent to $(x-1)x\equiv 0 ( mod \ n)$, that is $n | x(x-1)$. This is an easy way to calculate all idempotent elements for small $n$. In general, you need to consider the factorization of $n$ in prime factors and note that $x,x-1$ are coprime, and if one prime number divides one of them, it can't divide the other.

share|improve this answer

HINT $\ $ Idempotents in $\rm\:\mathbb Z/n\:$ are closely related to factorizations of $\rm\:n\:$ into coprime factors, i.e. $\rm\: n = a\:b\:,\:$ where $\rm\:gcd(a,b) = 1\:.\ $ Indeed, notice that $\rm\:p^k\ |\ e\:(e-1)\ \Rightarrow\ p^k\ |\ e\:$ or $\rm\:p^k\ |\ e-1\:.$

share|improve this answer
So are you saying the number of idempotent elements in Z_n is 2^(omega(n)) where omega(n) is the number of distinct prime factors of n.? Is there a way to determine which elements of Z_n are idempotent. For example, (by a brute force Mathematica code I see that ) for n=200 the idempotents are {0,1,25,176}. Is there any "formula" for finding the idempotents in Z_n? –  Geoffrey Critzer Jul 6 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.