0% found this document useful (0 votes)
36 views32 pages

Math 101 PPT 5 Codes

Uploaded by

damrheyaurin8
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)
36 views32 pages

Math 101 PPT 5 Codes

Uploaded by

damrheyaurin8
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/ 32

Evolve.

Adapt.
Overcome.
CEFI is now ready.

MODULE 5 :
Codes

MATH 101 : Mathematics in the Modern


World

ISAAC M. SUBELDIA
College of Liberal Arts, Sciences, and Education
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Focus:
❑ Cryptography
❑ Modular Arithmetic

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Module 5 | Target Learning Outcomes:


❑Use coding schemes to encode and decode different types of
information for identification, privacy, and security purposes
❑Exemplify honesty and integrity when using codes for security
purposes

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
(practice and study of techniques for secure communication)

https://www.bartleby.com/subject/engineering/computer-
science/concepts/cryptography

LESSON:
Cryptography
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Cryptography

❑ When people need to secretly store or communicate messages, they


turn to cryptography.
❑ Cryptography involves using techniques to obscure a message so
outsiders cannot read the message.

It is typically split into two steps:


1. Encryption - in which the message is obscured.
2. Decryption - in which the original message is recovered from the
obscured form.

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Encryption vs. Decryption

MATH ENCRYPTION PDWK


message is obscured

MATH DECRYPTION PDWK


message is recovered
from the obscured form

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Substitution Cypher

❑ A simple cipher replaces each letter in the message with a different


letter, following some established mapping.
❑ A simple example of substitution cipher is called the Caesar cipher
(shift cipher).

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Caeser Cypher

❑ In this approach, each letter is replaced with a letter some fixed


number of positions later in the alphabet.
❑ For example, if we use a shift of 3, then the letter A would be
replaced with D, the letter 3 positions later in the alphabet. The
entire mapping would look like

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Caeser Cypher

Use the Caesar cipher with shift of 3 to encrypt the message: “We ride at noon”.
We use the mapping above to replace each letter. W gets replaced with Z, and so forth. giving the
encrypted message:
“We ride at noon” = “ZH ULGH DW QRRQ”

Noticed that the length of the words could give an important clue to the cipher shift used. To
obscure the message, the letters are often rearranged into equal sized blocks.
Example: ZHU LGH DWQ RRQ
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Practice: Caeser Cipher

1. “I will do my best”
L ZLOO GR PB EHVW

2. “I will be successful someday”


L ZLOO EH VXFFHVVIXO VRPHGDB

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Transposition Cipher

❑ A transposition is one in which the order of characters is changed


to obscure the message. (plain text letters)
❑ An early version of transposition cipher was a Scytale, in which
paper was wrapped around a stick and the message was written.
Once unwrapped, the message would be unreadable until the
message was wrapped around a same-sized stick again.
❑ One modern transposition cipher is done
by writing message in rows, then forming the
encrypted message from the text in the columns.
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
https://mathstats.uncg.edu/sites/pauli/112/HTML/subsecmo
darithmetic.html

LESSON:
Modular Arithmetic
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Modular Arithmetic

❑ Modulus is another name for the remainder after division.


For example, 17 mod 5 = 2, since if we divide 17 by 5, we get 3 with
remainder of 2.
The remainder 2 is referred to as the modulo..
❑ Modular arithmetic is sometimes called clock arithmetic, since
analog clocks wrap around times past 12, meaning they work on
modulus of 12.
If the hour hand of a clock currently points to 8, then 5 hours it will
point to 1. While 8 + 5 = 13, the clock wraps around after 12, so all
times can be thought of as modulus 12. Mathematically, 8 + 5 = 13
mod 12 = 1, since if we divide 13 by 12, we get 1 with remainder of
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
1. permission in writing from the author or lecturer.
or otherwise, without
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Mathematicians

❑ 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

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Practice: Modulo

1. 10 mod 3 Since 10 divided by 3 is 3 with remainder 1, 10 mod 3 = 1

Since 15 divided by 5 is 3 with no remainder 0, 15 mod 5 = 0


2. 15 mod 5

27 = 128. 128 divide by 5 is 25 with remainder 3, so 27 mod 5 = 3


3. 27 mod 5

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Tables in Modular Arithmetic

STEP 1: Define the set in the given modulus.


