-1

The encoding formula is $y=3x+21$ and it arrived at a decoding formula of $x=9y+19*$ (using mod 26).

I'm just confused on how they got the decoding formula/the inverse of the original equation? or how the x was isolated?

amWhy
  • 209,954

1 Answers1

-1

Here is a simple way to show it:

Since $y=(3x+21) \mod 26$ you can equivalently write using identities of the remainders

$$3x=(y-21) \mod 26\Rightarrow 27x=(9y+19) \mod 26 $$

however since $27x=x+26x=x\mod 26$ the result follows.

More generally, to solve the equation $$px+qy=r\mod n,~ \gcd(p,n)=\gcd(q,n)=1$$

for $x$ or $y$ respectively, you need to find numbers $(a,b)$ such that

$$ap+bn=1$$

which is possible according to Bezout's identity, and one pair can always be found using the extended Euclidean algorithm. In our case, $p=3, n=26$ and the pair returned by the Euclidean algorithm is $a=9,b=-1$.

DinosaurEgg
  • 10,775