Caesar`s Cipher

advertisement
Chapter 1: The Caesar Cipher
I am introducing the Caesar Cipher in this chapter for two major reasons. Firstly, I want
you to get an understanding of how simple encryption and decryption can practically be
executed. For that purpose, I will provide you with handy disks for self made encryption.
The Caesar Cipher is not secure at all, I will show you how it can be cracked. Moreover, I
will illustrate how a computer can be used to perform the Caesar Cipher. Secondly, the
Caesar Cipher offers a great opportunity to learn the MOD arithmetic, also called clock
arithmetic. This will be essential to understand subsequent ciphers – i.e. today’s most
prevalent encryption method - the RSA Cipher. At the end of this chapter, I will give you
a practical insight to groups and rings. Such algebraic structures are not crucial to
understand the Caesar Cipher, however, they are fundamental not only to cryptography
but many other applications of Mathematics.
1.1 An Introduction to the Caesar Cipher
Sayings like veni, vedi, vici (he came, saw and conquered), words like Caesar’s Salad,
Kaiser and Caesar Cipher are due to the Roman Emperor Gaius Julius Caesar (100-44
B.C.) who was delivered via a Caesarian section. He reportedly encoded secret letters for
military purposes by shifting each plain text letter three positions to the right:
Plain text:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher text:
defghijklmnopqrstuvwxyzabc
For example, Caesar’s home city, ROME, turns into urph.
To ensure the recipient can decode his message, Caesar must have passed the 3-lettershift secret at some point before the actual message delivery. Similar to other 1-key
encryption systems, the secret way of how the message was encoded is the secret key.
The 3-letter-shift to the right was Caesar’s secret key that he used to encode all secret
messages. To decode, the recipients had to undo the “triple right shift” by shifting each
cipher letter 3 positions to the left. Had Caesar chosen a 10 letter right shift, a shift of 10
positions to the left would have been necessary.
Caesar enjoyed encoding his secrets using the “shift by 3” method. He had gotten very
comfortable with it since he was able to translate any plain text into cipher text with ease.
However, this comfort backfires. It is the dream of any eavesdropper to crack the cipher
code once and decode future messages easily. Thus, we always want to make an
eavesdropper’s life as difficult as possible. How can we do this for the Caesar Cipher? By
varying how we encode, that means by varying our secret key.
1
Sure, you might intervene and remark that we constantly need to pass the current secret
key to the recipients in a secure manner. You are absolutely right. However, these are the
costs we have to pay to increase the security of the message.
The Cryptographer’s Suggestion to Increase the Security of a
Message
The more secure you want your messages to be, the more frequent you have to
change the secret key.
For instance, during World War 2 the Germans changed the keys of their Enigma
encryption machine multiple times a day to ensure secure communication. Even these
days, cryptographers follow the principle that it is more important to keep the key secret
than which cryptosystem you use. For example, it was more important for the Germans to
keep the used Enigma keys secret than the usage of the Enigma machine as a
cryptosystem. In fact, the wondrous Enigma machine was known in detail before the
beginning of World War 2. Full credit goes to the brilliant British mathematician Alan
Turing and his team who cracked the Enigma at Bletchley Park, England in 1940 which,
according to some historians, might have ended the war earlier.
Consequently, in order to vary the secret keys and thus gain security, we will not limit
ourselves to Caesar’s 3-letter-shift preference. We will allow any number of left or right
shifts as a secret key and classify them as a Caesar Cipher, in respect for Gaius Julius
Caesar.
The Caesar Cipher is a Symmetric Cryptosystem
We saw that solely the knowledge of the encoding key is sufficient to create the decoding
key and vice versa. This is what makes the Caesar Cipher a so-called symmetric
cryptosystem. In chapter 5, you will learn that very secure asymmetric cryptosystems exist
such that the knowledge of the encoding key does not help a bit to infer the decoding key.
You might already be able to recognize the wonderful effects an asymmetric
cryptosystem has: nobody has to keep his encoding key secret, no more worries about
dishonest messengers. Rather, all encoding keys are publicly accessible (they may be
listed like telephone numbers in a telephone book) without giving eavesdroppers any
little hint on how to crack an encoded message. No more worries about transferring secret
keys, no more frequent secret key changes. It is no surprise that such cryptosystems are
actually very prevalent in today’s world of electronic telecommunication. Nevertheless,
in order to understand their mathematical background we have to first understand
symmetric cryptosystems such as the Caesar, the Multiplication and the Linear Ciphers.
2
1.2 Self-made Caesar Encryption
So, let’s encode and decode the Caesarian way. To do we build our own coding machine.
You have to first cut the 2 Caesar cipher disks that you find underneath and place the
smaller disc on the larger one. Finally, connect the centers with a pin in a way that the
letters “A” and “a” are located on the top of the disks, and N and n are then at the bottom.
The larger disk has your plain text in capital letters whereas the small disk contains the
cipher text in lower case letters. The contrasting upper and lower case letters are
commonly used in cryptography.
Y
Z
A
B
X
C
W
D
E
V
F
U
G
T
H
S
R
I
J
Q
P
K
O
N
M
3
L
y
z
a
b
x
c
d
w
e
v
f
u
g
t
h
s
I
r
j
q
p
k
o
n
m
l
Example1 (Encode and Decode using the Caesar Cipher disks): Encode the message:
“BRING MONEY TO ZOO” with the aid of the two disks. While holding the small disk
shift the large disk 3 letters to the right so that the A is above the d, the B above the e,
etc…
Plain text : BRING MONEY TO ZOO
Cipher text : eulqj prqhb wr crr.
encodes to
Say we received the encoded message. How could we decode using the disks? How do
you relate the disks to each another?
Answer: You keep the larger disk fixed and shift the small one 3 letters to the left
starting from the original position, so that A and d correspond, B and e, etc.
Ciphertext : eulqj prqhb wr crr
Plaintext : BRING MONEY TO ZOO.
4
decodes to
1.3 Cryptoanalysis – Cracking the Caesar Cipher
The Caesar Cipher allows simple straightforward encoding and decoding. Therefore, it
allows unauthorized message recipients to crack such encoded messages easily. If an
eavesdropper manages to obtain the encoded message, he only has to test the 26 possible
shifts in order to find the original message. This message-cracking attack is called “brute
force” and is best performed with the aid of computers. In our example, however, the pen
and pencil approach is sufficient.
eulqj
fvmrk
gwnsl
hxotm
iypun
jzqvo
karwp
lbsxq
mctyr
nduzs
oevat
pfwbu
qgxcv
rhydw
sizex
tjafy
ukbgz
vlcha
wmdib
xnejc
yofkd
zpgle
aqhmf
bring
csjoh
dtkpi
prqhb
qsric
rtsjd
sutke
tvulf
uwvmg
vxwnh
wyxoi
xzypj
yazqk
zbarl
acbsm
bdctn
ceduo
dfevp
egfwq
fhgxr
gihys
hjizt
ikjau
jlkbv
kmlcw
lnmdx
money
npofz
oqpga
wr
xs
yt
zu
av
bw
cx
dy
ez
fa
gb
hc
id
je
kf
lg
mh
ni
oj
pk
ql
rm
sn
to
up
vq
crr
dss
ett
fuu
gvv
hww
ixx
jyy
kzz
laa
mbb
ncc
odd
pee
qff
rgg
shh
tii
ujj
vkk
wll
xmm
ynn
zoo
app
bqc
1.4 The Caesar Cipher uses MOD Arithmetic
To encode messages using the Caesar Cipher we just have to operate the 2 disks. In fact,
you don’t need to think anymore, simply shift and match the letters on the disks. Imagine
you want to encode your 150-page diary. You would spin the disk for hours reading off
one letter after the other. No, this is no fun, especially seeing your brand-new computer
right on your desk. Let’s invest some time to teach the computer how to do it. Once he
learns it, he will do it with an incredible speed and perfect accuracy for you.
5
Let’s revisit the Caesar Cipher example:
Plaintext : BRING MONEY TO ZOO
Ciphertext : eulqj prqhb wr crr
We obtained the e from the B by rotating the larger disk 3 positions to the right which we
denote as “ROT 3”. Similarly, we denote a right rotation of 10 positions as “ROT 10”, a
left rotation of 5 positions as “ROT–5”. Thus, positive numbers symbolize clockwise
rotations, whereas negative numbers represent counter-clockwise rotations. Now you
might be amazed that one particular rotation, ROT13, is actually used in some word
processing programs to allow simple encryptions. If you had to decode a ROT13–
encoded cipher text, you know what to do. Just rotate the inner disk 13 positions to the
left and start reading off the plain text letters. Why does the help menu for a ROT13
encryption state: ”Decode a ROT13–encoded text by performing another ROT13 on the
ciphertext.” ? We just used a ROT–13 to decode the cipher text. Why would ROT13
work as well? Or is it a mistake in the manual? Experiment with your disks, the answer is
easy.
For our Caesar Cipher implementation we will replace each letter by a number since we
rotate by a certain number and not by a letter. Converting between numbers and letters is
efficiently executed by any computer. We replace A by 0, B by 1, C by 2, …., Z by 25.
Add the numbers on both of your Caesar Disks. The message appears as follows:
B R
1 17
I N
9 13
G
6
M O N
12 14 13
E Y
4 24
T O
19 14
Z O O
25 14 14
Having done that, we can now set up an encryption function f that assigns to each number
of a plain letter (denoted by the variable P) the corresponding number of the cipher text
letter (denoted by the variable C).
First Attempt to define the Encryption Function of the Caesar Cipher:
The Encryption Function of the Caesar Cipher is f: P  C = P+3,
where C and P are the integers from 0 to 25.
4 20 12 16 9
e u l q j
5 17 16 7 27
p r q h b
22 17
w r
28 17 17
c r r
This looks already like a reasonable assignment function and works for all plaintext
letters up to W, however, we encounter problems when encoding X, Y and Z as each of
them sums up to a number greater than 25. For example, Y’s 24 turns into 27 instead of
the desired 1 (as we obtained using the Caesar disks) which corresponds to b. You might
feel inclined to say, that the extra conversion to numbers just causes extra trouble. Trust
me here, not only can we teach our computer in a simple manner how to deal with
6
numbers that are just above 25 but also with numbers that might be much larger or even
negative. We will encounter larger numbers if we want to encode not using the familiar
ROT3 Caesarian way but say more fancy ways like using ROT29 or ROT81. We will
encounter negative numbers when decoding for example ROT3-encoded plain texts.
Let’s take a look at the Y that becomes the cipher letter b and number 27 on the disk after
encoding it with ROT 3. Had we encoded it with ROT 29 - which is just like encoding
with ROT 3 plus one additional full turn - we would have ended up with cipher letter b as
well. In fact, the periodicity of ROT-coding is similar to that of a sine wave. The sine
values can be measured as the heights of a rotating triangle in a unit circle that starts
repeating after one full turn. Thus, as the sine wave has a period of 360  degrees, the
period of the Caesar Disk is equal to the number of pie sections on the Caesar Disk,
namely 26. If we had an alphabet with 360 letters, both periods would be identical.
These observations give us a better understanding why the ROT29 – encoded Y yields
the letter b just as if it were encoded with ROT3 or ROT55 or ROT81. How do our
observations help us to teach our encoding function f: P  C to output 1 (=b) after
inputting 24 (=Y) using ROT3, ROT29, ROT55 and ROT81?
As a summary:
ROT Encryptions
ROT3 uses the encoding function C = P+3
ROT29 uses the encoding function C = P+29
ROT55 uses the encoding function C = P+55
ROT81 uses the encoding function C = P+81
Input P Actual
Output C
24(=Y) 27 (=b)
24(=Y) 53 (=b)
24(=Y) 79 (=b)
24(=Y) 105 (=b)
Desired
Output C
1
1
1
1
This is now where the heart of Mathematics, division Number Theory, comes into play:
figuring out patterns and expressing them in some sort of formula. 27, 53, 79, 105 are
somehow related as they produce the same Cipher letter on the Caesar disks. Such
numbers are called congruent numbers. Just as all triangles containing identical angles
are called similar triangles, we call numbers that produce identical outputs congruent
numbers. But exactly what property do they share? And how do they relate to 1? Try it
yourself.
53-27=26, 79-53=26, 105-79=26, also 27-1=26. Thus, the difference of two consecutive
numbers is constant. Coincidence? No, the 26 is exactly our period and just shows that
ROT29 performs exactly 1 more turn than ROT3, yet matching the same cipher letter b.
Also, 79-27 = 52 = 2*26 or 105 – 53 = 52 = 2*26 or also 27 – 105 = -78 = (-3) * 26 or
105 – 1 = 104 = 4 * 52. Thus, the difference of any two of our congruent numbers is a
positive or negative multiple of 26. Let a be one of these numbers and b another one,
we may describe this fact mathematically as: a – b = k * 26 , where k is an integer,
so that k*26 is a multiple of 26. Hey, we can be even a little bit more elegant here. Since
7
we don’t really care about the actual value of the integer k, we can just define congruent
numbers as follows:
Definition of congruent numbers in the Caesar Cipher:
Two integers a and b are called “congruent”, if a - b is divisible by 26.
We write: a  b MOD 26.
Remarks:
1) Just as = is used to denote equalities, the symbol  is used to denote congruent
integers.
2) 26 is the “modulus” when encrypting English messages. If we encrypted Italian
messages using the 21 letters of the Italian Alphabet we would use the modulus
21.
3) You surely have noticed that when we talk about divisibility we talk about evendivisibility such that the quotient is an integer and not a decimal number.
Example1: Are 53 and 27 congruent MOD 26? Answer: Since 53 - 27 = 26 is evenly
divisible by 26, thus 53 and 26 are congruent and we may write 53  27 MOD 26
Example2: Are 105 and 53 congruent MOD 26? Answer: 105 - 53 = 52 is evenly
divisible by 26, therefore 105  53 MOD 26. Because of our earlier observations with the
Caesar disk or simply because of the so-called transitivity property of congruent numbers
you also know that 27  105 MOD 26. Note that 27 and 105 are congruent MOD 26 but
not MOD 25 or MOD 20. Thus, the modulus 26 is crucial.
What is meant by MOD, Modulus and Modular Arithmetic?
Let’s recall example1: 53 and 27 are congruent MOD 26 since their difference can be
evenly divided by 26. This is one way of showing that two integers are congruent. The
other way may be even more apparent: 53 and 27 both leave a remainder of 1 when
divided by 26. So does 105. Using this remainder idea, we may define congruent
numbers in the following an alternative manner:
Two numbers are congruent MOD 26 if they leave the same remainder when
divided by 26.
Now, how does that help explaining the meanings of MOD and modulus?
“Modulus” is the Latin word for “remainder, residue” or more precise “what is left after
parts of the whole are taken”. MOD is the short form of modulus. For example, 53 MOD
26 = 1 stands for “53 divided by 26 leaves a remainder of 1” or “1 is left after taking
away 26 twice from 53”. It is read as “53 modulo 26 equals 1”.
Computations involving the Modulus to determine remainders are called “Modular
Arithmetic”. It was discovered by the German Mathematician Karl Friedrich Gauss
(1777-1855) in 1801. There is a nice anecdote about Gauss: His Mathematics teacher
tried to keep the bored genius busy. So he asked him to add up the first 100 integers.
Young Karl responded a few moments later saying “5050. And the formula for the sum
of the first n integers is n*(n+1) / 2”. Do you know why?
8
Modular Arithmetic is also called clock arithmetic since you can do the arithmetic on a
clock instead of on the number line. What is the modulus of a regular clock? Of course it
is 12. For example, 13:00 military time is usually expressed as 1:00, etc.
What does modular arithmetic mean for our Caesar Cipher?
1) Since our alphabet consists of 26 letters we use the modulus 26. This can be
viewed as a clock that holds 26 hours (just like the Caesar disk)
2) The number of turns on the Caesar disk which are congruent MOD 26 produce the
same cipher letter.
Using the MOD arithmetic allows us to correctly define Caesar’s Encryption function. In
case the encryption process yields integers greater than 26 we simply find its remainder
MOD 26 which produces the proper cipher letter number between 0 and 25. Shifting the
letter ‘z’ = 25 three positions to the right we obtain 25 + 3 = 28. The remainder of 28
MOD 26 is 2 which yields the correct cipher letter c = 2.
Proper Definition of the Encryption Function of the Caesar Cipher:
The Encryption Function of the Caesar Cipher is f: P  C = P+3 MOD 26,
where C and P are the integers from 0 to 25.
1.4.1 MOD Arithmetic can be used determine a
secret key
Our definition of congruent integers can be very helpful if we are to determine whether a
fancy encryption like ROT1253 - which uses the encoding function f : P  P+1253 - will
produce the same encryption as ROT0 (which we don’t want to use) or ROT1 or ….
ROT25 ? Here is how, plain and simple: 1253=48*26+5 where the remainder of 5 tells us
that we have to turn our disk 5 positions to the right (“ROT5”-encryption) to obtain our
cipher letters. We ignored the redundant 48 full turns. I.e. when encoding the plain letter
Y, the shift by 5 to the right yields the cipher letter d.
CONCLUSION:
In order to determine which encryption “ROT N” yields we simply have to divide N
by the modulus 26. The obtained remainder R – which must be a number between 0
and 25 – tells us the number of shifts to encrypt since N is congruent to R mod 26:
N = R mod 26.
Awesome! We have discovered a criterion that helps us to determine immediately how
many position shifts we have to do given any ROT number as a secret key. For example,
ROT5, ROT31, ROT57, ROT 161 and ROT1253 encryptions eventually end up 5
9
positions to the right. ROT3, ROT29, ROT55, ROT81, ROT107 encryptions eventually
end up 3 positions to the right and thus shift the same plain letters to the same cipher
letters. Furthermore, a shift of 5 letters to the right is identical to a 21-position-shift to the
left (we denote it as ROT(-21)) and also to a 47-position-shift to the left (ROT(-47)) on
the Caesar Disk.
On Caesar Disks:
…=ROT(-47)= ROT(-21)==ROT5=ROT31=ROT57=ROT 83=…
...=ROT(-49)= ROT(-23)==ROT3=ROT29=ROT55=ROT 81=….
We are ready to formulate the
Remainder Criterion specifically for the Caesar Cipher:
Two encoding keys - expressed as ROT numbers - encrypt a plaintext letter to the same
cipher letter if the ROT numbers give the same remainder when divided by 26.
1.4.2
MOD Arithmetic – part I :
How to compute MOD M
In the following 3 sections, we are going to study MOD arithmetic as the mathematical
basis to perform a variety of encryptions. In fact, each of the ciphers in the following
chapters require the usage of MOD arithmetic. Thus, let’s generalize our previous
observations a bit. A more general version of the MOD definition replaces the alphabet
length 26 by the modulus M:
Criterion for congruent numbers with respect to the modulus M:
a  b MOD M,
if a and b leave the same remainder when divided by M.
Example1: 5  9 MOD 4, because both 5 and 9 leave a remainder of 1 when divided by
4. For the same reason: 17  5 1 MOD 4 or also 7  22 MOD 5.
Consequently, coding Italian messages with all of its 21 letters with the Caesar Cipher
requires only 21 pie segments, and thus a modulus of 21, so that i.e. –20  1  22  43
 64 MOD 21, which again means that ROT–20, ROT1, ROT22, ROT43 and ROT64
produce the same encryptions.
Not only is MOD arithmetic helpful for encoding messages, it is also helpful for various
other calculations.
10
Solving Problems using MOD arithmetic:
Example 1: You want to pack 100 bottles in 6 pack containers. You will drink the
leftovers. How many will that be? Let’s compute: 100  4 MOD 6. Using a calculator,
you will have to type: 100 MOD 6 to get 4. Four “cheers” to your health.
Example 2: Today, Monday the 18th of December 1999, you replace the bulb in your
lighthouse. The package tells you that the bulb will work for exactly 10000 hours. You
are off on weekends and you don’t want the bulb to go off on a weekend. What will
happen? The modulus here is 168 since there are 168 hours in a week. Then, 10000 
88 MOD 168. So? Since 88 = 3*24 + 16. Assuming you change the bulb on Monday at
00:00, the bulb burns out at 16:00 (or 4 PM) on a Thursday. Since Thursday is a
weekday, the ships will be safe.
Example 3: In 2001, Christmas falls on a Tuesday. 2001 is not a leap year. On what day
will Christmas be next year? Since 365  1 MOD 7, next year’s Christmas will be 1 day
later than this year, Friday. In fact, if we are not enjoying a leap year, any particular date
like Christmas or your birthday will be 1 day later than in the current year. What happens
in leap years?
Addition, Subtraction, Multiplication, Division, Exponentiation MOD M
You have seen that MOD-arithmetic is useful not only in cryptography but also in solving
a wide variety of problems. Inherent in all of them is a certain periodicity, which is the
reason why such problems can be solved using mod arithmetic (See examples 1, 2 and 3).
We are now going to perform some sample modular computations for addition,
subtraction, multiplication, division and exponentiation.
We encountered already the main idea of MOD arithmetic in the Caesar encryption: No
matter if we add, subtract, multiply or divide MOD M, we first compute the regular way
without worrying about the modulus and then, secondly, apply the modulus to the
computed answer which yields a number from 0 to M-1.
a) Addition MOD M
Example1: Using a modulus of M=26, we computed earlier that i.e.
25 + 3 MOD 26 = 28 MOD 26 = 2. The two steps involved to compute the answer are
1.
Simply add 25 and 3 to obtain 28.
11
2.
Applying the modulus M (here 26) reduces the answer (here 28) to a number
between 0 and M-1 (here 27). In our example, 28 is reduced to 2 as we
subtracted the modulus 26 from 28 until we hit a number from 0 to 25.
We briefly write: 28 MOD 26 = 2. Equivalently, we may also write 28  2 MOD 26
denoting that 28 and 2 are congruent numbers.
Two remarks considering MOD-notation:
a) I will not use the congruence symbol “  “ anymore in the book. Instead I will
simply write 28 = 2 MOD 26. This prevents awkward notations like 25 + 3 = 28 
2 MOD 26.
b) After doing these introductory examples we will use a shorter notation that you
will commonly find in number theory books: In Z26 we compute 25 + 3 = 28 = 2.
The terminology “Z26“ is a combination of two things. You remember the symbol
Z as the symbol for the set of whole positive and negative integers and 0 (N is the
symbol for the set of all positive integers). The subscript, here 26, simply tells us
the modulus to use. Thus, Z26 denotes the integers 0,1,2,…,25. Similarly, Z6
denotes the integers 0,1,2,…,5. In general, Zn denotes the integers 0,1,2,…,n-1.
Example2: 51 + 3 MOD 26 = 54 MOD 26 = 2, because 54 = 2 * 26 + 2. Thus, 54 and 2
are congruent mod 26.
Example3: 77 + 3 MOD 26 = 80 MOD 26 = 2, because 80 = 3 * 26 + 2. Thus, 80 and 2
are congruent mod 26.
Example4: However, 77 + 3 MOD 25 = 80 MOD 25 = 5, because 80 = 3* 25 + 5. Thus,
80 and 5 are congruent mod 25. I could have also denoted this as 77+3 = 80 = 2 in Z25.
Example5: 70 + 7 + 3 = MOD 26 = 80 MOD 26 = 2. Again, 80 and 2 are congruent mod
26.
Exercise1: Since the MOD-addition is easy to understand I don’t want to bore you with
any adding exercises. Rather, I want you to give two situations where you would compute
as in example3 and example5.
Exercise2: Make up two problems that require the usage of MOD-addition. Answer
them using proper notation.
b) Subtraction MOD M
Subtracting is as easy as adding. In fact since subtracting just means adding negative
numbers we do the same as before. The only difference here is that our answers may be
12
negative, for example 2 – 3 MOD 26 = -1. You know what do in this case: since we want
our answers to be a number between 0 to 25 we keep adding (instead of subtracting) 26
until we obtain our number. I.e. -1 + 26 MOD 26 = 25 MOD 26. Or equivalently stated, 1 = 25 in Z26.
Example1: 3 – 15 MOD 26 = -12. Because –12 = 14 MOD 26, 3 –15 MOD 26 = 14
MOD 26.
Example2: However, 3 - 15 MOD 26 = - 12 MOD 26 = 13 MOD 25, because -12 + 25 =
13. Thus, -12 and 13 are congruent mod 25.
Example3: 15 – 43 MOD 26 = -28 MOD 26. Since – 28 = -2 = 24 MOD 26, 15 – 43
MOD 26 = 24.
Exercise1: Give a situation where you have to perform the MOD-subtraction in
example1.
Exercise2: Explain, why MOD-subtraction is important for Caesar-decryption and why
MOD-addition is important for Caesar encryption. En- and decrypt a 3-letter word using
modulus 26, afterwards use the modulus 22. The modulus 22 is employed when using the
22 letters in the Italian alphabet.
c) Multiplication MOD M
Multiplication is repeated addition. Since we learned already how to perform MODaddition we also know how to perform MOD-multiplication. For example, to compute 3
* 9 MOD 26 we recall that 3 * 9 = 9 + 9 + 9 = 27. Thus, we may write 3 * 9 = 27 = 1
MOD 26 or 3 * 9 = 27 = 1 in Z26 .
Example1: In Z26, 3 * 5 = 15 . 3 * 7 = 21 .
However, 3 * 9 = 27 = 1. Thus, 27 and 1 are congruent MOD 26 or equivalently stated:
27’s representative MOD 26 is 1.
Example2: In Z26, 3* 25 = 75 = 23 because 75 = 2 * 26 + 23. Thus, 75 and 23 are
congruent MOD 26.
Example3: In Z26, 4 * 25 = 100 = 22 because 100 = 3 * 26 + 5. Thus, 100 and 22 are
congruent mod 26. Attention: As a shortcut, we could have computed the answer 22 in an
alternative way: Because 25 = -1 MOD 26, we may write 4 * 25 = 4 * (-1) = -4 = 22 in
Z26. If you don’t believe that this shortcut facilitates certain computations, then do the
next exercise the good old way, however, also try the shortcut afterwards.
Exercise1: 20 * 25 MOD 26 = ?
13
Exercise2: Try to find the answers to the following MOD-multiplications without using
a calculator. See if you can find a shortcut for each of these problems, there exists one per
problem.
a) 4 * 13 MOD 26 =
b) 8 * 13 MOD 26 =
c) 80 * 13 MOD 26 =
d) 81 * 13 MOD 26 =
e) 7 * 25 MOD 26 =
f) 7 * 24 MOD 26 =
Eventually, assure the correctness of your answers by checking them on a calculator. Tip:
The Windows calculator has the MOD function. I will explain in the following section
how to compute each answer on calculators and on computers.
Exercise3: Can you think of a situation where the MOD-multiplications may occur? Use
your creativity.
d) Division MOD M
Division is the inverse operation to multiplication. We saw in example1 that 3 * 7 = 21
MOD 26. Expressing this multiplication inversely as a division, we may write 21 / 3 = 7
MOD 26. This looks familiar and doesn’t cause any surprise. However, the inverse
operation of 3 * 9 = 27 = 1 MOD 26 appears funny: 1 / 3 = 9 MOD 26. Surely, this only
works when computing MOD 26. What is 1 / 3 equal when computing MOD 29? Would
the answer also be 9? No, because 3 * 9 = 27 MOD 29 which does not 1. Apparently, we
have to ask ourselves: What number multiplied by 3 yields 1 MOD 29? Or
mathematically stated: Find x in 3 * x = 1 MOD 29. Here, the correct answer would be 10
since 3 * 10 = 30 = 1 MOD 29. But how do we find the correct answers in general? Do
we always have to reduce the problem of MOD-division to that of MOD-multiplication?
The answer is “No”. We don’t have to. Producing all possible products until the desired
number comes up would be too awkward. A method called the “Extended Euclidean
Algorithm” helps to perform proper MOD-division in an efficient manner. I will teach
you that in the next chapter when dealing with Multiplication Ciphers, however, I am
going to give you now a foretaste of what to expect. You might be already able to
generate a method based on my brief outlook. However, we do the following MOD
divisions in our head.
Example1: Let’s compute x = 1 / 3 MOD 29. The main idea is the following: Instead of
dividing 1 by 3 we multiply 1 by the inverse of 3, denoted as 3-1. This integer is thus far
unknown. However, it has an unambiguous property: If multiplied by 3 it yields 1 MOD
29. What is that number? We learned already that 3-1 = 10. Thus, we may write x = 1 / 3 =
1 * 3-1 = 1 * 10 = 10 MOD 29. Ok, that was easy. So let’s do another example where the
advantage of using the inverse becomes more apparent.
14
Example2: Compute x = 4 / 3 MOD 29. Again, instead of dividing by 3 we multiply by
the inverse of 3 MOD 29, 3-1, which is still 10: x = 4 / 3 = 4 * 3-1 = 4 * 10 = 40 = 11
MOD 29.
Check: 11 = 4 / 3 in Z29 since 3 * 11 = 33 = 4.
Example3: To compute x = 1 / 3 MOD 26 we have to ask ourselves what number
multiplied by 3 yields 1 MOD 26. The answer is x = 9. Check: 3*9 MOD 26 = 27 MOD
26 = 1. Correct.
Exercise1: Using the inverse of 3 MOD 26, 3-1 = 9, we can easily compute the following
MOD-divisions. Perform the check for each problem afterwards.
a) 5 / 3 MOD 26. Verify that the answer is 19.
b) 7 / 3 MOD 26.
c) 9/ 3 MOD 26 .
d) 11 / 3 MOD 26.
e) 37 / 3 MOD 26.
Exercise2: Why are the results in d) and e) the same?
Reflection on MOD-Division: MOD-division is not needed for the Caesar Cipher,
however, it will be needed for the Multiplication Cipher in the next chapter. In a brief
outlook, I showed you that MOD-division can be reduced to MOD-multiplication with
the help of the crucial so-called multiplicative inverse. In our above examples, we were
able to find those inverses by trial and error. This kind of computation is by far not
satisfying to Mathematicians. In the next chapter, I will show you a constructive method
to efficiently compute the multiplicative inverse, called “The Extended Euclidean
Algorithm”, which will then enable us to perform MOD-division efficiently. As you can
imagine, a computer will be very helpful to execute this algorithm.
e) Exponentiation MOD M
Division was somewhat difficult. Exponentiation, however, will be straightforward again.
Exponentiation is repeated multiplication. For example, 32 is computed as 3*3 = 9. 43 is
computed as 4*4*4 = 64. Now, MOD-exponentiation is performed in two steps:
1) we first compute the power as usual,
2) we then determine the remainder of that power after dividing it by the
modulus.
Example1: 43 MOD 26 = 4*4*4 MOD 26 = 64 MOD 26 = 12.
Example2: 53 MOD 26 = 5*5*5 MOD 26 = 125 MOD 26 = 21.
15
Example3: 125 MOD 26 = 12*12*12*12*12 MOD 26 = 9765625 MOD 26 = 12.
Example4: 254 MOD 26 = 25 * 25 * 25 * 25 MOD 26 = 390625 MOD 26 = 1. Surprise?
No, the answer is not a surprise since we can take advantage of the fact that 25 = -1 MOD
26. Then, 254 MOD 26 = (-1)4 MOD 26 = 1 MOD 26.
Exercises: Compute
a) 255 MOD 26 =
b) 256538 MOD 26 =
c) 33 MOD 26 =
d) 34 MOD 26 =
e) 44 MOD 26 =
f) 28 MOD 26 =
g) 63 MOD 26 =
Reflection on MOD-Exponentiation: MOD-exponentiation is not needed for the Caesar
Cipher, however, we will use it for the RSA encryption in chapter 5. To ensure the
security of RSA, we will use larger exponents and even much larger moduli. For
instance, you may have to compute
1734 MOD 2735411165371358123675176537654765762457165347.
Don’t worry, you don’t have to do this out by hand. A calculator will do the computation.
It just matters that you understand what the calculator does and that you can check if the
answer makes sense. For instance, it is impossible that the computed remainder is greater
than the modulus.
1.4.3 MOD Arithmetic - part II
Computing MOD M on Computers and
Calculators
You can not only find a MOD button on any reasonable scientific calculator, all modern
computer languages have a MOD function. For example, C++ uses the symbol “%” as
MOD. Therefore, we don’t have to teach our computer anything new, however, we need
to understand how the MOD function is used:
The MOD function gives the remainder r of the number a when divided by the modulus
M. Mathematically, we may write this as: a MOD M = r.
Let me give you 10 examples that help to understand a calculator’s MOD computations:
16
27 MOD 26 =1,
53 MOD 26 =1,
27 MOD 10 =7,
53 MOD 10 =3,
77 MOD 11 =0,
-1 MOD 26 = 25,
-26 MOD 26 = 0,
-27 MOD 26 = 25,
-28 MOD 26= 24,
-66 MOD 26= 12.
The 5 examples on the left are easy to understand: dividing the left number by the
modulus equals the remainder on the right. The right column is a little bit more
precarious, but the positive answers come in handy: not only does the computer divide
the left number by the modulus, in case the calculated remainder is negative, the modulus
is added to make the remainder a more positive number. Is that legal? Yes. Both numbers
are congruent; i.e.: -66 divided by 26 gives a remainder of –14 which is congruent to 12
MOD 26. Similarly, programming languages like C++ and Pascal compute as follows:
-66 MOD 26 = -14. So we have to add the modulus 26 to obtain 12 as the desired
number between 0 and 26. However, using =MOD(-66,26) in MS Excel produces 12
directly.
We could add or subtract the modulus 26 as often as we desire. We will always hit the
same number that is congruent MOD 26 as the difference remains divisible by 26.
Realize, that we have freedom in the choice of the remainder, and that the remainders
between 0 and 25 give a convenient way to match the letters on the Caesar Disk in an
easy manner.
The MOD function offers now two options of creating a C++ program for the Caesar
Cipher using MOD arithmetic:
Option 1: Given a ROT number, we convert it to a ROT number between 0 and 25 and
then perform the encryption on the new ROT number. By converting the ROT number
we are essentially taking out any redundant full turn.
Option 2: Instead of converting the ROT number first, we use it to perform our
encryption and afterwards convert the resulting number of the cipher text letter to a
number between 0 and 25 to match with the corresponding letter. The resulting cipher
text would of course be same as if we used option1.
C++ implementation of the Caesar Cipher:
In the following C++ Code for “Caesar Encryption and Decryption using ROT3” we are
pursuing Option 1: When decrypting, the 3-letter-shift to the left, ROT-3, is converted to
ROT23. Your exercise here is to compile and run the C++ code it. After you understand
how the program works, you are to modify it such that various key lengths can be used. I
will help you to understand the most difficult line of the program: cl='a' + (pl + 3 -'a')%26; You
will then understand the remainder of the C++ code quite easily.
In this program, we make use of the character’s ASCII code. For example, the character
B has the ASCII code 66, C has 67, a has 97, b has 98. To verify this, insert the C++ code
cout << (int) pl; after reading in a character in line 19. Now we can understand (pl + 3 -'a')%26 :
Adding the key 3 to the ASCII code of the plain text letter, pl, and subtracting the ASCII
17
code of the character a (=97) MOD 26 yields the integer that we add to the ASCII code of
character a to eventually obtain the cipher text character cl. For instance, if I want to
encode the letter b (=98), I add 3 and subtract 97 to get 4 (even without using MOD).
Then, I add the 4 to the ASCII code of a, 97, to obtain 101 which is the cipher letter e,
just what we desired.
//Caesar Encryption and Decryption using ROT3
//Author: Nils Hahnfeld, 8/25/99
#include<conio.h>
#include<iostream.h>
void main()
{
char cl,pl,answer;
clrscr();
do
{
cout << "Caesar Encryption or Decryption? Enter (e) or (d) or (~) to exit: " ;
cin >> answer;
if (answer=='e')
{
cin >> pl;
while(pl!='~')
{
if ((pl>='a') && (pl<='z'))
cl='a' + (pl + 3 -'a')%26;
else if ((pl>='A') && (pl<='Z'))
cl='A' + (pl + 3 -'A')%26;
else cl=pl;
cout << cl;
cin >> pl;
}
}
else if (answer=='d')
{
cin >> cl;
while(cl!='~')
{
if ((cl>='a') && (cl<='z'))
pl='a' + (cl + 23 -'a' )%26;
else if ((cl>='A') && (cl<='Z'))
pl='A' + (cl + 23 -'A')%26;
else pl=cl;
cout << pl;
cin >> cl;
}
}
}
while(answer!='~');
}
18
Got it? Why wouldn’t I just use cl=(pl + 3) %26 instead of
cl='a' + (pl + 3 -'a')%26 ?
1.5 Introduction to Abstract Algebra - part I:
GROUPS
The MOD arithmetic gives us an insightful example of an algebraic structure called a
group. Let me give you a brief introduction to group theory. Considering groups stems
from answering the following question:
What is the solution of the equation
(1)
4x = 3
The answer depends on what numbers we allow x to be. If we are doing all our arithmetic
using the integers then there is no solution. There is no integer that gives 3 upon being
multiplied by 4. On the other hand if we are doing our arithmetic MOD 5 then x = 2 is a
solution. If we are using the more common rational numbers, then the solution is x = 3/4.
We can gain insight into all such questions by considering the general equation
(2)
a  x = b
and then bringing up the question of solutions. What set of numbers do a and b belong to?
And to which does x belong to? What is the operation symbolized by the symbol  ?
Group theory is concerned with the sets of numbers in which (2) always has a
unique solution. The theory does not concern itself with what a and b actually are nor
with what the operation symbolized by ° actually is. By taking this abstract approach
group theory deals with many set of numbers at once. Group theory requires only that a
set of numbers obeys 4 simple rules. The theory then seeks to find out properties common
to all number sets that obey these 4 rules. What are these rules?
The 4 basic rules for a Group are:
1. CLOSURE: If a and b are in the group then a ° b is also in the group.
2. ASSOCIATIVITY: If a, b and c are in the group then (a ° b) ° c = a ° (b ° c).
3. IDENTITY: There is an element e of the group such that for any element a of the
group
a ° e = e ° a = a.
4. INVERSES: For any element a of the group there is an element a-1 such that
a ° a-1 = e and
19
a-1 ° a = e
That's it. Any set of numbers that obeys those four rules is a group. The study of number
sets that obey these four rules is named GROUP THEORY
Why those four rules in particular? Is it an arbitrary choice? Certainly not, to show you why those four
rules make up a group, we have to find the solution for our original equation:
a°x=b
In "solving" this equation we will assume that a and b are elements of a group with the group operation
symbolized by °. We are looking for the member of the group that x could be replaced by to satisfy the
equation. We'll use the group axioms to "solve" the equation in any group.
Using the closure rule and the axiom for inverses we operate (multiply or add would be too restrictive) on
both sides of the equation by the inverse of a. The inverse rule says that a-1, the inverse of a exists and the
closure rule says that the product of a-1 and any other group element exists and is still in the group.
a-1 ° (a ° x) = a-1 ° b
Now applying the associative rule,
(a-1 ° a) ° x = a-1 ° b
The rule of inverses gives
e ° x = a-1 ° b
Finally using the rule of identity we get,
x = a-1 ° b
So we "solved" equation (2) without answering the questions about a, b or x or even what the operation
indicated by ° was. This is the power of abstraction. Group theory is a clear example of abstraction in
modern Mathematics. Once a result is demonstrated to be valid for all groups then it is clearly valid for any
specific group we may choose.
One rule is missing on our list of rules: the commutative property. This is because in
group theory commutativity is not needed to solve equations. Groups in which the group
operations are commutative are named after the great Norwegian mathematician Niels
Henrik Abel: Abelian or commutative groups.
5. COMMUTATIVITY: If a and b are in the group then a ° b = b ° a. We then call
the group a commutative group.
1.5.1 MOD addition forms a commutative group
When encrypting the plain text letter Y using ROT3, we learned that: (24 + 3) MOD 26
= 27 MOD 26 = 1, or simply 27  1 MOD 26 which yields the cipher letter b. Similarly,
an X would become an a because 23 + 3 MOD 26 = 26 MOD 26 = 0, or simply 26  0
MOD 26. Adding two numbers MOD 26 forms a group. In order to verify this we start
with a smaller alphabet.
Example 1: Addition MOD 4 forms a commutative group
20
Let’s imagine the inhabitants of Abadaca only use the four letters A,B,C,D which we
convert to the numbers 0, 1, 2, 3 such that A=0, B=1, C=2, D=3. The Abadaca cipher
disk for would consist of only four sections, thus, instead of adding MOD 26 we now add
two numbers MOD 4 when encoding. For example:
Encoding A using ROT1 yields b because 0+1 MOD 4 =1,
Encoding B using ROT2 yields c because 1+2 MOD 4 = 3,
Encoding B using ROT3 yields a because 1+3 MOD 4 = 0,
Encoding C using ROT3 yields b because 2+3 MOD 4 = 1.
To display all possible code combinations / cipher letters that are produced by using the
four possible ROT0 (which of course leaves the plain text unchanged), ROT1, ROT2,
ROT3 encryptions, we create an addition table MOD 4 as follows:
+
ROT0
ROT1
ROT2
ROT3
0 (=A)
1 (=B)
2 (=C)
3 (=D)
0
1
2
3
1
2
3
0
2
3
0
1
3
0
1
2
We modify this table in the following way:
a) In the top row: instead of writing out the kind of rotation we use for encoding, we
simply replace it by the number of shifts to the right.
+
0
1
2
3
0
1
2
3
0
1
2
3
1
2
3
0
2
3
0
1
3
0
1
2
Now, the set {0,1,2,3} forms a group with respect to MOD 4 addition, +, denoted as
G = ({0,1,2,3},+) , since the following four group properties are fulfilled:
Addition MOD 4 forms a group
Group definition for addition
P1) Closure of addition: The sum of P1) Closure of addition: For any two
any two numbers must equal 0,1,2 or 3. numbers x and y that are part of the set G:
The MOD 4 addition yields only such their sum x + y must also be part of G. In
numbers as you can see in the table.
our example on the left:
P2) Associativity: (x+y)+z =x+(y+z). P2)
Associativity: For any three
Take any three 3 numbers (possibly 2 or 3 numbers x, y and z that are part of the set
identical numbers) and change the order of G: (x+y)+z =x+(y+z) which means that the
21
addition, the final sums must equal. You
really need to check all possible additions.
As an example: (1+2)+3 = 3+3=2 just like
1+(2+3)= 1+1=2. In terms of our Caesar
Cipher this means that if you first encode
the letter b by ROT2 and then encode the
resulting cipher letter by ROT3 which
yields the cipher letter c, you would also
obtain the letter c if you would apply
ROT5 (that results from performing ROT2
and then ROT3) to encode letter b.
P3) Identity element: id+x=x+id=x. The
number 0 is our identity element because
adding 0 to any number simply gives the
number itself: For example, 0+1=1+0=1,
which means that encoding the letter a by
ROT1 produces cipher letter b just as
encoding the letter b by ROT0.
The existence of the identity element can
easily be seen in the table: The 0-row
equals the top row, the 0-column equals the
left column.
P4) Inverse elem.: x+xinv=xinv+x=id=0.
After finding our identity element 0, we
now have to check if every number x can
be added to another number (the “inverse
number”) such that the sum is equal to our
identity element 0. Yes, we can. I.e.
1+3=3+1=0, so 1 is the inverse element of
3 with respect to MOD4 addition and vice
versa. 2 is its own inverse element as
2+2=2+2=0.
The existence of an inverse element for
each number can also easily be seen in the
table: Each row contains exactly one 0.
order of adding 3 numbers can be changed
in the given way.
P3) Identity element: For each number
x that is part of the set G there exists a
number id such that:
id+x =x+id=x.
P4) Inverse element: For each number x
that is part of the set G there exists a
number xinv such that:
x+xinv=xinv+x=id
The additive group is eye-catching: Draw a diagonal from the top left to the bottom right.
Then, mirror each number that is not on the diagonal over the diagonal line. The numbers
match. What property could that be? It is the commutative property: just as 2+3 produces
1 MOD 4, so does 3+2. In terms of encoding, that means that the cipher letter b can be
produced by shifting the plain text letter C (=2) 3 positions to the right or by shifting the
plain text letter D (=3) 2 positions to the right.
22
Two Remarks
1) We denote the numbers 0,1,2,3 as Z4. Thus, instead of writing “0, 1, 2 and 3 combined
with the MOD addition, +, forms a commutative group”, we simply write: (Z4, +) is a
commutative group. Since any group consists of a set of numbers, S, and an operation
(usually multiplication or addition), op, that is performed on these numbers we can
describe any group as (S,op). S and op have to be specified.
2) Since MOD-Addition and MOD-Multiplication are both commutative due to the
commutative property of regular addition and multiplication, any group whose operation
is MOD-Addition or MOD-Multiplication must form a commutative group.
Examples 2 and 3: (Z2, +) and (Z3, +) form commutative groups
I am going to explain why (Z2, +) is a group and leave (Z3, +) for you to explain.
Z2 are the first two positive integers including 0, thus Z2= {0,1},
Z3 are the first three positive integers including 0, thus Z3= {0,1,2}:
+
0
1
2
3
0
1
2
3
0
1
2
3
1
2
3
0
2
3
0
1
3
0
1
2
+
0
1
0
1
0
1
1
0
(Z2, +) is a group because
(Z3, +)
is a group because
(Your explanation goes here)
P1) Closure of addition: The sum of any
two numbers equals 0 or 1:
0+0=1+1=0 and 0+1=1+0=1
P2) Associativity:
(0+0)+0=0+(0+0)=0.(0+0)+1=0+(0+1)=1.
(0+1)+0=0+(1+0)=1.(1+0)+0=1+(0+0)=1.
(1+1)+1=1+(1+1)=1.(1+1)+0=1+(1+0)=0.
(0+1)+1=0+(1+1)=0.(1+0)+1=1+(0+1)=0.
23
P3) Identity element: 0 is the identity
element: 0+1=1+0=1 and 0+0=0.
P4) Inverse elements:
The inverse element of 1 is 1 because 1+1=0.
The inverse element of 0 is 0 because 0+0=0.
P5) Commutativity: Z2 is a commutative group since 0+1=1+0, 0+0=0+0,
1+1=1+1.
Example 4: ({A,B,C,D}, ) forms commutative groups
The mathematical discipline that studies algebraic structures such as groups, rings or
fields is called Abstract Algebra. The word abstract tells us that i.e. groups do not only
exist for integers but more generally for variables that represent numbers. As an example,
we start modifying the above table for Z3. Replacing 0 by A, 1 by B, 2 by C and 3 by D
as well as using the symbol  (which you should not confuse with a multiplication or
composition symbol) as a variable for any possible operation. We rewrite our table as
follows:

A
B
C
D
A
B
C
D
A
B
C
D
B
C
D
A
C
D
A
B
D
A
B
C
Here, ({A,B,C,D}, ) forms a commutative group since all 5 properties are fulfilled.
1.5.2 MOD multiplication does not form a
commutative group
It is natural to ask in Mathematics if the MOD multiplication forms a commutative
group as well? Investigate the question whether (Z4, *) forms a commutative group,
where * denotes MOD-multiplication. Here is the corresponding multiplication table
MOD 4. Do not continue reading until you decided whether (Z4, *) is a group or not.
*
0
1
0
0
0
1
0
1
2
0
2
3
0
3
24
2
3
0
0
2
3
0
2
2
1
Solution: checking properties P1-P4 shows:
P1) The MOD-multiplication * is closed as the products are all in Z4.
P2) * is associative for any 3 number combination.
P3) The identity element is id = 1.
P4) However, not every element x has an inverse number xinv such that x * xinv = id = 1. e
x = 2 and x = 0 don’t possess an inverse element. You can verify this as the 2nd and the
4th row contain no 1.
Consequently, (Z4, *) is not a group, since one of the four properties fails to exist. You
will be able to practice more on groups by doing the provided problems at the end of this
chapter. I will end the chapter by showing you how mathematicians deal with unsettling
facts such that a set of numbers like Z4 forms a commutative group with respect to MODaddition but barely fails with respect to MOD-multiplication since not every element
possesses a multiplicative inverse. Such sets are called Rings and are mathematically
only close to perfection. I will introduce them to you in the next section.
Of course, mathematical perfection would mandate the fulfillment of group criteria with
respect to both operations. Such perfect mathematical sets do exist when excluding 0.
They are called Fields. We will study them in the next chapter.
1.6 Introduction to Abstract Algebra - part II:
RINGS
Let me specify what I mean mathematically by close to perfection.
Definition of a RING:
A set of elements R that can be added and multiplied is called a RING if
1) R forms a commutative group with respect to addition.
2) R is associative with respect to multiplication: x*(y*z)=(x*y)*z.
3) the following 2 distributive laws that combine addition and multiplication hold:
3a) x * (y+z) = x * y + x * z and
3b) (y+z) * x = y * x + z * x for all x,y,z that are part of R.
Two remarks
1. In addition to the listed ring properties, a FIELD also possesses a multiplicative
inverse for each field element except 0: it therefore forms a group with respect to
25
multiplication. This is what I consider “mathematical perfection” (A term which is not an
official mathematical term, it is just the author’s creation).
Example1: (Z4, +, *) is a ring.
Since rings require both addition and multiplication, we have to set up and investigate the
corresponding multiplication and addition tables: MOD 4 addition is a commutative
group as you learned earlier which fulfills part 1) of the ring definition:
+
0
1
2
3
0
1
2
3
0
1
2
3
1
2
3
0
2
3
0
1
3
0
1
2
Moreover, the MOD 4 multiplication is only almost a group, the required inverse
elements for 2 does not exist. However, for a ring we just need the associative property
with respect to multiplication. Checking all 3 number combinations shows that (Z4, *)
is associative.
*
0
1
2
3
0
0
0
0
0
1
0
1
2
3
2
0
2
0
2
3
0
3
2
1
It remains to check the two distributive properties: For instance,
3a) 1*(2+3)=1*1=1 just like 1*2+1*3=2+3=1
3b) (3+2)*3=1*3=3 just like 3*3+2*3=1+2=3.
Again, we really have to check for all possible x, y, z combinations and not just these two
examples. Checking them all shows that Z4 is distributive. Since all three properties are
fulfilled, (Z4, +, *) is a ring.
Exercise1: Create the tables for Z5, Z6 , Z7 , Z8 and try to find out if (Z5, +, *), (Z6, +, *),
(Z7, +, *) and (Z8, +, *) are rings aswell.
Example2: The set of all integers Z forms a ring.
The most popular example for a ring is the set of all integers with respect to the familiar
addition and multiplication. I leave the check for the ring properties as an exercise for
you. The reason why Z is not a group with respect to multiplication and, therefore only
close to perfection, is that no integer has an integer as an inverse number except for 1 and
–1. For example, the inverse of 2 is the non-integer ½ or the inverse of -10 is 1/-10
which is again not an integer. The exceptions: the inverse of 1 is 1 since 1/1=1=id, the
inverse of -1 since -1/-1 =1=id.
26
Other examples for rings are:
Example3: The set of all even integers.
Example4: The set of all rational numbers. They even fulfill the stronger
requirements called field (that is because each rational number has a rational inverse
number which is not true for the set of integers). We will study the fields in more detail in
the next chapter.
Example5: The set of 2x2 matrices with real coefficients. Not every 2x2
matrix has an inverse matrix, namely the ones with a determinant =0.
Example6: The set of all continuous functions f having the real numbers
as the domain and the range. These continuous functions form a commutative
group with respect to addition, why not with respect to multiplication?
Example7: (Z26, +, *) is a ring. I leave the verification as an exercise for you. We
will use Z26 in the next chapter.
27
Download