You are on page 1of 5

Mathematical System

-set with one or more binary operations defined on it.


Binary operations is a rule that assigns to 2 elements of a set a unique third element.
Ex: 5 + 7 ≡ 12; 4 - 4 ≡ 0

A. Modular Arithmetic
-is a special type of arithmetic that involves only integers. Where numbers wrap around upon reaching a
certain value, which is the modulus.
I. Introduction
a ≡ b (mod n)
1. a and b have the same "remainder" when they are divided by n.
2. a ≡ k • n + b
3. n | (a - b)

EX1:
10 ≡ 14 (mod 4)
1. a ≡ b (mod n)
10 ÷ 4 ≡ 2 R2
14 ÷ 4 ≡ 3 R2

2. a ≡ k • n + b
10 ≡ -1 • 4 + 14

3. n | (a - b)
4 | (10 - 14)
4 | (-4)
-4 ≡4 (-1)

EX2:
7 + 8 ≡ 3 (mod 12)

1. a ≡ b (mod n)
7 + 8 ≡ 3 (mod 12)
15 ≡ 3 (mod 12)
15 ÷ 12 ≡ 1 R3
3 ÷ 12 ≡ 0 R.25/ R3

2. a ≡ k • n + b
15 ≡ 1 • 12 + 3

3. n | (a - b)
12 | (15 - 3)
12 | (12)
12 ≡ 12 (1)
B. Applications of Modular Arithmetic
I. ISBN numbers for published books.
The ISBN number for our textbook is 0-13-184-868-2.
The information is decoded in the first 9 digits. The last digit is for parity
check
(1 x a1) + (2 x a2) ... + (9 x a9) = a10 (mod 11)
Applying this to our textbook
(1 x 0) + (2 x 1) + (3 x 3) + (4 x 1) + (5 x 8) + (6 x 4) + (7 x 8) + (8 x 6) + (9 x
8) = 255 = 2 mod 11
The sum of 9 digits is 255 and it equals to the last digit mod 11.

II. IBAN (International Bank Account Number)


An IBAN is validated by converting it into an integer and
performing a basic mod-97 operation
The algorithm of IBAN validation is as follows:[8]

1. Check that the total IBAN length is correct as per


the country. If not, the IBAN is invalid
2. Move the four initial characters to the end of the
string
3. Replace each letter in the string with two digits,
thereby expanding the string, where A = 10, B = 11, ..., Z = 35
4. Interpret the string as a decimal integer and compute the remainder of that number on
division by 97
If the remainder is 1, the check digit test is passed and the IBAN might be valid.
Example (fictitious United Kingdom bank, sort code 12-34-56, account number 98765432):
• IBAN: GB82 WEST 1234 5698 7654 32

• Rearrange: W E S T12345698765432 G B82

• Convert to integer: 3214282912345698765432161182

• Compute remainder: 3214282912345698765432161182 mod 97 = 1

Example
In this example, the above algorithm for D mod 97 will be applied
to D = 3214282912345698765432161182. (The digits are colour-coded to aid the description below.)
If the result is one, the IBAN corresponding to D passes the check digit test.
1. Construct N from the first 9 digits of D
N = 321428291

2. Calculate N mod 97 = 70
3. Construct a new 9-digit N from the above result (step 2) followed by the next 7 digits
of D.
N = 702345698

4. Calculate N mod 97 = 29
5. Construct a new 9-digit N from the above result (step 4) followed by the next 7 digits
of D.
N = 297654321

6. Calculate N mod 97 = 24
7. Construct a new N from the above result (step 6) followed by the remaining 5 digits of D.
N = 2461182

8. Calculate N mod 97 = 1
From step 8, the final result is D mod 97 = 1 and the IBAN has passed this check digit test.

III. Cryptography
In cryptography, modular arithmetic directly underpins public key systems such
as RSA and Diffie–Hellman, and provides finite fields which underlie elliptic curves, and is used in a
variety of symmetric key algorithms including Advanced Encryption Standard (AES), International
Data Encryption Algorithm (IDEA), and RC4. RSA and Diffie–Hellman use modular exponentiation.
RSA

-invented by Clifford Cocks, and later independently, Rivest, Shamir, Adleman

IV. Computer algebra


Modular arithmetic is commonly used to limit the size of integer coefficients in intermediate
calculations and data. It is used in polynomial factorization, a problem for which all known efficient
algorithms use modular arithmetic. It is used by the most efficient implementations of polynomial
greatest common divisor, exact linear algebra and Gröbner basis algorithms over the integers and
the rational numbers.

V. In computer science, modular arithmetic is often applied in bitwise operations and other
operations involving fixed-width, cyclic data structures. The modulo operation, as implemented in
many programming languages and calculators, is an application of modular arithmetic that is often
used in this context. The logical operator XOR sums 2 bits, modulo 2.

VI. In music, arithmetic modulo 12 is used in the consideration of the system of twelve-tone equal
temperament, where octave and enharmonic equivalency occurs (that is, pitches in a 1∶2 or 2∶1 ratio
are equivalent, and C-sharp is considered the same as D-flat).
VII. The method of casting out nines offers a quick check of decimal arithmetic computations
performed by hand. It is based on modular arithmetic modulo 9, and specifically on the crucial
property that 10 ≡ 1 (mod 9).

VIII. Arithmetic modulo 7


-used in algorithms that determine the day of the week for a given date. In particular, Zeller's
congruence and the Doomsday algorithm make heavy use of modulo-7 arithmetic.

0 denotes 7n: 0, 7, 14, 21, ….

1 denotes 7n + 1: 1, 8, 15, 22, …...

2 denotes 7n + 2: 2, 9, 16, 23, ….

3 denotes 7n + 3: 3, 10, 17, 24, ….

4 denotes 7n + 4: 4, 11, 18, 25, ….

5 denotes 7n + 5: 5, 12, 19, 26, ….

6 denotes 7n + 6: 6, 13, 20, 27, ….

Examples:

1 + 4 ≡ 5 (mod 7) Monday + 4 ≡ Friday

2 + 5 ≡ 0 (mod 7) Tuesday + 5 ≡ Sunday

6 + 2 ≡ 1 (mod 7) Saturday + 2 ≡ Monday

Day of the week

-one way to determine the day of the week of a given date is to assign codes to the years, months and
dates such that:
Day of the week ≡ year code

+ month code

+ date (mod 7)

You might also like