Você está na página 1de 54

1

MATHEMATICAL
SYSTEMS
Prepared by:

Joseph G. Taban
University of Northern Philippines
2

Contents
1. Modulo Arithmetic
2. Application
3. Cryptography
3

A. Modulo Arithmetic
• In mathematics, modular arithmetic (sometimes called
clock arithmetic) is a system of arithmetic for integers,
where numbers wrap around after they reach a certain
value – the modulus.

There are 24 Hours in a Day however,


time is divided to two twelve hour periods
Example:
22 Hours is 12 + 10, So it is Ten O'clock!
4

1. Modulo Arithmetic
The Swiss mathematician
Leonhard Euler pioneered the modern
approach to congruence in 1750, when he
explicitly introduced the idea of
congruence modulo a number N.

Modular arithmetic was further


advanced by Carl Friedrich Gauss in
his book published in 1801.
5

Activity
• Get a partner and solve the problem using the concept of
Modulo
Activity - 1. Working with Remainders.docx
6

2. Modulo Operations
• The notion of modular arithmetic is related to that of the
remainder in division. The operation of finding the
remainder is sometimes referred to as the modulo
operation.
• We define Zn as the set of integers from 0,1,2,…,n-1
modulo n, i.e.
Zn = {0, 1, 2, …, n-1}
7

Note that Zn has exactly n nonnegative integers. In


particular, we define Zn with the following set of positive
integers:
• Z3 = {0, 1, 2}, modulo 3
• Z5 = {0, 1, 2, 3, 4}, modulo 5
• Z8 = {0, 1, 2, 3, 4, 5, 6, 7}, modulo 8
In Zn, modulo is simply the remainder r when an
integer 𝑎 ∈ ℤ is simply divided by n.
a
has a remainder r < n
n
8

Perform the following operations:


