# Enigma: Combinatorics of the plugboard

Let's see how many configurations of the plugboard with k cables are possible. First we have to consider in how many ways we can choose k pairs of letters. Well, this is just

since we have $26\times25$ possibilities for the first pair, $24\times23$ for the second pair, and so on. Finally, we have $(26 - 2k +2) \times (26 - 2k +1)$ possibilities for the last pair, since a total of $26-2k$ letters are not connected on the plugboard at all. We can write this as a total of $\frac{26!}{(26 - 2k)!}$ possibilities.

There is, however, a problem with this answer. Let’s say we have a cable connecting letters $a$ and $b$, that would be the same as connecting $b$ and $a$. This means we’re counting the total number of possibilities double for each cable. To account for this, we divide the previous answer by $2k$.

We’re not finished yet, though. Let’s say we have plugged up the plugboard with 11 cables. Then there are 4 letters which are not connected to another letter on the plugboard, let’s say $w, x, y$ and $z$ are not connected. Well, that would be the same configuration if we hadn’t connected $x, w, y$ and $z$, since the cables are still connected the same. But in our previous answer these configurations are counted separately. To account for this, we divide by the number of ways we can arrange $2k$ letters, which is $(2k)!$. All in all the total number of possibilities to connect a plugboard with $k$ cables is equal to:

We can now calculate for $0 \leq k \leq 13$ in how many ways we can configure the plugboard:

We see that if we use a total of $k = 11$ cables, the total number of plugboard configurations is the highest, i.e. the safest option to use. This is interesting, since up until 1938, the Germans used six cables. Seven or eight cables were used after 1938, and it was not until 1943 that the Germans finally used the safest option of ten cables.