Mathematics and Primary Sources:  Historic Codes, Ciphers, and Computational Thinking, Part I

The following is a guest post by Michael Apfeldorf of the Library of Congress.

As a child, did you ever enjoy sending secretly coded and encrypted messages to your friends? Analyzing secret messages from the past can also be a fun way for students to gain perspective into historical events while simultaneously practicing real-world mathematical and computational thinking skills.

Detail from George Washington Papers, Series 4, General Correspondence: Talmadge, 1783, Codes

During the American Revolutionary War, code was used to provide General George Washington with critical information on British troop movements and other activities. For example, the Culper spy ring, directed by Major Benjamin Tallmadge, operated in New York City while the area was occupied by Britain. To facilitate secret communications, Tallmadge created a code in which numbers were substituted in place of words. The numbers and text were arbitrary and fixed in their relationship. To read the message, the receiver would need the same codebook that the sender used to create it.

Two decades later, Thomas Jefferson proposed a different means of secret communication to the explorers Lewis and Clark as they traveled west across the continent. He suggested they use a type of Vigenère cipher, in which letters are substituted for other letters based not on a codebook, but on an algorithm.

Thomas Jefferson to Meriwether Lewis, April 20, 1803, Cipher

Jefferson’s instructions explain how to encrypt or decrypt a message based on a square. The square is established by  a pattern, which means that Lewis and Clark could reproduce it and execute the algorithm as long as they understood the underlying pattern.

Students can reflect on and interact with Washington’s and Jefferson’s secret communications methods with a number of activities:

  • Challenge students to write a secret message to a classmate using both Washington’s code and Jefferson’s cipher. What are the advantages and disadvantages of each? (For instance, codebooks have to be distributed and may be stolen, but algorithms might be cracked by someone skilled in decryption.) Encourage students to reflect on the real-world historical situations faced by Washington and Jefferson, such as geography, travel, and communication technologies.
  • Help students understand the mathematics underneath codes and ciphers by asking them to express Jefferson’s cipher as mathematical equations. Begin with the ideas that A=0 , B=1, Z=25, etc., and that a key tells the user how many spaces to shift across the alphabet. This is a good task for students who understand advanced algebra and modular mathematics.
  • Other students might try writing mathematical expressions with the assumption that one would use only one row of Jefferson’s square, so that the shift is a constant value, such as 3.  This is how the famous “Caesar Cipher” worked; students might speculate as to why people started using more complicated squares instead.
  • Challenge students to write a computer program that encrypts or decrypts messages based on Washington’s or Jefferson’s methods. Ask them to reflect on the historical significance of using computers to help with this work.

Over time, people have become increasingly adept at cracking ciphers, and at developing harder ones, as cryptanalysis increasingly plays a significant role in world events. Watch for a later post on this blog for a look at some of the women codebreakers who were so critical to the outcome of World War II.










  1. Sherry L
    March 20, 2018 at 12:05 pm

    A wonderful post! By following your suggestions, students (and teachers) should have fun creating and cracking ciphers and codes. Thank you!

  2. Sherry L
    March 20, 2018 at 12:23 pm

    A wonderful post! Students (and teachers) will have fun creating and cracking codes and ciphers. Thank you for the historical information and classroom suggestions.

  3. Ruth Ferris
    March 25, 2018 at 1:40 pm

    What a great post. I wonder if anyone has created a breakout box activity using these primary sources?

Add a Comment

This blog is governed by the general rules of respectful civil discourse. You are fully responsible for everything that you post. The content of all comments is released into the public domain unless clearly stated otherwise. The Library of Congress does not control the content posted. Nevertheless, the Library of Congress may monitor any user-generated content as it chooses and reserves the right to remove content for any reason whatever, without consent. Gratuitous links to sites are viewed as spam and may result in removed comments. We further reserve the right, in our sole discretion, to remove a user's privilege to post content on the Library site. Read our Comment and Posting Policy.

Required fields are indicated with an * asterisk.