Skip to main content
removed capitals from title; edited tags
Link
YCor
  • 63.9k
  • 5
  • 187
  • 286

Alternate Algorithmsalgorithms for Chinese Remainder Theoremremainder theorem

Source Link
coolpapa
  • 525
  • 2
  • 13

Alternate Algorithms for Chinese Remainder Theorem

I was teaching Discrete this semester and set the students loose on a system of linear congruences. One of them came up with this solution. Say $$ x \equiv 1 \textrm{ mod } 3 $$ $$ x \equiv 3 \textrm{ mod 4} $$ $$ x \equiv 2 \textrm{ mod } 5. $$

Then, we convert each congruence to a mod 60 congruence: $$ 20x \equiv 20 \textrm{ mod } 60 $$ $$ 15x \equiv 45 \textrm{ mod } 60$$ $$ 12x \equiv 24 \textrm{ mod } 60 $$ and sum them to get a single congruence $$ 47x \equiv 89 \textrm{ mod } 60.$$ The coefficient on the left will always be relatively prime to the mod, so this method always works.

This has to have been seen and studied before, right? I'm curious about the time complexity relative to the "standard" methods since we only have to calculate one multiplicative inverse. I imagine this is a loser on space complexity since that inverse is happening with the large modulus rather than the small ones. Any pointers to other discussions of this solution method, particularly complexity-wise?