How the Is Modulo Multiplication and Addition Associative, Distributive, and Commutative? works
Modular arithmetic — sometimes called "clock arithmetic" — works with the remainder left over after dividing by a fixed modulus n. Formally, mod(x, n) is defined as the unique value r with 0 ≤ r < n such that x = kn + r for some integer k, which in code is ((x % n) + n) % n so it stays correct even for negative x. The set of remainders {0, 1, …, n−1} under addition and multiplication mod n forms what mathematicians call a commutative ring, and this calculator lets you plug in three integers a, b, c and a modulus n to see, concretely, why addition and multiplication mod n are always associative and commutative, and why multiplication always distributes over addition mod n.
Formula and method
The calculator checks four identities directly by computing both sides and comparing them:
- Associativity of addition: ((a + b) mod n + c) mod n = (a + (b + c) mod n) mod n
- Associativity of multiplication: ((a × b) mod n × c) mod n = (a × (b × c) mod n) mod n
- Distributivity: a × (b + c) mod n = ((a × b) mod n + (a × c) mod n) mod n
- Commutativity: a + b mod n = b + a mod n, and a × b mod n = b × a mod n
Why these hold for every modulus
Reducing a number mod n is a ring homomorphism from the integers ℤ onto ℤ/nℤ: it maps sums to sums and products to products. Since ordinary integer addition and multiplication are already associative, commutative, and mutually distributive, taking remainders never breaks those laws — the same relationships simply carry over to the reduced values, for any n ≥ 1. That is why every check below always comes back "Yes"; the calculator's job is to make that abstract guarantee concrete with your own numbers.
Operations that do not share these properties
- Subtraction is not commutative: a − b mod n generally differs from b − a mod n unless a ≡ b (mod n).
- Division is not always defined: a ÷ b mod n only makes sense when b has a multiplicative inverse mod n, which requires gcd(b, n) = 1.
- Exponentiation is neither commutative nor associative in general: a^b mod n ≠ b^a mod n, and (a^b)^c mod n ≠ a^(b^c) mod n.
Where this matters
- Cryptography (RSA, Diffie-Hellman) relies on associativity and distributivity mod n to make modular exponentiation computable via repeated squaring.
- Hash tables and checksums use the fact that (a + b) mod n can be computed incrementally, one addition at a time, without recomputing the whole sum.
- The Chinese Remainder Theorem and other number-theory algorithms depend on addition and multiplication mod n behaving exactly like their integer counterparts.
Frequently Asked Questions
Is addition modulo n always associative?
Is multiplication modulo n always associative?
Does multiplication distribute over addition modulo n?
Are addition and multiplication modulo n commutative?
Common Tip Percentages
| Service | Typical Tip Range | Notes |
|---|---|---|
| Restaurant (sit-down) | 15–20% | 20%+ for exceptional service |
| Food delivery | 10–20% | Consider extra for long distances |
| Taxi / rideshare | 10–20% | More for assistance with luggage |
| Hotel housekeeping | $2–5/night | Leave daily, not just at checkout |
| Barber / hair salon | 15–20% | On pre-discount total |
| Pizza delivery | 10–15% or $3–5 minimum | Higher in bad weather |
General Household Budget Ratios (50/30/20 Rule)
| Category | % of Net Income | Examples |
|---|---|---|
| Needs | 50% | Rent, groceries, utilities, insurance |
| Wants | 30% | Dining out, entertainment, hobbies |
| Savings / Debt | 20% | Emergency fund, retirement, extra payments |
Common Measurement Conversions for Everyday Use
| Quantity | US / Imperial | Metric Equivalent |
|---|---|---|
| 1 cup | 8 fl oz | 237 mL |
| 1 pint | 16 fl oz | 473 mL |
| 1 quart | 32 fl oz | 946 mL |
| 1 gallon | 128 fl oz | 3.785 L |
| 1 lb | 16 oz | 453.6 g |
| 1 ft | 12 in | 30.48 cm |