Quotient Remainder Theorem states that for any pair of integers a and b (b is positive), there exists two unique integers q and r such that:
a = b x q + r
where 0 <= r < b
If a = 22, b = 4
then q = 5, r = 2
22 = 4 x 5 + 2
If a = -19, b = 5
then q = -4, r = 1
-19 = 5 x -4 + 1
Use of Quotient Remainder Theorem:
Quotient remainder theorem is the fundamental theorem in modular arithmetic. It is used to prove Modular Addition, Modular Multiplication and many more principles in modular arithmetic.
To prove Quotient Remainder theorem, we have to prove two things:
For any integer a and positive integer b:
1. q and r exist
2. q and r are unique
Existence of q and r:
Consider the progression …, a – 3b, a – 2b, a – b, a, a + b, a + 2b, a + 3b…
This extends in both directions.
By the Well-Ordering Principle, there must exist a smallest non-negative element x.
Thus, x = a – qb and x must be in the interval [0, b) because otherwise r-b would be smaller than r and a non-negative element in the progression.
Uniqueness of q and r:
Suppose we have another pair q0 and r0 such that a =b x q0 + r0, with 0 <= r0 < b.
b x q + r = b x q0 + r0
We see that r – r0 = b(q0 – q), and so q0 – q = b / (r – r0)
Since 0 <= r < b and 0 <= r0 < b, we have that -b < r-r0 < b
Hence, r- r0 = 0 that implies r = r0
So r – r0 = 0 = b(q0 – q)
which implies that q = q0.
This shows uniqueness.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Quotient - Remainder Sort
- Using Chinese Remainder Theorem to Combine Modular equations
- Chinese Remainder Theorem | Set 2 (Inverse Modulo based Implementation)
- Cauchy's Mean Value Theorem
- Wilson's Theorem
- Corollaries of Binomial Theorem
- Compute nCr % p | Set 3 (Using Fermat Little Theorem)
- Compute nCr % p | Set 2 (Lucas Theorem)
- Mathematics | Rolle's Mean Value Theorem
- Mathematics | Lagrange's Mean Value Theorem
- Kleene's Theorem in TOC | Part-1
- Bayes's Theorem for Conditional Probability
- Consensus Theorem in Digital Logic
- Arden's Theorem and Challenging Applications | Set 2
- Arden's Theorem in Theory of Computation
- Remainder with 7 for large numbers
- Find N % 4 (Remainder with 4) for a large value of N
- Check if the remainder of N-1 factorial when divided by N is N-1 or not
- Advanced master theorem for divide and conquer recurrences
- Find remainder of array multiplication divided by n
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.