A. In Z8 B. In Z15
1. 4 + 9 1. 11 + 12
2. 15 + 21 2. 27 + 58
3. 126 + 102 ` 3. 102 + 98
4. 12 . 3 4. 14 . 6
5. 28 . 12 5. 32 . 10
9

3. Constructing Modulo Tables


Zn is closed under the binary operations of
addition and multiplication of integers modulo n.
Let us construct the addition and
multiplication table for Z3.
In Z3 = {0, 1, 2}
+ 0 1 2 . 0 1 2
0 0 1 2 0 0 0 0
1 1 2 0 1 0 1 2
2 2 0 1 2 0 2 1
10

Possible activities
1. Let the students construct the other modulo tables
2. Using the tables, allow students do the oral recitation
on performing operations for the following:
a. In Z4, find 2 + 2
b. In Z6, find 4 . 5
c. In Z8, find - 5
d. In Z5, find 4−1
e. In Z10, find 7 - 3
1
f. In Z9, find 2 +
4
3
g. In Z7, find -6
5
11

4. Modulo Congruence

Notations are used as a tool to solve problems, to facilitate


mathematical arguments, and much more to simplify sorts
of computations.
The idea about congruence is attributed to the great
mathematician Gauss (1777 – 1855).

Congruence Modulo m
Definition.
If m is a positive integer and m 𝒂 − 𝒃, then we
say that a is congruent to b modulo m and in symbol,
a ≡ b (mod m). If a is not congruent to b modulo m, we
write a ≠ b(mod m).
12

The following are equivalent to each other and may


be used interchangeably.
i. a ≡ b (mod m)
ii. m a − b,
iii. a = b + mk, for some integer k
13

Least Residue
We call the remainder r as the least residue of a. The word
“residue” is merely a technical term which has the same sense as
remainder.
(“residue” = what left over = “remainder”)
The set of integers S = {0, 1, 2, …, m-1} is called the least
residue system modulo m. If a ∈ ℤ and a ≡ r (mod m), then r is one
of the integers in the set S.
For instance, the least residue of 38 in modulo 3, 4, and 5
are 2, 2, and 3, respectively. We write this as follows:
38 ≡ 2 (mod 3)
38 ≡ 2 (mod 4)
38 ≡ 3 (mod 5)
14

Why do we care about these


residue classes?
Because we can replace any member
of a residue class with another member
when doing addition or multiplication mod n
and the answer will not change

To calculate: 249 * 504 mod 251


just do -2 * 2 = -4 = 247
15

Congruence is a generalized form of equality.


Many properties are being carried over to congruence.
Congruence satisfies the following properties of
equivalence relation.
i. Reflexive: a ≡a (mod m)
ii. Symmetric: If a ≡ b (mod m, then b ≡ a (mod m)
iii. Transitive: If a ≡ b (mod m) and b ≡ c (mod m,
then a ≡ c (mod m)
16

• The following corollaries are also important in


understanding congruence:
1. Given a, b, and c ∈ ℤ ,then a ≡ b (mod m), iff
a + c ≡ b + c (mod m)
2. If a ≡ b (mod m) and c ≡ d (mod m),
ac ≡ bc (mod m) for any integer c
ax + cy ≡ bx + dy (mod m)
ak ≡ bk (mod m) for any integer k
a - c ≡ b - d (mod m)
17

Illustration 1. Find the least residue modulo 7 of


37.45 + 6.158
Solution:
The direct computation is done by performing the
indicated operations and dividing the sum by 7. But, this involves
tedious computations. So, we do this as follows:
Note that:
37 ≡ 2 (mod 7)
45 ≡ 3 (mod 7)
6 ≡ -1 (mod 7)
15 ≡ 1 (mod 7) and by corollary 2 (iii), 158 ≡ 1 (mod 7)
• By substitution,

37.45 + 6.158 ≡2.3 + (-1)1 ≡ 6 + (-1) = 5(mod 7)


18

5. Solving Congruence Equations


Solving a congruence equation means finding all whole number
values of the variable for which the congruence is true.

For example, to solve 3x + 5 = 3 mod 4, we search for whole


number values of x for which the congruence is true.

3(0) + 5 ≠ 3 mod 4
3(1) + 5 ≠ 3 mod 4
3(2) + 5 = 3 mod 4 2 is a solution.
3(3) + 5 ≠ 3 mod 4
3(4) + 5 ≠ 3 mod 4
3(5) + 5 ≠ 3 mod 4
3(6) + 5 = 3 mod 4 6 is a solution.
If we continued trying values, we would find that 10 and 14 are
also solutions. Note that the solutions 6, 10, and 14 are all congruent to
2 modulo 4. In general, once a solution is determined, additional
solutions can be found by repeatedly adding the modulus to the original
solution.
Thus the solutions of 3x + 5 = 3 mod 4 are 2, 6, 10, 14, 18, ... .
19

Note the following:


1. When solving a congruence equation, it is necessary to

check only the whole numbers less than the modulus.

2. A congruence equation can have more than one solution

among the whole numbers less than the modulus.

Example: 2x + 1 = 3 mod 10 with solutions {1, 6, 11, …}

3. Not all congruence equations have a solution. For

instance, 5x + 1 = 3 mod 5 has no solution.


20

Exercise
Find all whole number solutions of the

congruence equation.
1. x = 10 mod 3 6. 3x + 1 = 4 mod 9

2. x = 12 mod 5 7. 2x + 3 = 8 mod 12

3. 2x = 12 mod 5 8. 3x + 12 = 7 mod 10

4. 3x = 8 mod 11 9. 2x + 2 = 6 mod 4

5. 2x + 1 = 5 mod 4 10. 5x +4 = 2 mod 8


21

Challenge! 50

1. Find the remainder when x! is divided by 8.


x=1
2. Find the remainder when
a. 6589 is divided by 63
b. 2110 is divided by 19
c. 7109 is divided by 6
3. A number N divides each of 17 and 30 with the same
remainder in each case. What is the largest value of N?
4. A number N divides 17 with the remainder R and divides
30 with the remainder 2R. What is the largest value of N?
5. If a certain number is divided by 2, 3, 4, or 5, the
remainder is 1 in each case. What is the least number
that satisfies these conditions?
22

Application
ISBN
Every book that is cataloged in the Library of Congress must have
an ISBN (International Standard Book Number). This 13-digit number was
created to help ensure that orders for books are filled accurately and that
books are catalogued correctly.

The first three digits of an ISBN are 978, the next digit indicates
the country in which the publisher is incorporated (0, and sometimes 1, for
books written in English), the next two to seven digits indicate the
publisher, the next group of digits indicates the title of the book, and the
last digit (the 13th one) is called a check digit. If we label the first digit of
an ISBN d1, the second digit d2, and so on to the 13th digit d13, then the
check digit is chosen to satisfy the following congruence.
23

Formula for the ISBN Check Digit


d13 = 10 – (d1 + 3d2 + d3 +3d4 + d5 + 3d6 + d7 + 38 + d9 + 3d10 + d11 + 3d12) mod 10

If d13 = 10, then the check digit is 0.

TAKE NOTE: The 5th through 12th digits (eight digits total) of an

ISBN are for the name of the publisher and the name of the

book. If the publisher has a three digit number, then there are 8 -

3 = 5 digits for the name of the book. If the publisher has a six-

digit code, there are two digits for the name of the book.
24

Example:
For instance, the ISBN for the fourth edition of the American
Heritage Dictionary is 978-0-395-82517-4. Suppose, however, that a
bookstore clerk sends an order for the American Heritage Dictionary and
inadvertently enters the number 978-0-395-28517-4, where the clerk
transposed the 8 and 2 in the five numbers that identify the book.
Correct ISBN: 978-0-395-82517-4
Incorrect ISBN: 978-0-395-28517-4
The receiving clerk calculates the check digit as follows.
d13 = 10 - [9 + 3(7) + 8 + 3(0) + 3 + 3(9) + 5 + 3(2) + 8 + 3(5) + 1 + 3(7)]
mod10
= 10 - 124 mod 10
= 10 - 4 mod 10
= 6mod 10

Because the check digit is 6 and not 4 as it should be, the receiving
clerk knows that an incorrect ISBN has been sent. Transposition errors are
among the most frequent errors that occur. The ISBN coding system will
catch most of them.
25

Determine a Check Digit for an ISBN


1. Determine the ISBN check digit for the book The
Equation that Couldn’t Be Solved by Mario Livio. The
first 12 digits of the ISBN are 978-0-7432-5820-__.
2. A purchase order for the book The Mathematical
Tourist by Ivars Peterson includes the ISBN 978-0-760-
73261-6.Determine whether this is a valid ISBN.
3. Determine whether the given number is a valid ISBN
a. 978 – 0 – 614 – 35945 – 2
b. 978 – 1 – 55690 – 182 – 9
26

UPC
Another coding scheme that is closely related to the
ISBN is the UPC (Universal Product Code). This number is
placed on many items and is particularly useful in grocery
stores. A check-out clerk passes the product by a scanner,
which reads the number from a bar code and records the
price on the cash register. If the price of an item changes
for a promotional sale, the price is updated in the computer,
thereby relieving a clerk of having to reprice each item. In
addition to pricing items, the UPC gives the store manager
accurate information about inventory and the buying habits
of the store’s customers.
27

The UPC is a 12-digit number that satisfies a congruence


equation that is similar to the one for ISBNs. The last digit
is the check digit. If we label the 12 digits of the UPC as
d1, d2, ... , d12, we can write a formula for the UPC check
digit d12.
▼ Formula for the UPC Check Digit
d12 = 10 - (3d1 + d2 + 3d3 + d4 + 3d5 + d6+ 3d7 + d8 + 3d9 + d10 + 3d11) mod 10

If d12 = 10, then the check digit is 0.


28

Example
Find the check digit for the DVD release of the film Alice
in Wonderland. The first 11 digits are 7-86936-79798-__

Solution
d12 = 10 – [3(7) + 8 + 3(6) + 9 + 3(3) + 6 + 3(7) + 9 + 3(7) + 9 + 3(8)] mod 10
= 10 – 155 mod 10
= 10 – 5 mod 10
= 5 mod 10

The check digit is 5.

UPC: 7-86936-79798-5
29

Exercise:
1. Is 1 – 32342 – 65933 – 9 a valid UPC?
2. Is 8 – 85909 – 19432 – 4 a valid UPC?
3. Is 0 – 36000 – 29145 – 2 a valid UPC?
4. The following are UPCs of Philippine products. Identify
the missing check digits.
a. Argentina beef loaf 170g: 7 – 48485 – 80009 - 𝒙𝟏𝟐
b. Nissin bowl Noodles Hot and Spicy Chicken Flavor
3.32oz: 0 – 70662 – 09631 - 𝒙𝟏𝟐
30

Credit Card Numbers


Companies that issue credit cards also use modular
arithmetic to determine whether a credit card number is
valid. This is especially important in e-commerce, where
credit card information is frequently sent over the Internet.
The primary coding method is based on the Luhn
algorithm, which uses mod 10 arithmetic.
Credit card numbers are normally 13 to 16 digits
long. The first one to four digits are used to identify the card
issuer.
31

The table below shows the identification prefixes used by four popular
card issuers.
Card Issuer Prefix Number of digits
Master Card 51 to 55 16
Visa 4 13 or 16
American 34 or 37 15
Express
Discover 6011 16

The Luhn algorithm, used to determine whether a credit card number is valid,
is calculated as follows:
Beginning with the next-to-last digit (the last digit is the check digit) and
reading from right to left, double every other digit. If a digit becomes a
two-digit number after being doubled, treat the number as two individual
digits. Now find the sum of the new list of digits; the final sum must
equal 0 mod 10.
32

Determine a Valid Credit Card Number


Determine whether 5234 8213 3410 1298 is a valid credit card number.

Solution
Highlight every other digit, beginning with the next-to-last digit and reading from
right to left.

5234821334101298

Next double each of the highlighted digits.

10 2 6 4 18 2 2 3 6 4 2 0 2 2 18 8

Finally, add all digits, treating two-digit numbers as two single digits.

(1 + 0) + 2 + 6 + 4 + (1+8) +2 + 2 + 3 + 6 + 4 + 2 + 0 + 2 + 2 + (1+ 8) + 8 = 60

Because 60 = 0 mod 10, this is a valid credit card number.


33

Is 6011 0123 9145 2317 a valid credit


card number?
34

USPS
Modular arithmetic is often used in coding
information. The United States Postal Service (USPS) uses
modular arithmetic to detect errors or forgeries of money
orders.
The serial number of a USPS money order is 11
digits long. The first 10 digits of the serial number
(8810024532) are followed by a security check digit (7). If
the money order is genuine, then the 10-digit number
modulo 9 will be equal to the check digit.
35

PROBLEM:
Money order A has a serial number of 51177875501. Money
order B has a serial number of 88100245327. Using modular
arithmetic, determine if the money orders are genuine.
Solution:
For Money order A, the serial number is genuine if the first 10 digits of the
number is 10-digit code(mod 9) = 1. Notice that 5117787550 =
568643061(9) + 1. Therefore, 5117787550(mod 9) = 1. Thus, the serial
number corresponds with a genuine money order.
For Money order B, notice that 8810024532 = 978891614(9) + 6.
Therefore, 8810024532(mod 9) ≠ 7. Thus, the serial number does not
correspond with a genuine money order.
36

Cryptography
Cryptology
• Cryptology is the discipline devoted to
secrecy systems.
• Cryptography is a branch of cryptology that
deals with the design and implementation of
secrecy systems
• Cryptanalysis involves breaking these
secrecy systems.
• Plaintext is a message that is to be altered
into a secret form.
• Cipher refers to the method for altering a
plaintext message into a cipher text.
Changing the letter of the plaintext uses a
transformation.
• Key determines a particular transformation
from a set of possible transformations.
• Encryption or enciphering is the process of
changing plaintext into cipher text.
• Decryption or deciphering is the reverse
process of changing the cipher text back to the
plaintext.
SECRECY SYSTEMS
encryption
A. SHIFT
TRANSFORMATIONS

Form: C ≅ P + k (mod 26), 0 ≤ C ≤ 25,


where:
k is the key representing the size of the shift of
letters in the alphabet,
P is the numerical equivalent of a letter in the
plaintext, and
C is the numerical equivalent of the
corresponding cipher text letter.
CAESAR’S CIPHER
 used by Julius Caesar that uses
substitution
 each letter is replaced by the letter
three further down the alphabet, with
the last three letters shifted to the first
three letters of the alphabet.

Form: C ≅ P + 3(mod26), 0 ≤ C ≤ 25,


CORRESPONDENCE BETWEEN
PLAINTEXT AND
CIPHERTEXT(CAESAR’S CIPHER)
Examples:
Encipher the message using Caesar’s:

“Tomorrow will be a holiday”


B. AFFINE TRANSFORMATIONS
Form: C ≅ aP + b (mod 26), 0 ≤ C ≤ 25,

Where: Key K = (a, b), a and b are


integers,

P is the numerical equivalent of a letter in the


plaintext, and

C is the numerical equivalent of the


corresponding cipher text letter.
Examples:
Encipher the message using affine
transformations C = 3P + 1 (mod 26)

“Cathy the Great”


Decryption
A. Caesar’s Cipher:
Recall: C = P + k (mod 26)
<enciphering>

P = C – k (mod 26) <deciphering>

Example: Decipher the message:


LORYH BRX
B. Affine Cipher:
Recall: C ≅ aP + b (mod 26)
<enciphering>

aP ≅ C – b (mod 26)
P ≅ 𝑎 (C – b)(mod 26)
<deciphering>
where 𝑎 is the modulo inverse of a.

Note: Decryption is possible if and only if


gcf(a, 26) = 1.
Inverse Modulo n (Modular Inverse)

In number theory,

we are interested in looking for the inverse


of a (denoted by b) such that

a . b ≡ 1 (mod n).
Example: In modulo 7, 2 is the inverse of 4
and vice versa since 2 . 4 ≅ 1 (mod 7)
Below is a list of the multiplicative inverse of
the 12 elements a of Z26 for which gcd(a,
26)=1.

a 1 3 5 7 9 11 15 17 19 21 23 25

𝑎 1 9 21 15 3 19 7 23 11 5 17 25
From the example: C ≡ 3P + 1 (mod 26),
find the formula for P.
Example:

Decrypt the cipher text AXNQY if an


affine cipher with Key = (7, 3) was used
for encryption.
Activity:

Compose a 2-stanza poem in


encrypted form using Affine
transformation.

To be submitted before we disperse


this afternoon.
51

More…
52

The Pigpen Cipher


The Pigpen cipher is another substitution cipher. But instead of
replacing each letter with another letter, the letters are replaced by
symbols. The symbols are assigned to the letters using the key
below. The letter shown is replaced by the part of the image in which
it is located. The decryption process is just the reverse of encryption
process.
53

Exercise:
• Using the Pigpen cipher, encrypt the
following:
a. Your “Name”
b. Your “ favorite food”
c. The statement “ I love mathematics”.
Essential Mathematics (For the
Modern World) by Nokon &
Nokon 2016

Lectures and Powerpoint


Presentations by Dr. Catherine
Vistro-Yu

Você também pode gostar