Math and War: How Math Saved Countless Lives In WWII
- toinfinityandbeyondmathclub
- 4 days ago
- 4 min read
Imagine if millions of lives could be saved just by cracking a random sequence of letters. During World War II, this was actually possible. Before the modern computer was invented, most military communication was encoded to keep it a secret from the enemy. But how can you break a code without knowing its key? That’s where math came in through the use of combinations, probability, sequence recognition and logic.
Introduced in the early 1920s, The Enigma Machine was adopted by the German military as their key mode of communication. Similar to an unusual looking typewriter, it used a complex series of 3-5 rotors, each with 26 possible positions, to scramble simple messages. A key pressed on the keyboard on the front would light up as another letter on the lightboard. The rotor rotated every time a key was pressed, thus changing the scrambling setting continuously. This meant that the same letter would light up different letters each time it was pressed. Typing a message on the keyboard would result in a scrambled version to be output, which was sent to the receiver via Morse codes. To read a message, all they needed to do was to set their Enigma machine up correctly to be in sync with that of the sender. Without the correct settings, decoding the Enigma was incredibly difficult, with over 150 quintillion (1018) possible combinations.
Imagine you and your friend have the same special alphabet lock toy that scrambles letters. For instance, you want to send the word “HELLO”.
First, you will agree on a common setting, maybe set wheel 1 to position K, wheel 2 to position R and wheel 3 to position L. (This resembles the daily key used in the Enigma Machine). Now when you type “H”, the machine scrambles it and lights up “S”. When you type “E”, it lights up “D”. You continue typing HELLO and the scrambled output is SDKZX. The machine changes the scrambling after every click so the same letter could give you a different letter each time. Only if your friend has the same machine set to the same starting positions, they can type SDKZX, and get back HELLO. Anyone else who sees SDKZX won’t know it means HELLO, because they don’t know the lock settings.
As the war progressed, codebreakers were able to predict messages based on the current situations. Germans also made predictable mistakes by repeating the formats and reusing the same phrases in the same positions. This helped codebreakers guess parts of the message accurately. These guessed parts were known as cribs. Furthermore, a letter typed on the Enigma was never encoded as itself. (So a ‘W’ is not actually a ‘W’). This helped the codebreakers to eliminate most wrong settings, thus significantly reducing the possible combinations. If ‘J’ becomes ‘V’ for a particular rotor position, ‘V’ will become ‘J’ for the same rotor position. These features of Enigma made the job easier for anyone who wanted to decode it.
Codebooks captured during wars helped reveal the upcoming Enigma settings, thus speeding up the decryption for those days.
In 1939, a British Mathematician, Alan Turing developed an electromechanical machine called the ‘BOMBE’. This did not directly decrypt the Enigma-encrypted messages. Instead it used the cribs, logical deduction and probability to eliminate the incorrect settings, narrowing down the search drastically. The Bombe ran multiple Enigma machines together, and helped find the correct setting for a given day – known as the Enigma key, in a very short time. Using the Bombe, codebreakers at the Bletchley Park in the UK were able to decipher Enigma communications through most of the war.
Many advanced mathematics concepts such as permutations and combinations, Boolean logic and menus together built the Bombe machine. The Enigma machine converted each letter using a sequence of permutations. The Bombe tried to reverse engineer these permutations by analysing cycles of letter substitutions. The Bombe would test the sequence of permutations, looking for any logical contradictions.
A menu is a diagram showing the logical connections between letters in a crib. If A becomes Q, Q becomes N, and N becomes A again, the bombe tests whether this loop made sense under a particular rotor setting. At the core, the Bombe continuously performed logical deductions, which is exactly what Boolean logic is. With the help of cribs, the Bombe tried to construct a logical pattern: If A becomes F, then certain plugboard settings must be true, but if that led to a contradiction later on, such as A becoming two different letters, then that setting was discarded. The Bombe system tried different combinations of rotor positions and orders. It wasn’t realistic to check all possible settings – so it relied on deducing partial information which could be completed manually later. The Bombe ran multiple Enigma Machines together and rapidly checked for any contradictions, aiming to find the correct setting for a given day, which, if found, would help them decrypt all the messages sent on that day.
Germans often bombed coordinates using the Enigma Machine. So if someone deciphered the Enigma, they could potentially track what the Germans were thinking. The Bombe helped to reduce the decryption time from weeks to hours, helping the allies read the messages in almost real time. This helped to shorten the war drastically, saving countless lives and resources. The Bombe also aided in the planning of key events, such as D-Day.
Turing’s work on breaking through the Enigma laid the groundwork for fields such as computer science, information theory and cryptography. His work directly influenced the development of modern computers, thus making WWII not just a military turning point, but a technological revolution powered by math too.
Comments