Permalink Submitted by Tim Flack on April 25, 2018

With the first cord, I have 26 letters to choose from for one end, then (since a letter can't be plugged into itself) I have 25 letters to choose from for the other end.

Comment: Correct, but you have to be careful because it doesn't matter which end of the cord is plugged in first, so the number of possibilities here is 26*25/2.

Since a letter can only be plugged into 1 other letter, that leaves 24 letters to choose from for the next cord.

Comment: Correct, so for the second cord there are 24*23/2 possibilities.

So you might think that the total number of possible ways to configure 2 cords would be 26*25*24*23/(2*2) but that is wrong. This is because it doesn't matter what order you put those two leads in. This is of fundamental importance in maths, and is the difference between a permutation and a combination.

A permutation refers to a way of selecting elements from a group where the order of selection matters. A good example of this is the number of ways of selecting 3 Enigma rotors from 5. This is a permutation because the order of selection matters, since each rotor position is different: you have a fast rotor, the middle rotor, and the slow rotor. So the answer is that there will be 5*4*3=60 ways. Mathematicians write this as 5P3 meaning how many ways can you select 3 objects from 5 when the order you select them matters.

A combination refers to the number of a way of selecting elements from a group where the order that you select them doesn't matter. For example, in the National Lottery it doesn't matter what order the balls come out, all you have to do is pick the right numbers irrespective of order. So if the numbers go from 1 - 50 and you have to pick 6 balls there will be 50*49*48*47*46*45 ways in which order matters, but you then have to divded by the number of ways you can order 6 balls, which is 6*5*4*3*2*1. Mathematicians call this 50C6 meaning the number of ways you can select 6 things from 50 where order of selection doesn't matter.

So, following this, and going back to the 2 cord problem, we need to divide by the number of ways we can select 2 cords, which will be 2.

Going to 3 cords, the number of ways we can put the cords into the plugboard will be 3*2*1 known as 3 factorial, written 3! The number of choices for the third cord will be 22*21/2. So for three cords we have:

26*25*24*23*22*21/((2*2*2)*3!)

4 cords will be 26*25*24*23*22*21*20*19/((2*2*2*2)*4!)

You should be able to see a pattern emerging now. If there are n cords then the number of the denominator will be n!*2^n. The number on the top will be 26*25*24*23 ... until you have 2n numbers. Note that this can also be written as 26!/(26-2n)! Try out a few values of n to convince yourself.

So this gives the final formula for n cords as 26!/((26-2n)!*n!*2^n)

If you put n=10 you will get the 150 milliion million answer. Interestingly, if you put n=11 you get a bigger answer still, but for n=12 and n=13 the number falls. So the Germans missed a trick, they should have used 11 and not 10 cords !

## Plugboard

With the first cord, I have 26 letters to choose from for one end, then (since a letter can't be plugged into itself) I have 25 letters to choose from for the other end.

Comment: Correct, but you have to be careful because it doesn't matter which end of the cord is plugged in first, so the number of possibilities here is 26*25/2.

Since a letter can only be plugged into 1 other letter, that leaves 24 letters to choose from for the next cord.

Comment: Correct, so for the second cord there are 24*23/2 possibilities.

So you might think that the total number of possible ways to configure 2 cords would be 26*25*24*23/(2*2) but that is wrong. This is because it doesn't matter what order you put those two leads in. This is of fundamental importance in maths, and is the difference between a permutation and a combination.

A permutation refers to a way of selecting elements from a group where the order of selection matters. A good example of this is the number of ways of selecting 3 Enigma rotors from 5. This is a permutation because the order of selection matters, since each rotor position is different: you have a fast rotor, the middle rotor, and the slow rotor. So the answer is that there will be 5*4*3=60 ways. Mathematicians write this as 5P3 meaning how many ways can you select 3 objects from 5 when the order you select them matters.

A combination refers to the number of a way of selecting elements from a group where the order that you select them doesn't matter. For example, in the National Lottery it doesn't matter what order the balls come out, all you have to do is pick the right numbers irrespective of order. So if the numbers go from 1 - 50 and you have to pick 6 balls there will be 50*49*48*47*46*45 ways in which order matters, but you then have to divded by the number of ways you can order 6 balls, which is 6*5*4*3*2*1. Mathematicians call this 50C6 meaning the number of ways you can select 6 things from 50 where order of selection doesn't matter.

So, following this, and going back to the 2 cord problem, we need to divide by the number of ways we can select 2 cords, which will be 2.

Going to 3 cords, the number of ways we can put the cords into the plugboard will be 3*2*1 known as 3 factorial, written 3! The number of choices for the third cord will be 22*21/2. So for three cords we have:

26*25*24*23*22*21/((2*2*2)*3!)

4 cords will be 26*25*24*23*22*21*20*19/((2*2*2*2)*4!)

You should be able to see a pattern emerging now. If there are n cords then the number of the denominator will be n!*2^n. The number on the top will be 26*25*24*23 ... until you have 2n numbers. Note that this can also be written as 26!/(26-2n)! Try out a few values of n to convince yourself.

So this gives the final formula for n cords as 26!/((26-2n)!*n!*2^n)

If you put n=10 you will get the 150 milliion million answer. Interestingly, if you put n=11 you get a bigger answer still, but for n=12 and n=13 the number falls. So the Germans missed a trick, they should have used 11 and not 10 cords !