# Showing that the Decryption Function is the Inverse of the Encryption Function (affine ciphers)

I am currently trying to understand an equality given on the wikipedia page: https://en.wikipedia.org/wiki/Affine_cipher

Namely, how does one prove this equality to be true:

$$a^{-1}(((ax+b\mod m)-b)\mod m=a^{-1}(ax+b-b)\mod m$$

Any help or leads would be appreciated. Thank you.

• With this formulation the problem can not be solved. Let us formulate this more clearly. To write it in the form of the equation. In this form, which is considered optimal. – individ Sep 30 '15 at 4:34

## 1 Answer

Assuming $\gcd(a,m)=1$ and $a^{-1}$ is the multiplicative inverse of $a$ in $\mathbb{Z}/m\mathbb{Z}$, we have that $a^{-1}(ax+b-b)\pmod m=a^{-1}(ax+b)-a^{-1}\pmod m\equiv a^{-1}(ax+b)\pmod m-a^{-1}b\pmod m\equiv a^{-1}(ax+b)\pmod m\pmod m-a^{-1}b\pmod m\equiv a^{-1}((ax+b\pmod m)-b)\pmod m$,

where we used the fact that $y\pmod m\equiv y\pmod m\pmod m$, which is easily proved using the definition of $\pmod m$.