A prequel for the much-anticipated Neve Errong series of mathematical detective stories! First learn the math before you get outwitted by the dangerous confederacy of spies known as E.V.I.L.L
2. From the desk of THE CHIEF Welcome, Agent Errong, We here at G.O.O.D. Agency pride ourselves on the quality of our team. Before we send you out on any missions, you need some training. Your mentor will be the talented Agent Al Waysright. He will guide you though some mathematical and cryptographical whatever-he-does to get you up to speed! Only then will you have the skills you need in the field. Listen to Agent Waysright, he’s always... right. -THE CHIEF Our Headquarters are here, at the United Nations Building in New York, Floor 101.
3. Modular Arithmetic In cryptology, we often deal with converting letters into numbers and vice-versa. There are only 26 letters, but infinitely many numbers. In order to move between the two systems, we will use reduced modular arithmetic. The result of a modular reduction is basically the whole number remainder of division. Say we want to reduce N modulo m. Then, N = m*q+r for some quotient q and some remainder r. That remainder will be the solution to the reduction of N mod m We use the following vocabulary and notation: We reduce N modulo m. We will generally use ‘mod,’ as in ‘N mod m,’ or simply a percent sign, N%m
4. Examples of Modular Arithmetic N%m = r (m goes into N q times with a remainder of r. N = q*m+r) 5%2 = 1 (2 goes into 5 twice with a remainder of 1. 5 = 2*2+1) 10%7 = 3 (7 goes into 10 once with a remainder of 3. 10 = 1*7+3) 10%5 = 0 (5 goes into 10 twice with a remainder of 0. 10 = 2*5+0) 10%3 = 1 (10 = 3*3+1) 23%7 = 2 (23 = 3*7+2) 4%5 = 4 (4 = 0*5+4) 1001%3 = 2 (1001 = 333*3+2) 1001%2 = 1 (1001 = 500*2+1)
5. Manipulating the Alphabet Each letter of the alphabet represents a number, A=0, B=1, C=2, etc. Then we can apply math to make a new alphabet. The simplest is adding 1 to each letter: ABC 0,1,2 Apply the rule, 0,1,2 1,2,3 Translate back, 1,2,3 B,C,D One can also use multiplication. Try multiply by 7. HI 7,8 Apply the rule, 7,8 49, 56 Reduce modulo 26, 49,56 23, 4 Translate back, 23,4 X, E Two questions: why do we start at A=0, not A=1; Also, if we multiply our code by some certain numbers, it fails. Which numbers work and which don’t?
6. Which numbers will successfully make a new alphabet when multiplied? Any number which is relatively prime to 26. Any number not relatively prime to 26 will create over lap. Example: *2 CP 2,15 Apply rule, 2,15 4, 30 Reduce, 4,30 4,4 Translate back, 4,4 EE Two different letters become the same letter. Exploring codes Why begin at A=0 rather than A=1? We begin at A=0, because 26%26 = 0 (26=1*26+0). If we had A=1, then Z=26, but when reducing modulo 26, one can never have a remainder of 26.