Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
44 views41 pages

Coding Theory and Modular Arithmetic

The document discusses coding theory and modular arithmetic. It defines coding theory as the study of codes and their applications in data compression, cryptography, error detection and correction. It also defines congruence in modular arithmetic and provides examples of verifying congruences.

Uploaded by

Mallows
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views41 pages

Coding Theory and Modular Arithmetic

The document discusses coding theory and modular arithmetic. It defines coding theory as the study of codes and their applications in data compression, cryptography, error detection and correction. It also defines congruence in modular arithmetic and provides examples of verifying congruences.

Uploaded by

Mallows
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Our lady of Fatima university

COLLEGE OF ARTS AND SCIENCES


Math and Physics Department

MATM111
MATHEMATICS AS A TOOL:
Coding Theory and Modular Arithmetic
V. Mathematics as a Tool: Coding Theory & Modular Arithmetic

Coding Check
Theory and Cryptography Codes and
Modular Digits
Arithmetic

Learning Outline
V. Mathematics as a Tool: Coding Theory & Modular Arithmetic

At the end of the chapter the students are expected:

Perform the coding of a word text using the


different method.

Decrypt the different message.

Learning Outcomes
LESSON 1:
CODING
THEORY
CODES AND CRYPTOGRAPHY
Coding Theory
Coding theory is the study of the properties of codes and their respective fitness for
specific applications. Codes are used for data compression, cryptography, error detection
and correction, data transmission and data storage.
Codes are studied by various scientific disciplines, such as information
theory, electrical engineering, mathematics, linguistics, and computer science—for the
purpose of designing efficient and reliable data transmission methods.
This typically involves the removal of redundancy and the correction or detection of
errors in the transmitted data.
CODES AND CRYPTOGRAPHY
Coding Theory
The communication system composed of sender (or message source),
communication channel, and the receiver.
Communication Channel
 Is the physical medium through which information is transmitted.
 Ex: telephone lines, internet cables, fiber-optic lines, and air. Some
storage data can be considered channels (CD-ROMS, hard drives).
Noises
 It alters the message in the channel that will cause disruption and error
in the messages.
CODES AND CRYPTOGRAPHY
Coding Theory
The communication system composed of sender (or message source),
communication channel, and the receiver.
Source Coding and Channel Coding
 In transmitting messages, coding is defined as source coding and channel
coding.
Two Processes in Coding
 Encoding is transforming messaged into bits of message that is cuitable
in communication.
 Decoding is the opposite process of encoding.
CODES AND CRYPTOGRAPHY
Coding Theory
DATA COMPRESSION OR SOURCE ENCODING
is defined as converting the message from the
sender into bits suitable to the
communication channel.

- bit (short for "binary digit") is the


smallest unit of measurement used to quantify
computer data. It contains a single binary
value of 0 or 1.

An example of this is the ASCII (AMERICAN


STANDARD CODE INFORMATION INTERCHANGE) that
converts each character int the message to a
byte of 8 bits.
Binary-Coded Decimal (BCD)
Decimal Binary Pattern

• Four bits per digit 8421


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Decimal, Binary, and Hexadecimal conversion
Decimal Binary Hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
ASCII Chart
95 Graphic codes
33 Control codes
Alphabetic codes
Numeric codes
Punctuation, etc.
e.g., ‘a’ = 1100001

Introduction to Information Technologies


“Hello, world” Example

Binary Hexadecimal Decimal


H = 01001000 = 48 = 72
e = 01100101 = 65 = 101
l = 01101100 = 6C = 108
l = 01101100 = 6C = 108
o = 01101111 = 6F = 111
, = 00101100 = 2C = 44
= 00100000 = 20 = 32
w = 01110111 = 77 = 119
o = 01100111 = 67 = 103
r = 01110010 = 72 = 114
l = 01101100 = 6C = 108
d = 01100100 = 64 = 100
CODES AND CRYPTOGRAPHY
Coding Theory
In most computer systems,
a byte is a unit of data that is
eight binary digits long. A byte is EXAMPLE
the unit most computers use to Consider the source encoding of four
represent a character such as a directions as follows:
letter, number or typographic NORTH - 00
symbol. SOUTH - 01
EAST - 10
WEST - 11
CODES AND CRYPTOGRAPHY
Coding Theory
EXAMPLE
Consider the source encoding of four
Suppose the message “NORTH”,
directions as follows:
which is encoded as 00, is
NORTH - 00
transmitted over a noisy channel.
SOUTH - 01
EAST - 10 The message may encounter errors
WEST - 11 and may be received as 01. The
receiver will get the message 01 and
decode it as “SOUTH” without
realizing that the message is
corrupted
CODES AND CRYPTOGRAPHY
Coding Theory
With this problem at hand, additional process of encoding is required
known as Channel Coding.
CODES AND CRYPTOGRAPHY
Coding Theory
Channel Coding
 Is defined as adding some form of redundancy to the source encoded message so
that the errors can be detected or even corrected.
Parity Check
 Parity check is also called as “Vertical Redundancy Check (VRC)”
 Where in single bit is added to the message as redundancy bit.
 A bit string is said to have an odd parity if there is an odd
number of 1s.
 Even parity if there is an even number of 1s. We add
