I have this equation
$x^2 \equiv x \pmod {b^m}$
Now I have found something interesting. I could somehow "split" this, but I don't quite understand if it is always working and how to prove it.
Here is what I have done:
First I factorize $b$ into its canonical form:
$b = \prod \limits_{i=1}^{\omega(b)} (p_i)^{(e_i)}$
(with $\omega(b)$ being the number of unique prime factors and $p_i$ being a prime and $e_i$ being the valuation.)
I found out that I can calculate $x$ with this congruence equation:
\begin{matrix} x & \equiv & a_1 & \pmod {({p_1}^{e_1})^m} \\ x & \equiv & a_2 & \pmod {({p_2}^{e_2})^m} \\ & \vdots & & \\ x & \equiv & a_{\omega(b)} & \pmod {({p_{\omega(b)}}^{e_{\omega(b)}})^m} \\ \end{matrix}
I have found out that if I define $a_i = \{0,1\}$ and apply the congruence equation with all possible $(a_1, a_2, ..., a_{\omega(b)})$ permutations, I get all $x$ solutions from the initial quation. $x^2 \equiv x \pmod{b^m}$
Example for $b=10$
$b = 10 = 2^1 \cdot 5^1$
Therefore:
\begin{matrix} x & \equiv & a_1 & \pmod {(2^1)^m} \\ x & \equiv & a_2 & \pmod {(5^1)^m} \\ \end{matrix}
The $(a_1, a_2)$ permutations generate different branches:
Tuple $(0,0)$ generates branch 0 (only one element: $\{0\}$ for all $m$)
Tuple $(0,1)$ generates branch 6 (elements $\{6, 76, 376, ...\}$ for $m=1,2,3,...$)
Tuple $(1,0)$ generates branch 5 (elements $\{5, 25, 625, ...\}$ for $m=1,2,3,...$)
Tuple $(1,1)$ generates branch 1 (only one element: $\{1\}$ for all $m$)
Questions:
(1) Can you please help me understand why this is the case and how to prove it?
(2) What do I need to do, to make it work with $x^q \equiv x \pmod {b^m}$ as well ?