# Affine Cipher Keys that map plaintext to a given ciphertext

We first need to show that for each pair of plaintext-ciphertext letters ( x,y ), there are exactly 12 keys that encrypt x to y . For each choice of a , the key ( a,y − ax ) encrypts the plaintext letter x to the ciphertext letter y , since ax + ( y − ax ) = y . There are twelve possible choices for a so there are exactly twelve keys that map a given plaintext letter to a given ciphertext letter.

This is an easy question, I'm just trying to make sense of this statement found on page three here www.maths.uq.edu.au/courses/MATH3302/2010/files/cryptotute2.pdf

In the affine cipher how is their only 12 keys that map a given plaintext x to a given ciphertext y? I learned that the affinecipher has 286 nontrivial keys. So if thats the case how can only 12 of them map a given plaintext x to a given ciphertext y.

• You havent given enough information. What are the plaintext, ciphertext and key spaces? How is the key defined with respect to the affine map? And the link refers to some notes where this is presumably defined. – kodlu Oct 18 '17 at 20:58
• specifically if $y=ax+b$ with the key $(a,b)$ where do $a$ and $b$ live? – kodlu Oct 18 '17 at 21:08

Assuming plaintext and ciphertext alphabets are $U=\{0,\ldots,25\}$, taken to be the ring of integers modulo 26, and the keyspace is $U^2$ with $$(a,b)\in U^2,$$ it is clear that for plaintext $x=2t$ corresponding to even numbers, $(a,b)$ and $(a+13,b)$ give the same $y$ violating the invertibility of the encryption. Moreover, if $b=0$ $a$ can't be zero for the same reason.
So we allow all $b$ but only $12$ nonzero $a$'s and can choose either $a$ or $a+13$ as $a$ ranges over $\{1,2,\ldots,12\}$.