redundancy bit to message such that it will become an even
parity.
Synchronous Data Transfer
CODES AND CRYPTOGRAPHY
Coding Theory
Repetition Code: ENCODING
 In coding theory, the repetition code is one of the most basic error-correcting codes.
 In order to transmit a message over a noisy channel that may corrupt the
transmission in a few places, the idea of the repetition code is to just repeat the
message several times.
 Suppose that the source encoding is already done and that the encoded message is of
fix length k. The channel encoding by repetition is performed by taking the k bits then
repeating it 2r + 1, where r is greater than or equal to 1 is a fixed integer.
Example
Suppose that the source encoded message is 110 where k=3. If you choose r= 2 , the
message must be repeated 2r +1 = 2(2) + 1 or 5 times.
This will result to 110110110110110
CODES AND CRYPTOGRAPHY
Coding Theory
Repetition Code: DECODING
Example: Assume that the message transmitted through a noisy channel and
distorted. The received message is 111001101110010 .The channel encoding
uses repetition code where k= 3. Decode the received message.

Solution: 111 001 101 110 010


- Consider the most frequent bit in positions 1,4,7,10, and 13
– Consider the most frequent bit in positions 2,5,8,11,and 14
– Consider the most frequents bit in positions 3, 6, 9, 12, and 15
111/001/101/110/010
1 2 3 / 4 5 6/7 8 9 /10 11 12 /13 14 15
Decoded Message : 111
Our lady of Fatima university
COLLEGE OF ARTS AND SCIENCES
Pampanga Campus
MODULAR ARITHMETIC

Is a system of arithmetic for


integers, which considers the
WHAT IS remainder.
MODULAR
ARITHMETIC ? In modular arithmetic, numbers
"wrap around" upon reaching a
given fixed quantity (this given
quantity is known as the modulus) to
leave a remainder.
CONGRUENCE

Let a and b are integers and m is a


natural counting number.

WHAT IS a IS CONGUENT TO b MODULO m”


CONGRUENCE? a ≡ b (mod m), IF m DIVIDES a - b
OR b - a

Example: Verify if the


congruence is true
4 ≡ 9(mod 2)
Verify if the following congruence
are true

34 ≡ 15(mod 3)

CONGRUENCE
54 ≡ 19(mod 5)

7 ≡ 55(mod 4)
RECITATION
I. Verify if the following congruence are true.

1. 3 ≡ 9 (mod 2) It is true since 9 – 3 = 6, which is divisible by 2.


2. 4 ≡ 15 (mod 3) It is false since 15 – 4 = 11, which is divisible by 3.
3. 7 ≡ 15 (mod 4) It is true since 15 – 7 = 8, which is divisible by 4.
4. 5 ≡ 20 (mod 3) It is true since 20 – 5 = 15, which is divisible by 3.
5. 4 ≡ 20 (mod 3) It is false since 20 – 4 = 16, which is divisible by 3.
Least Residue

To determine the least residue is to


simply get the remainder when b is
divided by m.
What is Least
Residue? b(mod m) means b divided by m.
m is referred to as the modulus (divisor)

Find the least residue, r


r= 54(mod 7)
Determine the least residue
of 89 (mod 9)

Sample : Determine the least residue


Finding the of 120 (mod 10)

least Residue
Determine the least residue
of 18 (mod 20)
RECITATION
II. Solve the least residue of the following.

1. 29 (mod 3) Answer is 2, since 2 is the remainder of 29/3.


2. 35 (mod 4) Answer is 3, since 3 is the remainder of 35/4.
3. 50 (mod 7) Answer is 1, since 1 is the remainder of 50/7.
4. 30 (mod 4) Answer is 2, since 2 is the remainder of 30/4.
5. 25 (mod 5) Answer is 0, since there is no remainder of 25/5.
MODULAR ARITHMETIC
EXAMPLE 4
• Determine the least residue of 120(mod10)
• Since 120 is exactly divisible by 10 .The
least residue of 120 (mod 10) = 0.
• EXAMPLE 5
• Determine the least residue of 32(mod 40)
• Dividing 32 by 40 will give a quotient of 0
and a remainder of 32. Therefore, the least
residue of 32(mod40)=32.
Modulo addition is defined as
(a+b)mod m

Modulo subtraction is defined


OPERATIONS IN as (a-b)mod m
MODULAR
ARITHMETIC Modulo multiplication is defined
as (a*b) mod m

Modulo division is defined


as (a/b) mod m
a) (18 – 4)(mod 5)

b) (31 + 7)(mod 3)
Solving expressions
involving Modular
c) 12 – 5(mod 3)
Arithmetic

d)15 –( 11+12)(mod 13)


RECITATION
III. Solve the following modular arithmetic

1. (10 – 4) (mod 5) 1
2. (11 + 7) (mod 3) 0
3. (8 + 7) (mod 7) 1
4. (20 – 7) (mod 5) 3
5. (31 – 6) (mod 4) 1
Write your complete solution
Encode:
1. 101 r = 3
2. 110 r = 2
DECODE WHERE k=3
a) 101 101 011 100 110
b) 010 010 001 010 011
Determine the least residue
1. (10 – 4) (mod 5)
2. (11 + 7) (mod 3)
3. (8 (2)+ 14/2) (mod 7)
GO FLEX!

You might also like