Modular Arithmetic in Sage

To set up modular arithmetic, you choose a modulus, in this case 26:

 

Then, to refer to numbers as living in the world mod 26, you wrap them in the name of your number ring, R, i.e. you write R(3) instead of 3. Then you can do arithmetic with them:

 

 

 

You can also divide. But instead of a divides sign or fraction bar, we put an exponent $-1$ on denominators. In other words, please use the notation $a^{-1}$ for the inverse of $a$. We can compute the inverse of $3$, i.e. $1$ divided by $3$:

 

Let’s check that that is correct. What should the answer of the following computation be, if $9$ really is the inverse of $3$?

 

What happens when you compute the inverse of $2$?