Consider an affine cipher.
The cryptanalyst observed the following plaintext/ciphertext pairs $(p,c)$: $(8,15)$ and $(5,16)$.
- Recover the key $(a,b)$ used in the encryption system above.
- What is the ciphertext corresponding to the plaintext $p=3$?
For #1, I came to this result:
$$\begin{aligned} 8 \cdot a + b &\equiv 15, \\ 5 \cdot a + b &\equiv 16 \\ \implies a &\equiv 17, \\ b &\equiv 9. \end{aligned} \pmod{26} $$
For #2, congruence gave me:
$$\begin{aligned} 3a &\equiv -1, \\ \text{which is}\quad 3a &\equiv 25, \\ \implies 3^{-1} &\equiv 27, \end{aligned} \pmod{26} $$
not $17$. Am I doing something wrong?