Solving quadratic equations in Z/nZ

295 Views Asked by At

Is there a general methodology to solve $X^2 = X \:\mathbb{mod}\: n$?

A solution verifies the interesting fact that $X^i = X \:\mathbb{mod}\: n$ for $i>0$.

I think we can't really use discriminant like in algebra, but there may be a theorem answering my question.

Bonus question: Same with quadratic forms $X^2 + AX + B = 0 \:\mathbb{mod}\: n$