Art + Math + Science + English
  1. Mathematics
  2. Class 7
  3. Project 5
Mathematics Through Play

5Codebreakers: Shift Ciphers and Letter Frequencies

Students build a cipher wheel, send secret messages using a shift rule (each letter moves k places), and discover "clock arithmetic" for wrapping around the alphabet. Then they break an unknown code by counting letter frequencies, and discuss why modern codes need much stronger mathematics.

Class and age
Class 7 · 12–13
Activity type
Group
Time needed
60 to 75 minutes
Difficulty
Medium
Estimated budget
৳0–৳10

Mathematical concepts

  • Rules as functions: letter number → letter number + k
  • Remainders and clock (modular) arithmetic
  • Inverse rule for decoding
  • Frequency tables and bar charts
  • Using data to make a hypothesis

Learning objectives

  • Encode and decode messages using a shift rule.
  • Use remainders to wrap around after Z.
  • Count letter frequencies and draw a bar chart.
  • Break an unknown shift using frequency evidence.

Real-life connection

Every time you use mobile banking or send a message on a messaging app, mathematics encrypts the data. Codes and codebreaking also played an important role in history; for example, mathematicians helped break military codes during the Second World War.

Materials required

  • Two card circles (one 10 cm, one 8 cm) per student, a split pin or a pencil point for the centre
  • Letter frequency tally sheet
  • Coded messages prepared by the teacher (English sentences of 100+ letters)

Step-by-step instructions

  1. Story (Code Breakers' Academy): 'Welcome to the Academy's most important class. Today you will learn to send messages that only your team can read, and to read messages that were never meant for you.'
  2. Build the wheel: divide each circle into 26 equal sectors (360 ÷ 26 ≈ 13.8°). Write A to Z around both. Pin them together at the centre.
  3. Number the letters: A = 0, B = 1, … Z = 25.
  4. Encode with shift 3: each letter number goes to number + 3. HELLO → KHOOR.
  5. Wrap around: X = 23, 23 + 3 = 26, but there is no letter 26. Take the remainder after dividing by 26: 26 → 0 → A. This is clock arithmetic.
  6. Decode: the inverse rule is number − 3 (add 26 if the result is negative).
  7. Send a secret: teams agree on a secret shift and send a message to another team with the key hidden in a puzzle ("the key is the solution of 2k + 5 = 19").
  8. Break a code: the teacher gives a long message with an unknown shift. Count each letter. In ordinary English text, E is usually the most common letter. If the most common code letter is P, what shift is likely?
  9. Test the hypothesis: decode a few words with that shift. Does it make sense? If not, try the second most common letter.
  10. Reflection: 'Why is a shift cipher weak? (Only 25 possible keys.) How could you make it stronger?'

Mathematical explanation

A shift cipher is a function: each letter number n goes to n + k, where k is the key. Because the alphabet is a loop, we use modular (clock) arithmetic: after 25 we wrap back to 0, by taking the remainder when dividing by 26, just as 15:00 on a 12-hour clock is 3 o'clock. Decoding uses the inverse function n − k. The weakness of the cipher is statistics: in a long English text, letters do not appear equally often, and E is usually the most frequent. Since the shift keeps the pattern of frequencies and only moves it along, the frequency bar chart of the code looks like the normal English chart slid sideways, which reveals k. Modern encryption avoids this by using very large prime numbers and much deeper number theory.

Expected project output

  • A working cipher wheel
  • An encoded and decoded message with the rule written as n → n + k
  • A letter frequency table and bar chart for the unknown code
  • The broken message with an explanation of how the key was found

Skills developed

Functions and inverses, remainders, data handling, hypothesis testing, logical persistence.

Assessment criteria

  • Encodes and decodes correctly, including wrap-around.
  • Explains the rule and its inverse using numbers.
  • Builds an accurate frequency table.
  • Uses evidence to find the key and checks it.

Extension challenge

Try a "multiply" cipher: n → 3n (remainder after dividing by 26). Does every letter get a different code letter? What happens with n → 2n? Why?

Safety and inclusion

Use split pins carefully. Coded messages should be friendly; no hurtful messages, even in code.