AlgoScope

Modular Inverse

AlgorithmintermediateNumber Theory

x with ax = 1 mod m; via extended Euclid, or a^(m-2) when m is prime.

Decision · step 10 of 12Multiples, Powers, Pascal: Inverse of 3 mod 11
3✓09✓15✓24✓31✓43✓59✓65✓74✓89i

3^9 = 5 x 3 mod 11 = 15 mod 11 = 4. That is 3^9, the inverse: 3 x 4 = 12 = 1 x 11 + 1.

Open in the player →or start at step 10

What you will see

Both routes side by side; they land on the same x.

How multiples, powers, pascal works →

Cost

BestO(log m)
AverageO(log m)
WorstO(log m)
SpaceO(1)

How you work with it here

play it through, compare two runs.

Screen readers: Numbers announce their value and role; each step announces the arithmetic performed.

Reduced motion: Values crossfade; no travelling digits.

Taught by the same lesson

Multiples, Powers, Pascal covers these too, in the same run.