CS2050 L14 Modular Arithmetic
Overview
Abrahim Ladha develops modular arithmetic from integer divisibility, proving the division algorithm and showing that congruence modulo n is an equivalence relation with well-defined addition and multiplication. He distinguishes arithmetic on congruence classes from ordinary integer arithmetic, highlighting failures such as cancellation and the zero-product property, and explains why ordering and familiar root-counting intuitions do not generally carry over.
Key takeaways
- The division algorithm guarantees a unique decomposition n = dq + r for n ≥ 0 and d ≥ 1, with 0 ≤ r < d; its existence can be proved using the well-ordering principle.
- Congruence modulo n is defined by n dividing a − b, and it forms an equivalence relation whose classes are represented by the n possible remainders.
- Addition and multiplication of congruence classes are well-defined because replacing inputs with congruent representatives produces congruent sums and products.
- Modulo 6, 2·3 ≡ 0 even though neither factor is zero, and modulo 9, 3·2 ≡ 3·5 while 2 is not congruent to 5; zero-product and cancellation rules can fail.
- Changing the modulus changes the equivalence classes and the arithmetic: 1 ≡ 4 modulo 3 but not modulo 4, so chained operations across moduli need careful justification.
- Modular arithmetic has no useful inherited ordering, and a degree-four polynomial can have 32 roots modulo 80, far more than the familiar real-number root bound.
Chapters
- Number theory here concerns integers and natural numbers, where division is not always a defined integer operation.
- Define a divides b to mean there is an integer c such that ac = b.
- Divisibility is reflexive because a·1 = a and transitive because ak = b and bℓ = c imply a(kℓ) = c.
- Divisibility is not symmetric: 2 divides 6, but 6 does not divide 2; if a divides b, then a also divides bc for any integer c.
- Integer division is represented by n = dq + r, where q is the quotient and r is the remainder.
- For n ≥ 0 and d ≥ 1, the required remainder satisfies 0 ≤ r < d.
- For example, 30 divided by 7 gives q = 4 and r = 2, since 30 = 7·4 + 2.
- The division algorithm asserts that the quotient and remainder exist and are unique.
- Fix n ≥ 0 and d ≥ 1, then form S = {n − dx : x is an integer and n − dx ≥ 0}.
- The set S is nonempty because x = 0 gives n ∈ S, and it is a subset of the nonnegative integers.
- The well-ordering principle gives S a least element r, which has the form n − dq for some integer q.
- Rearranging yields n = dq + r, establishing a quotient and a nonnegative remainder.
- Because r belongs to S, it is already nonnegative.
- Assume r ≥ d and write r = d + t with t ≥ 0.
- Using r = n − dq gives t = n − d(q + 1), so t also belongs to S.
- Since d ≥ 1, t = r − d is smaller than r, contradicting r's minimality; therefore r < d.
- Suppose n = dq + r = dq′ + r′, with both remainders between 0 and d − 1.
- Rearrangement shows d(q − q′) = r′ − r, so d divides the difference between the remainders.
- Assume without loss of generality that r′ ≥ r; then 0 ≤ r′ − r < d, so the only possible multiple of d is 0.
- Thus r = r′, and the original equations then imply q = q′.
- For positive n, define a congruent to b modulo n exactly when n divides a − b.
- Reflexivity follows because n divides a − a = 0.
- For symmetry, if nk = a − b, then n(−k) = b − a, so b is congruent to a modulo n.
- The definition relies on integer divisibility, not on treating division as an integer-valued operation.
- If a is congruent to b and b is congruent to c modulo n, write nk = a − b and nℓ = b − c.
- Adding these equations gives n(k + ℓ) = a − c, proving transitivity.
- Modulo 3, the three classes are represented by 0, 1, and 2, containing integers of the forms 3x, 3x + 1, and 3x + 2.
- The division algorithm shows every integer belongs to one of these classes, and the classes partition the integers.
- Define the sum of the class of a and the class of c to be the class represented by a + c.
- If a ≡ b and c ≡ d modulo n, write nk = a − b and nℓ = c − d.
- Adding gives n(k + ℓ) = (a + c) − (b + d), so a + c ≡ b + d modulo n.
- Because changing representatives does not change the resulting class, addition is well-defined.
- Define the product of the classes of a and c as the class represented by ac.
- From a ≡ b and c ≡ d modulo n, write a = nk + b and c = nℓ + d.
- Expansion gives ac − bd = n(nkℓ + bℓ + kd), which is divisible by n.
- Therefore ac ≡ bd modulo n, so multiplication does not depend on the chosen representatives.
- Congruence classes preserve commutativity of addition and multiplication: a + b ≡ b + a and ab ≡ ba modulo n.
- Associativity holds for both operations, reflecting the corresponding integer identities.
- Distributivity also holds for modular addition and multiplication.
- The classes of 0 and 1 act as identities: a + 0 ≡ a and a·1 ≡ a modulo n.
- The zero-product property fails modulo 6: 2·3 ≡ 0, although neither 2 nor 3 is congruent to 0 modulo 6.
- Cancellation can fail modulo 9: 3·2 = 6 and 3·5 = 15 ≡ 6, while 2 is not congruent to 5 modulo 9.
- Thus 3x ≡ 3y modulo 9 does not by itself imply x ≡ y modulo 9.
- Ordinary real-number reasoning cannot be applied automatically to modular classes.
- A computer's remainder operator, such as 10 mod 7 = 3, reports the remainder from division; it is not the same as freely chaining congruence relations.
- Congruence depends on its fixed modulus: 1 ≡ 4 modulo 3, but 1 is not congruent to 4 modulo 4.
- Polynomial root counts can exceed the degree in modular arithmetic: x⁴ − 1 has 8 solutions modulo 15 and 32 modulo 80.
- Consequently, familiar expectations about cancellation and the number of polynomial roots require separate proof in each modular setting.
- Ordering is not meaningful for congruence classes because each class contains infinitely many integers; for example, the class of 0 modulo 3 also contains 3.
- Representatives such as 0, 1, and 2 are convenient labels for classes, not ordinary ordered numbers; Ladha compares their relationships to rock-paper-scissors.
- A discrete logarithm asks for an integer x satisfying gˣ ≡ y modulo n, but ordinary real logarithm techniques do not apply.
- Finding x may require brute force, and the discrete logarithm problem is computationally infeasible in general; modular proofs should rely only on justified properties.
Transcript excerpt
0:04 All right. This is CS 2050. The topic of today is Oh, we're on the new unit. Uh, and the topic is number theory. And this is just basic uh, divisibility properties and modular arithmetic. So, let's see. What is number theory? Um, So, the cool the the mathematical every unit is on like some kind of the work done around some mathematical object. You have a previous or at least you think you have a previous definition of what a number is. And a number is a quantity maybe it changes as a function of time or
0:50 something, right? And this is how with this uh, abstraction, with this definition of number, do you build up calculus and and things things like this? But in fact, this term is overloaded cuz this is a distinct concept from the number that we wish to refer to. The number that we want to talk about are integers, uh, and um, the natural numbers, right? So, number in the sense of a whole. And the relationship that numbers have with each other here is basically the essence of discrete mathematics because we're going to be working with a discrete notion of number, right? So, what this means is sometimes division is not defined. In fact, today we'll be defining two different kinds of addition that kind of work with integers. Um, but a lot of things that people think
1:36 work don't because the term number is overloaded. There's two different concepts that refer to a number. Number as if it is a quantity, something that is changing maybe as a function of time, and number in the more traditional classical original sense, which is just a number of things. You know, you can have seven bottles. You You have, you know, ln(x) bottles or something like
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Abrahim Ladha.