Affine Cipher Question

I have an encrypted message (26 letter English) that was encrypted by an affine cipher. I know the first two letters of the plaintext are "th" which map to "AE" in the ciphertext. When I try to create a system of equations to try and get an encryption key, I hit a problem.

t=19 --> A=0 && h=7 --> E=4

So I create the system of equations

• 19a + b = 0
• 7a + b = 4

Subtracting I get

• 12a = -4

Now I can't invert 12 in Mod 26 so I have no idea where to go from here.. This was how I was taught to solve it in class.

$$12a = -4 + 26k$$

$$6a = -2 + 13k$$

$$6a \equiv -2 \pmod {13}$$

$$12a \equiv -a \equiv -4 \pmod {13}$$

$$a \equiv 4 \pmod {13}$$

Hence Case 1: $a \equiv 4 \pmod {26}$ or Case 2: $a \equiv 17 \pmod {26}$.

Now you can explore the corresponding value for $b$ for each case.

• Correct, but the first case can be discarded as it is not a unit. So, it must be that $a=17$. – Randall Sep 8 '17 at 10:25
• Why is the first case not a unit? – unseen_rider Sep 10 '17 at 18:15
• 4 is not a unit mod 26 because their gcd is 2. – Randall Sep 13 '17 at 2:31