Modular Arithmetic
- 55Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
How can the familiar rules for adding even and odd numbers be understood using arithmetic modulo 2?
55 questions
- 1
How can the familiar rules for adding even and odd numbers be understood using arithmetic modulo 2?
Model answer
Modulo 2, an even number has remainder 0 and an odd number has remainder 1. Adding these remainders explains why even plus even is even and even plus odd is odd.
Explanation
Arithmetic modulo 2 tracks only remainders after division by 2, so parity is determined by those remainders.
- 2
What does the notation a≡b(modn) mean?
Model answer
It means that the integers a and b differ by an integer multiple of n.
Explanation
This is the defining relationship for congruence modulo n.
- 3
State the division algorithm for an integer a and a positive integer n.
Model answer
There is a unique pair of integers q and r such that a=qn+r, where 0≤r<n.
Explanation
The quotient is q and the remainder is r; the remainder must be one of 0,1,…,n−1.
- 4
How can congruence modulo n be characterized using remainders?
Model answer
a≡b(modn) if and only if a and b have the same remainder when divided by n.
Explanation
Equal remainders make the difference a multiple of n, and a difference that is a multiple of n forces the remainders to match.
- 5
Why do equal remainders imply that two integers are congruent modulo n?
Model answer
If a=qn+r and b=q′n+r, then a−b=(q−q′)n, an integer multiple of n.
Explanation
The shared remainder cancels when the two division-algorithm expressions are subtracted.
- 6
Why does congruence modulo n imply equal remainders?
Model answer
Writing a=qn+r and b=q′n+r′, their difference is (q−q′)n+(r−r′). Since a−b is a multiple of n and −n<r−r′<n, the only possibility is r−r′=0.
Explanation
The only multiple of n strictly between −n and n is 0, so the remainders must be equal.
- 7
How does the clock interpretation explain why 12≡5(mod7)?
Model answer
On a clock with positions 0 through 6, moving 12 steps from 0 ends at the same position as moving 5 steps, because 12 makes one full circuit plus 5 steps.
Explanation
The two numbers have the same remainder modulo 7, so they land at the same clock position.
- 8
What does it mean to say that two integers belong to the same congruence class modulo n?
Model answer
They have the same remainder when divided by n, so modular arithmetic treats them as equivalent.
Explanation
For example, 12 and 5 represent the same position modulo 7.
- 9
Why can a modular-arithmetic calculation use different integers with the same remainder interchangeably?
Model answer
Modular arithmetic tracks remainders rather than the number of times a value has gone around the modulus, so integers with the same remainder represent the same modular value.
Explanation
This is the remainder-based meaning of congruence and the basis of the clock analogy.
- 10
How is multiplication performed modulo n?
Model answer
Multiply as usual, then subtract or add multiples of n to reduce the result to a remainder between 0 and n−1.
Explanation
The same approach applies to addition: do the ordinary operation first, then reduce modulo n.
- 11
Use remainders to explain why 10⋅12≡1(mod7).
Model answer
Since 10≡3(mod7) and 12≡5(mod7), their product has the same remainder as 3⋅5=15, which is 1 modulo 7.
Explanation
Indeed, 10⋅12=120, and 120 leaves remainder 1 when divided by 7.
- 12
What does the congruence of a product say about the remainders of its factors?
Model answer
If the factors have remainders u and v modulo n, their product has the same remainder as uv modulo n.
Explanation
The actual values of the factors do not matter beyond their remainders when determining the product's remainder.
- 13
What does the addition table for remainders modulo 7 show about adding 0 to 0 and 2 to 2?
Model answer
The remainders are 0 and 4, respectively, since 0+0=0 and 2+2=4.
Explanation
The modular addition table records the ordinary sum reduced to its remainder modulo 7.
- 14
Why does adding 4 to 4 modulo 7 give the remainder 1?
Model answer
Because 4+4=8, and 8 leaves remainder 1 after subtracting one multiple of 7.
Explanation
The modular result is the remainder after reducing the ordinary sum.
- 15
What is the result of multiplying 3 by 3 modulo 7, and why?
Model answer
The result is 2, because 3⋅3=9 and 9 leaves remainder 2 when divided by 7.
Explanation
A modular multiplication table is formed by multiplying normally and reducing each product to its remainder.
- 16
Does addition modulo 7 satisfy associativity and commutativity?
Model answer
Yes. Regrouping or reordering the addends does not change the modular sum.
Explanation
These familiar addition properties continue to hold in modular arithmetic.
- 17
How does the distributive property work in modular arithmetic?
Model answer
a(b+c) modulo n gives the same result as ab+ac modulo n.
Explanation
Multiplication distributes over addition in modular arithmetic just as it does for ordinary integers.
- 18
What is the greatest common divisor of two integers?
Model answer
It is the largest integer that divides both integers.
Explanation
The greatest common divisor may be 1 when the integers have no common divisor greater than 1.
- 19
Why is checking every integer up to the smaller input a poor general method for computing a GCD?
Model answer
It may require testing too many possible divisors, making it impractical for very large integers.
Explanation
The Euclidean algorithm avoids this exhaustive search and computes the GCD efficiently.
- 20
State the GCD subtraction lemma when b≥a.
Model answer
gcd(a,b)=gcd(a,b−a).
Explanation
Replacing b by b−a preserves exactly the common divisors of a and b.
- 21
Why does every common divisor of a and b also divide b−a?
Model answer
If k divides both a and b, then (b−a)/k=b/k−a/k is an integer, so k divides b−a.
Explanation
The difference of two integers is an integer, which establishes divisibility of the difference.
- 22
Why does every common divisor of a and b−a also divide b?
Model answer
If k divides a and b−a, then it divides their sum, a+(b−a)=b.
Explanation
Thus the common divisors of the two pairs in the subtraction lemma are the same.
- 23
How does the division algorithm give a stronger GCD reduction than subtracting a just once?
Model answer
Writing b=qa+r lets us subtract q copies of a at once, giving gcd(a,b)=gcd(a,r), where r is the remainder.
Explanation
This is repeated use of the subtraction lemma, with the remainder often much smaller than the original numbers.
- 24
Describe the repeated step used in the Euclidean algorithm.
Model answer
Divide the larger number by the smaller, replace the larger number with the remainder, and repeat with the resulting pair.
Explanation
Each remainder step preserves the GCD while reducing the numbers until a remainder is 0.
- 25
Apply the Euclidean algorithm to find gcd(360,46).
Model answer
360=7⋅46+38, 46=1⋅38+8, 38=4⋅8+6, 8=1⋅6+2, and 6=3⋅2+0, so the GCD is 2.
Explanation
The last nonzero remainder is the GCD; equivalently, the final pair is 2 and 0.
- 26
Why is gcd(a,0)=a for a positive integer a?
Model answer
Every integer divides 0, so the common divisors of a and 0 are the divisors of a; the greatest is a.
Explanation
This is why the Euclidean algorithm returns the last nonzero remainder when the process reaches 0.
- 27
What additional information does the extended Euclidean algorithm keep track of?
Model answer
It tracks how each remainder is expressed as an integer linear combination of the original inputs.
Explanation
This bookkeeping produces coefficients that express the GCD using the original numbers.
- 28
State the integer linear-combination result for the GCD of a and b.
Model answer
There are integers s and t such that sa+tb=gcd(a,b).
Explanation
The extended Euclidean algorithm finds such coefficients as it computes the GCD.
- 29
How can an equation sa+tb=d, where d=gcd(a,b), certify that no larger common divisor exists?
Model answer
Any common divisor of a and b must divide sa+tb=d, so it cannot be larger than d.
Explanation
The equation gives a checkable certificate that the proposed GCD is at least as large as every common divisor.
- 30
What is a multiplicative inverse of an element modulo n?
Model answer
It is an element that multiplies with the given element to give a result congruent to 1 modulo n.
Explanation
For example, 2 and 4 are inverses modulo 7 because 2⋅4=8≡1(mod7).
- 31
Why does 0 have no multiplicative inverse modulo n when n>1?
Model answer
Multiplying 0 by any integer gives 0, which is not congruent to 1 modulo n.
Explanation
This is why the question of whether every element has an inverse concerns nonzero elements.
- 32
Why does every nonzero element modulo a prime p have a multiplicative inverse?
Model answer
For any nonzero element b modulo p, gcd(b,p)=1. Thus there are integers s,t with bs+pt=1, so bs≡1(modp).
Explanation
The coefficient s is a multiplicative inverse of b modulo p.
- 33
What condition determines whether an element b has a multiplicative inverse modulo a possibly composite modulus n?
Model answer
b has an inverse modulo n exactly when gcd(b,n)=1.
Explanation
The GCD condition allows an integer linear combination of b and n to equal 1, producing the inverse.
- 34
Why does the GCD condition produce a modular inverse?
Model answer
If gcd(b,n)=1, the extended Euclidean algorithm gives bs+nt=1. Reducing modulo n gives bs≡1(modn), so s is an inverse.
Explanation
The term nt vanishes modulo n.
- 35
How can the extended Euclidean algorithm be used to compute the inverse of a modulo a prime p?
Model answer
Run it on a and p to find s,t with as+pt=1; then s reduced modulo p is the inverse of a.
Explanation
Because p is prime and a is nonzero modulo p, their GCD is 1.
- 36
Why does 5 have a multiplicative inverse modulo 6, despite 6 not being prime?
Model answer
Because gcd(5,6)=1; in fact, 5⋅5=25≡1(mod6), so 5 is its own inverse.
Explanation
A prime modulus is sufficient for all nonzero elements to have inverses, but it is not necessary for an individual element to have one.
- 37
Translate the treasure-coin conditions into congruences.
Model answer
If the number of coins is n, the conditions are n≡4(mod5) and n≡1(mod7).
Explanation
Each congruence records the specified remainder after grouping the coins by the stated group size.
- 38
What is the smallest number of coins satisfying n≡4(mod5) and n≡1(mod7)?
Model answer
It is 29, since 29 leaves remainder 4 when divided by 5 and remainder 1 when divided by 7.
Explanation
The number satisfies both modular constraints and is the smallest positive value that does so.
- 39
State the Chinese remainder theorem for relatively prime positive integers a and b.
Model answer
If gcd(a,b)=1, each pair of residue conditions n≡r(moda) and n≡s(modb) determines exactly one n in the range 0≤n<ab.
Explanation
The theorem says that the two residues uniquely identify one value among the ab possible values in that range.
- 40
Why is the condition gcd(a,b)=1 important in the Chinese remainder theorem?
Model answer
It ensures that if both a and b divide a difference, their product ab divides that difference.
Explanation
This divisibility property is essential to proving that two values with the same pair of remainders cannot be distinct within the stated range.
- 41
How does the Chinese remainder theorem establish uniqueness of a solution in 0≤n<ab?
Model answer
If two values have the same remainders modulo both a and b, then both moduli divide their difference. Since they are relatively prime, ab divides the difference; two distinct values in the range cannot differ by a nonzero multiple of ab.
Explanation
Therefore the two values must be equal.
- 42
Why does the uniqueness argument also guarantee that every pair of residues has a solution?
Model answer
There are ab possible values of n in the range and ab possible residue pairs. Each value maps to a pair, and uniqueness shows no two values map to the same pair, so every pair is attained.
Explanation
A one-to-one mapping between two finite sets of equal size is also onto.
- 43
How can one construct a solution to n≡r(moda) and n≡s(modb) when a and b are relatively prime?
Model answer
Write n=kb+s, so the second congruence is satisfied. Then solve kb≡r−s(moda) by multiplying by the inverse of b modulo a.
Explanation
The inverse exists because gcd(a,b)=1; choosing the resulting remainder for k gives a solution in the required range.
- 44
What is the formula for k in the construction n=kb+s?
Model answer
k≡b−1(r−s)(moda), where b−1 is the inverse of b modulo a.
Explanation
This follows by rearranging kb+s≡r(moda) and multiplying by the modular inverse of b.
- 45
How can the Chinese remainder theorem be viewed as a correspondence between integers and residue pairs?
Model answer
For relatively prime a and b, the integers from 0 to ab−1 correspond one-to-one with the pairs of remainders modulo a and modulo b.
Explanation
There are ab integers in the range and ab possible pairs, and the theorem guarantees each pair occurs exactly once.
- 46
In the card-based private-preference demonstration, how does a participant encode a “yes” or “no” response?
Model answer
For “yes,” the participant places their red card next to the center red card and the black card on the outside; for “no,” they place the black card next to the center and the red card on the outside.
Explanation
The card order encodes the response without requiring the participant to announce it.
- 47
What pattern in the cards indicates that both participants answered “yes” in the demonstration?
Model answer
Three red cards appear consecutively in the cyclic arrangement.
Explanation
Each “yes” places a red card next to the central red card, producing a run of three when both answer yes.
- 48
What does the card arrangement show if at least one participant answers “no”?
Model answer
There are not three consecutive red cards; the arrangement has only two consecutive red cards.
Explanation
A “no” places a black card next to the center red card, preventing the three-red pattern.
- 49
Why are the cards cut randomly after being stacked in the private-preference demonstration?
Model answer
The random cuts create a cyclic shift, hiding which participant's cards occupy particular positions while preserving the relevant consecutive-card pattern.
Explanation
The shift helps prevent observers from inferring an individual's response from the cards' positions.
- 50
How does the card demonstration provide plausible deniability for someone who likes the movie when the other participant does not?
Model answer
The final arrangement does not reveal which participant answered yes, so that person can deny liking the movie.
Explanation
The demonstration reveals whether both participants agreed to watch, not each person's individual response.
- 51
How can modular arithmetic support reconstruction of a large file using multiple streamed snippets?
Model answer
Represent the file as an integer n and send its remainders modulo several moduli. Once the product of the moduli exceeds n, the Chinese remainder theorem can reconstruct n from those remainders.
Explanation
The combined residues identify the file value uniquely when the moduli satisfy the theorem's conditions.
- 52
Why can different recipients reconstruct the same file from different sets of streamed snippets?
Model answer
Each recipient can collect a set of residues whose moduli have a product large enough to identify the file; the particular snippets collected need not be identical.
Explanation
The residue information can reconstruct the same integer through the Chinese remainder theorem.
- 53
Why can a broadcaster repeatedly send snippets rather than coordinating one fixed transmission for every recipient?
Model answer
Recipients can listen until they have collected enough information to reconstruct the file, even if they begin listening at different times or receive different snippets.
Explanation
The repeated broadcast resembles a fountain: each recipient gathers enough data independently.
- 54
What role do the moduli play in the simplified fountain-code example?
Model answer
Each modulus specifies how the file integer is reduced to a remainder, and the associated remainder is one snippet of information about the file.
Explanation
Together, enough modulus-remainder pairs can determine the original integer.
- 55
What limitation of the fountain-code explanation is acknowledged in the content?
Model answer
It is a simplified account; a practical treatment must also address issues such as errors in transmitted messages.
Explanation
The modular-remainder idea illustrates reconstruction, but real fountain codes involve additional concerns.

Ask anything
We've read this whole study set, so questions about it get the best answers.