Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A message is encrypted using an affine cryptosystem in which plaintext uses the 26 letters A through Z (all blanks are omitted), the letters are identified with the residue classes of integers (mod 26) in the natural way, and the encryption and decryption functions are defined by x -> f(x) = ax + b (mod 26) and y -> g(y) = cx + d (mod 26) respectively, where a; b; c; d are certain constants (unknown to you) and g(f(x)) is the identity function. Suppose you intercept the ciphertext UWWPUWKPPFWPWKPJWW: Assuming that E and then T are the two most commonly occurring letters in English text, find the decryption function g(y) and decrypt the message.

This is my homework question. I really dont know how to solve it . Could anyone give me a help ? Thanks in advance.

share|cite|improve this question
Which letter do you think decrypts to E? And which to T? – Henning Makholm Oct 28 '12 at 16:38
Have you ever seen or heard of an affine cipher before? If not, make one up for yourself (choose some $a$ and $b$ as in the problem) and use it to encrypt a simple message, such as "iwillmeetyouunderourfavoritetree". Just to get a sense of whaat is going on :) – Hans Engler Oct 28 '12 at 18:17
up vote 2 down vote accepted

HINTS: First make a frequency table; this should be your first step in dealing any cipher.

$$\begin{array}{rcc} \text{Letter}:&\text{F}&\text{J}&\text{K}&\text{P}&\text{U}&\text{W}\\ \text{Frequency}:&1&1&2&5&2&7 \end{array}$$

You’re told to assume that ‘E and then T are the two most commonly occurring letters in English text’. In other words, you’re told to assume that the most frequent letter in the message represents E, and the second-most frequent letter represents T. What are those letters?

Let’s say that you decide that the ciphertext letters representing E and T are letters $m$ and $n$, respectively, modulo $26$. E and T are $5$ and $20$, respectively, so if $f(x)=ax+b$ and $g(x)=cx+d$ are your enciphering and deciphering functions, you now know that

$$\left\{\begin{align*} &5a+b\bmod 26=m\\ &20a+b\bmod 26=n \end{align*}\right.\tag{1}$$


$$\left\{\begin{align*} &cm+d\bmod 26=5\\ &cn+d\bmod 26=20 \end{align*}\right.\tag{2}$$

Your task, once you’ve identified $m$ and $n$, is to solve $(1)$ for $a$ and $b$ and $(2)$ for $c$ and $d$ to reconstruct the enciphering and deciphering functions.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.