Monday 15 August 2011

Multiplicative Inverses in Zn

In Cryptography it is often necessary to find the multiplicative inverse of a number in Zn. Zn is the set of integers {0,1,2,3,...,n-1} so, for example, Z7 is the set {0,1,2,3,4,5,6}. If we are multiplying two elements in Z7, say 3 and 5, then we can obtain a result in Z7 if we use modular arithmetic i.e. 3x5=15=2x7+1, so 3x5=1 (mod 7).

If j and k are elements of Zn, then k is the multiplicative inverse of j (and vice versa) if jxk=1 (mod n). So in the above example, 5 is the multiplicative inverse of 3 in Z7. Note that j has a multiplicative inverse in Zn if and only if j and n are coprime (i.e. j and n have no common factor apart from 1).

One way in which to calculate the multiplicative inverse of a number in Zn is to use Euclid's Algorithm. Armed with a programmable calculator, however, the multiplicative inverse can be found by brute force.

2 comments:

  1. Hi Duncan just to say what a dark horse you are anyway what an original topic to blog about. As you can see I'm your first follower might even invest in a Casio 50 X plus myself.

    Best wishes Chris

    ReplyDelete
  2. Thanks Chris. I didn't mention it to you before because I wasn't sure if it was something that might interest you. Some people might think it a bit geeky blogging about programming a calculator! It has interested me on and off since I was young and had access to a fantastic Texas Instruments TI59 programmable calculator. Those were the days when the PC as we now know it wasn't even invented.

    ReplyDelete