Calculate the remainder (modulo) when dividing two numbers. Shows quotient and remainder.
Verification: 3 × 5 + 2 = 17
The remainder is what's left over after dividing one number by another. When you divide a number and it doesn't go in evenly, the amount that "doesn't fit" is the remainder. This concept is fundamental to mathematics and appears everywhere from elementary arithmetic to advanced cryptography.
Think of it like distributing cookies to children. If you have 17 cookies and 5 children, each child gets 3 cookies, but you'll have 2 cookies left over—that's the remainder.
The relationship between dividend, divisor, quotient, and remainder is expressed as:
Using the modulo operator (often written as "mod" or "%" in programming):
The quotient is found using integer division (also called floor division):
Problem: Find the remainder when 17 is divided by 5.
Solution:
Verification: 3 × 5 + 2 = 17 ✓
Problem: What is 247 mod 12?
Solution:
So 247 mod 12 = 7.
Problem: Find 24 mod 6.
Solution:
When the remainder is zero, we say the dividend is "evenly divisible" by the divisor.
Understanding these properties helps you work with remainders more efficiently:
Bounded result: The remainder is always less than the divisor. If dividing by 7, the remainder can only be 0, 1, 2, 3, 4, 5, or 6.
Zero remainder: If the remainder equals 0, the dividend is evenly divisible by the divisor.
Addition property: (a + b) mod n = ((a mod n) + (b mod n)) mod n
Multiplication property: (a × b) mod n = ((a mod n) × (b mod n)) mod n
Subtraction property: (a - b) mod n = ((a mod n) - (b mod n) + n) mod n
These properties are essential in modular arithmetic and are used extensively in computer science and cryptography.
Remainders provide a quick way to test if one number divides evenly into another:
| To Check If A Number Is... | Use This Test |
|---|---|
| Even | n mod 2 = 0 |
| Odd | n mod 2 = 1 |
| Divisible by 3 | n mod 3 = 0 |
| Divisible by 5 | n mod 5 = 0 |
| Divisible by 10 | n mod 10 = 0 |
Time naturally uses modular arithmetic:
Remainders are essential in programming:
When dealing with negative dividends, different programming languages handle remainders differently:
For example, -17 mod 5:
Always check your programming language's documentation when working with negative numbers.
In many contexts, they're the same thing. However, technically "remainder" refers to what's left after division, while "modulo" refers to the operation itself. The distinction matters with negative numbers, where definitions can vary.
No. By definition, the remainder must be smaller than the divisor. If your calculation gives a remainder larger than the divisor, you need to divide again.
A remainder of zero means the dividend divides evenly by the divisor with nothing left over. For example, 12 mod 4 = 0 because 12 ÷ 4 = 3 exactly.
You use remainders whenever you divide things that can't be split—like figuring out how many leftover slices of pizza there are after everyone takes an equal share, or determining what day of the week a date falls on.