# Number of keys for a monoalphabetic cipher

My teacher stated that…

The number of possible keys (E) in a monoalphabetic cipher is $26$!

My thinking:

Every letter in the alphabet can be $25$ different letters hence it the number of possible keys should be $26^{25}$.

What is wrong with my way of thinking, and how did she come to a conclusion of “$26!$”?

• In addition to Nova's answer, there is another error in your thinking: "can be $25$ different letters" looks like you missed the identity. If you exclude that a symbol is encrypted as itself, you add a security weakness (a prominent example of this was the Enigma). – tylo Aug 26 '16 at 10:37

Your teacher is right, and here's why:

What happens if you encrypt A with G and B with G? You can't decipher it, because you have no idea if the G in the ciphertext was an A or a B.

So…

• For the plaintext letter A you can use the ciphertext letter A, B, C, … , X, Y, or Z. ($26$ possible letters.)
• For B you can use A, B, C, … , X, Y, or Z, but not the letter you did use for A. ($25$ possible letters.)

• For C you can use A, B, C, … , X, Y, or Z, but not the letter you did use for A or B. ($24$ possible letters.)

• ...

• For Z you can only use the remaining letter. ($1$ possible letter.)

The whole number of possible keys is $26\times25\times24\times [...] \times2\times1 = 26!$ (The exclamation mark denotes the factorial of a number.)

if s={ a,b,c}

for this , possible combinations {abc,acb,bac,bca,cab,cba} so its 3! same way its 26!