sahasumit288's blog

By sahasumit288, history, 9 years ago, In English

Assume we want to find a % n. Let n = p1 * p2. Find a % p1 and a % p2. Call a % p1 = x1 Call a % p2 = x2; For finding a % n. We can do following. Write a % n = x1 * alpha1 + x2 * alpha2;

How to find alpha1 and alpha2 and how to prove that a % n = x1 * alpha1 + x2 * alpha2 ?

  • Vote: I like it
  • +17
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +32 Vote: I do not like it

Are p1 and p2 distinct primes?

  • »
    »
    9 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yes

    • »
      »
      »
      9 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Well in that case you are looking for the Chinese Remainder Theorem. It was not clear to me how to use it to solve specific cases, so I will try to explain my best here.
      You are trying to find a such that

      Unable to parse markup [type=CF_TEX]

      (mod p1)

      Unable to parse markup [type=CF_TEX]

      (mod p2)
      The solution then is:

      Unable to parse markup [type=CF_TEX]


      Here is what each value means:

      Unable to parse markup [type=CF_TEX]

      Unable to parse markup [type=CF_TEX]

      The value

      Unable to parse markup [type=CF_TEX]

      means "the modular multiplicative inverse of N1 with respect to p1". Formally, this means that:

      Unable to parse markup [type=CF_TEX]

      (mod p1)

      Similarly,

      Unable to parse markup [type=CF_TEX]

      means "the modular multiplicative inverse of N1 with respect to p2"

      Unable to parse markup [type=CF_TEX]

      (mod p2)

      How do we find

      Unable to parse markup [type=CF_TEX]

      and

      Unable to parse markup [type=CF_TEX]

      ? We can use Fermat's Little Theorem to compute the modular multiplicative inverse of a number with respect to a prime.
      We have

      Unable to parse markup [type=CF_TEX]

      (mod p)
      Dividing both sides by a we get

      Unable to parse markup [type=CF_TEX]

      (mod p)
      Again

      Unable to parse markup [type=CF_TEX]

      (mod p)
      Therefore, the modular multiplicative inverse of N1 with respect to p1 is equal to

      Unable to parse markup [type=CF_TEX]

      . (Note: this value can get very very large, the value you really want is

      Unable to parse markup [type=CF_TEX]

      mod p1)
      Similarly,

      Unable to parse markup [type=CF_TEX]

      (Again, this value is usually gigantic, so you compute

      Unable to parse markup [type=CF_TEX]

      mod p2)

      Now that you have all the variables, you can compute a mod n.

      Please let me know if anything is unclear/wrong. That's it!