top of page
  • Writer's picturetoinfinityandbeyondmathclub

Cracking the code: The Math behind the Enigma Machine

World War 2 was surely one of the most deadly conflict in human history causing millions of deaths on both sides. While the war caused sheer destruction to the infrastructure and economies of the participating nations, it also saw countless technological advancements on both sides. One such ingenious innovation was the German Enigma Machine, used by the Nazis to encrypt and decrypt messages and communications. Behind the seemingly complex gears and rotors lay a foundation of mathematics that would prove critical to both the Allies' efforts to decrypt Nazi communications and the subsequent development of modern cryptography.


Made in 1918 by Arthur Scheberius, a German engineer, the enigma machine was first made to protect communications in the banking industry. However, this machine was thought to be so secure that it was later used to encipher some of the most top-secret messages in the German military.


Now coming to the workings of the machine. More or less the machine resembled an oversized typewriter. Inside, it contained a series of rotors (the moving part of an electromagnetism system), which could be set in five positions. When a key was pressed, an electrical current would pass through the rotors, creating a complex encryption for each letter typed. Later, the encrypted message was sent by ‘Morse code’ to be deciphered by the intended recipient.


The enigma machine is an excellent example of mathematical brilliance. The core concept behind the machine was permutations and combinations. The rotors could be arranged in several ways, creating an enormous number of possible encryption settings. So if the German military used 3 rotors out of 5 rotors of the model and a plugboard with 10 wires

the 3 rotors out of 5 can be arranged in 5!/(5−3)!=60 ways

for each rotor, there were 26 starting positions; for 26^3 =17,576 combinations.

each of the 20 extremities of the 10 wires can be plugged into any of the 26 positions not otherwise occupied.

This gave a possible- 26!/(26−20)!*(2^10)⋅10! = 150,738,274,937,250 combinations.


Therefore the total possible encryption settings for each message were 60*17576*150,738,274,937,250= 158,962,555,217,826,360,000. Such a level of complexity made decryption a challenge.


Interestingly, even the encryptions used in the machine applied mathematics. For example, the number 3 would be encrypted as 6, using the code multiplied by 2. The actual codes were obviously more complex.


The Enigma machine, shrouded in secrecy and complexity, was ultimately defeated by the application of mathematics and the ingenuity of Allied cryptanalysts like Alan Turing. The mathematical concepts of permutations, combinations, frequency analysis, and logical deduction played a vital role in unravelling the secrets hidden within the Enigma code. The decryption of Enigma-encrypted messages not only provided invaluable intelligence to the Allies but also laid the groundwork for modern cryptography, emphasizing the enduring impact of mathematics on the course of history.


-Nishan Ajmani A2B


22 views0 comments

Recent Posts

See All
bottom of page