Set of values used in:
mod 2 are {0, 1}
mod 3 are {0, 1, 2}
mod 4 are {0, 1, 2, 3}
mod 5 are {0, 1, 2, 3, 4}
STEP 2: Draw the table using the set defined. (ex. mod 3 = {0, 1, 2}

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Constructing Modulo Tables

Constructing Addition and Multiplication table for Z3


In Z3 = {0, 1, 2}
0 + 0 = 0 mod 3 = 0 0 * 0 = 0 mod 3 = 0
+ 0 1 2 x 0 1 2
0 + 1 = 1 mod 3 = 1 0 * 1 = 0 mod 3 = 0
0 0 1 2 0 0 0 0
0 + 2 = 2 mod 3 = 2 0 * 2 = 0 mod 3 = 0
1 1 2 0 1 0 1 2
2 2 0 1 2 0 2 1

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

PRACTICE: Modulo Tables


In Z4 = {0, 1, 2, 3}
Addition
In Z4 = {0, 1, 2, 3}
+ 0 1 2 3 Multiplication
0 0 1 2 3 x 0 1 2 3
1 1 2 3 0 0 0 0 0 0
2 2 3 0 1 1 0 1 2 3
3 3 0 1 2 2 0 2 0 2
3 0 3 2 1
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Equivalence Relations
The following are equivalent to each other and may be used
interchangeably.
𝐀 ≡ 𝐁 (𝐦𝐨𝐝 𝐂) 𝟏𝟑 ≡ 𝟐𝟑 (𝐦𝐨𝐝 𝟓)
A mod C = B mod C 13 mod 5 = 23 mod 5

𝐂ȁ 𝐀 − 𝐁 𝟓ȁ𝟏𝟑 − 𝟐𝟑
−10
(means that “A - B is divisible by C”) (5ȁ−10, = −2)
5

𝐀=𝐁+𝐊∗𝐂 𝟏𝟑 = 𝟐𝟑 + 𝐊 ∗ 𝟓
(We can satisfy this with K = -2;
(where K is some integer)
13 = 23 + (−2) ∗ 5)
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Solving Congruence

1. No Solution
2. One Solution
3. Many Solution

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

1. Solving Congruence: No Solution

𝟐𝐱 ≡ 𝟓𝟏 (𝐦𝐨𝐝 𝟖)

Find GCD of 2 and 8;


2 = 1, 2
8 = 1, 2, 4, 8

will 2 divide 51 exactly?


NO, Therefore it has NO SOLUTION.

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

2A. Solving Congruence: One Solution

• Find the lowest number


𝟒𝐱 ≡ 𝟐𝟔 (𝐦𝐨𝐝 𝟕) 𝟒𝐱 ≡ 𝟐𝟔 (𝐦𝐨𝐝 𝟕) that you can replace to 26
by subtracting 7 to 26; that
𝟒𝐱 ≡ 𝟏𝟐 (𝐦𝐨𝐝 𝟕) is divisible by 4 : 26 - 7 =
Find GCD of 4 and 7; 𝐱 ≡ 𝟑 (𝐦𝐨𝐝 𝟕) 19 - 7 = 12 - 7 = 5 - 7 = -2 ;
since 12 is divisible by 4,
4 = 1, 4 replace 26 by 12.

7 = 1, 7
1 Solution:
b = 7t + 3
will 1 divide 26 exactly? b = 7(0) + 3
YES, Therefore it has 1 SOLUTION. b=3

𝐱 ≡ 𝐛 𝐦𝐨𝐝 𝐂
𝐱 ≡ 𝟑 𝐦𝐨𝐝 𝟕
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

2B. Solving Congruence: One Solution


𝟐𝟓𝐱 ≡ 𝟏𝟓 (𝐦𝐨𝐝 𝟐𝟗)
• Divide by 5
𝟐𝟓𝐱 ≡ 𝟏𝟓 (𝐦𝐨𝐝 𝟐𝟗) 𝟓𝐱 ≡ 𝟑 (𝐦𝐨𝐝 𝟐𝟗) • Find the lowest number
𝟓𝐱 ≡ −𝟓𝟓 (𝐦𝐨𝐝 𝟐𝟗) that you can replace to 3
𝐱 ≡ −𝟏𝟏 (𝐦𝐨𝐝 𝟐𝟗) by subtracting 29 to 3;
Find GCD of 25 and 29; that is divisible by 5 : 3
𝐱 ≡ 𝟏𝟖 (𝐦𝐨𝐝 𝟐𝟗) -29 = -26 -29 = -55 -29
25 = 1, 5, 25 = -84 ;
since (-55) is divisible
29 = 1, 29 1 Solution: by 5, replace 3 by (-
55).
b = 29t + 18 • Just add 29 to replace -
11 by a positive number
will 1 divide 15 exactly? b = 29(0) + 18
b = 18
YES, Therefore it has 1 SOLUTION.
𝐱 ≡ 𝐛 𝐦𝐨𝐝 𝐂
𝐱 ≡ 𝟏𝟖 𝐦𝐨𝐝 𝟐𝟗
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

3A. Solving Congruence: Many Solution


• Notice that all numbers can
be divided by 3. So to
𝟗𝐱 ≡ 𝟒𝟐 (𝐦𝐨𝐝 𝟔) simplify it divide all by 3.
𝟗𝐱 ≡ 𝟒𝟐 (𝐦𝐨𝐝 𝟔) 𝟑𝐱 ≡ 𝟏𝟒 (𝐦𝐨𝐝 𝟐) • Find the lowest number that
you can replace to 14 by
𝟑𝐱 ≡ 𝟎 (𝐦𝐨𝐝 𝟐) subtracting 2 to 14; that is
𝐱 ≡ 𝟎 (𝐦𝐨𝐝 𝟐) divisible by 3 : 14 -2 = 12 -
Find GCD of 9 and 6; 2 = 10 -2 = 8 -2 = 6 ,
(continuation) 6 -2 = 4 -2 =
2 -2 = 0 -2 = -2;
9 = 1, 3, 9 since 0 is the lowest
3 Solutions: number divisible by 3,
6 = 1, 2, 3, 6 b = 2t + 0 replace 3 by (0).

b = 2(0) + 0 b = 2(1) + 0 b = 2(2) + 0


b=0 b=2 b=4
will 3 divide 42 exactly?
YES, Therefore it has 3 SOLUTIONS. 𝐱 ≡ 𝟎 𝐦𝐨𝐝 𝟔
𝐱 ≡ 𝟐 𝐦𝐨𝐝 𝟔
𝐱 ≡ 𝟒 𝐦𝐨𝐝 𝟔
No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Modular Addition & Substraction


Addition property of modular arithmetic:
(A + B) mod C = (A mod C + B mod C) mod C

EXAMPLE:

(A + B) mod C (A mod C + B mod C) mod C


= (14 + 17) mod 5 = (14 mod 5 + 17 mod 5) mod 5
= 31 mod 5 = (4 + 2) mod 5
=1 =1

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

PRACTICE: Modular Addition

A. In Z8
4 + 9 = 13. Since 13 divided by 8 is 1 with remainder 5, so 4 + 9 mod 8 = 5
1. 4 + 9

15 + 21 = 36. Since 36 divided by 8 is 4 with remainder 4, so 15 + 21 mod 8 = 4


2. 15 + 21

11 + 12 = 23. Since 23 divided by 8 is 2 with remainder 7, so 11 + 12 mod 8 = 7


3. 11 + 12

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Modular Multiplication
Multiplication property of modular arithmetic:
(A * B) mod C = (A mod C * B mod C) mod C

EXAMPLE:

(A * B) mod C (A mod C * B mod C) mod C


= (4 * 7) mod 6 = (4 mod 6 * 7 mod 6) mod 6
= 28 mod 6 = (4 * 1) mod 6
=4 = 4 mod 6
=4

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

PRACTICE: Modular Multiplication

A. In Z8
12 * 3 = 36. Since 36 divided by 8 is 4 with remainder 4, so 12 * 3 mod 8 = 4
1. 12 * 3

28 * 12 = 336. Since 336 divided by 8 is 42 with no remainder, 28 * 12 mod 8 = 0


2. 28 * 12

14 * 6 = 84. Since 84 divided by 8 is 10 with remainder 4, so 14 * 6 mod 8 = 4


3. 14 * 6

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Binary System
❑ Developed by Gottfried Wilhelm Leibniz, a German
mathematician.
❑ Binary numeral system, a method of mathematical
expression which uses only two symbols: typically "0" (zero)
and "1" (one).
❑ Here each new digit is 2x greater than the digit to its right.
Example: 10011011

x512 x256 x128 x64 x32 x16 x8 x4 x2 x1 ADD:


155 - 128 = 27
27 - 16 = 11
1 0 0 1 1 0 1 1
11 - 8 = 3
ADD: 3-2=1
128 + 16 + 8 + 2 + 1 = 155 1-1=0
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Module 5 | Learning Reference(s):


❑ Acevedo, R. (2018). Mathematics in the Modern World. Quezon City: Rex Bookstore
❑ Alejan, R. (2018). Mathematics in the Modern World. Malabon City: Mutya Publishing House.
❑ Aufmann, R., et.a. (2018). Mathematics in the Modern World. Manila: Rex Bookstore, Inc.
❑ Carpio, J. (2018). Mathematics in the Modern World. Mandaluyong City: Books Atbp Publishing
Corp.
❑ Jamison, R.E. (2000). Learning the language of Mathematics. Language and Learning across the
disciplines, 4(1), 45-54
❑ Nocon, R. (2018). Essential mathematics for the modern world. QuezonCity: C & E Publishing, Inc.
❑ Sirug, W.(2018). Mathematics in the Modern World-CHED curriculum complaint. Intramuros,
Manila: Mindshapers Co.

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
COLLEGE OF LIBERAL ARTS, SCIENCES, & EDUCATION
Calayan Educational Foundation, Inc.

Module 5 | Learning Tasks:


Activity
1. Activity 7: Analyzing Codes

Quiz
1. Quiz 5: Modular ARithmetic

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.
Thank You!

No part of this material may be reproduced, stored in a retrieval system or transmitted in any form or by any means – electronic, mechanical, photocopying, recording
or otherwise, without permission in writing from the author or lecturer.

You might also like