2
solving ax b (mod n) gcd(n,a) = 1? Find a -1 mod n. Solution is x = ba -1 (mod n). Find d = gcd(n,a). Does d divide b? Divide everything (a, b and n) by d to obtain a new equation. Solve it using above method to obtain x 0 . Solutions to original equation will be x 0 , x 0 + n/d, x 0 + 2(n/d), and so on. There will be d solutions altogether. Equation has no solutions Y N Y N

How to Solve Modular Congruences

  • Upload
    nick-h

  • View
    235

  • Download
    0

Embed Size (px)

DESCRIPTION

A step by step way to solve for modular operations where ax = b (mod n) Also, how to solve for x^2 = a (mod n)

Citation preview

Page 1: How to Solve Modular Congruences

solving ax ≡ b (mod n)

gcd(n,a) = 1?

Find a-1 mod n. Solution is x = ba-1 (mod n).

Find d = gcd(n,a). Does d divide b?

Divide everything (a, b and n) by d to obtain a new equation. Solve it using above method to obtain x0.

Solutions to original equation will be x0, x0 + n/d, x0 + 2(n/d), and so on. There will be d solutions altogether.

Equation has no solutions

Y N

Y N

Page 2: How to Solve Modular Congruences

solving x2 ≡ a (mod n)

Is n prime?

a = 1? Know factors of n?

n ≡ 3 (mod 4) ? x = {1,n-1}

Either x ≡ ±a(n+1)/4 (mod n), or there are no solutions.

Use trial and error. (An efficient algorithm exists, but we won’t learn it in this course).

Split into multiple congruences of relatively prime moduli, solve using CRT

No known efficient algorithm exists. Believed to be a hard problem.

Y

Y Y

Y

N

N

N

N