Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Notes on Modular Arithmetic: Definitions, Rules, and Applications, Study notes of Computer Science

These notes provide an introduction to the concepts of divisibility and modular arithmetic. How to determine if one number is divisible by another and defines modular arithmetic. It also covers rules for working with modular arithmetic, such as the congruence property and the behavior of multiplication. Examples and applications of modular arithmetic, including finding the inverse of a number modulo 26 and solving equations involving congruences.

Typology: Study notes

Pre 2010

Uploaded on 11/08/2009

koofers-user-fh7
koofers-user-fh7 🇺🇸

10 documents

1 / 3

Toggle sidebar

Related documents


Partial preview of the text

Download Notes on Modular Arithmetic: Definitions, Rules, and Applications and more Study notes Computer Science in PDF only on Docsity! Notes about mod Arup Guha First we’ll define divisibility. We say that a | b if and only if there is some integer c such that b = ac. In English, “a | b” would be read as “b is divisible by a.” For example, 6 | 18, 197 | 0 and 34 | 34. Now, let’s define mod: a ≡ b (mod n) if and only if n | (a – b). (This just means there exists some integer c such that a – b = nc.) In essence, this is true if n divides evenly into the difference of a and b. Alternatively, we can think of it as follows: when a and b are divided by n, they leave the same remainder. In our class, typically we will make some mathematical calculation and then we’d like to know what letter a particular number corresponds to. What we really want is give some integer a, we want to find a value b such that 0 ≤ b < 26 and a ≡ b (mod 26). For example, if we get 194 after some calculation and want to know what letter it is, our goal is to find the unique value of b such that 194 ≡ b (mod 26), with 0 ≤ b < 26 We can determine that 194 ≡ 12 (mod 26). We can verify this because 194 – 12 = 182 and 182 = 26x7. The easy way to find b when the starting value is greater than 26 is to divide 26 into the number. When we divide 26 into 194, it goes in 7 times, leaving a remainder of 12, which is our desired value. Consider a second example: -85 ≡ b (mod 26), with 0 ≤ b < 26 By dividing, we find that -85 ≡ -7 (mod 26), since -85 – (-7) = -78 and -78 = 26x(-3), but we also see that we haven’t gotten the desired value of b either. We can simply add 26 to -7 to do that, since adding or subtracting multiples of 26 will “create” other values equivalent to the original. Thus, we have: -85 ≡ -7 ≡ 26 – 7 ≡ 19 (mod 26) Now, let’s look at some rules with mod: if a ≡ b (mod n), then a + c ≡ b + c (mod n) if a ≡ b (mod n), then ac ≡ bc (mod n) and ac ≡ bc (mod cn), but this latter fact is rarely used if a ≡ b (mod n), then ak ≡ bk (mod n) if a ≡ b (mod n) and c ≡ d (mod n), then a+c ≡ b+d (mod n), and ac ≡ bd (mod n) These are fairly straight-forward to apply. However, division rules are tricky since we are now dealing with integers. If we have a situation such as 3a ≡ 16 (mod 26) we deal with it by multiplying through by the inverse of 3 (mod 26) which is 9, to yield the following equation: 9(3a) ≡ 9(16) (mod 26) 27a ≡ 144 (mod 26) a ≡ 14 (mod 26) Here is a list of the inverses mod 26: 1 3, 9 5, 21 7, 15 11, 19 17, 23 25 (Note: 1 is an inverse of itself as is 25. The rest are pairs, so 3 is the inverse of 9 and 9 is the inverse of 3 (mod 26), etc.) But what about an equation like 4a ≡ 14 (mod 26) or 4a ≡ 7 (mod 26) This literally means: 4a – 14 = 26c, for some int c. 4a – 7 = 26c, for some int c 2a – 7 = 13c, so 7 = 4a – 26c 2a ≡ 7 (mod 13) is all we can 7 = 2(2a – 13c), which is impossible ascertain, the following above since 7 is NOT divisible by 2. implies that a ≡ 10 (mod 13), which can be determined by multiplying through by 7.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved