askvity

Understanding Modular Addition Properties

Published in Modular Addition 5 mins read

Okay, let's break down how addition works in modular arithmetic, often referred to as modular addition.

Modular addition is a system of arithmetic for integers where numbers "wrap around" when reaching a certain value—the modulus. It's like arithmetic on a clock, where adding hours eventually brings you back to 12 (or 0).

To "add modulus" (more accurately, to perform addition modulo N), you typically add the numbers together as usual and then find the remainder when the sum is divided by the modulus N.

Modular arithmetic follows specific rules that govern how addition interacts with the modulus. The references provided highlight several key properties:

  • Reference 1: Relating Standard Sum to Modular Sum
    If you have a standard addition equation, a + b = c, then the result of performing modular addition on a and b modulo N is equivalent to taking the standard sum c modulo N. This is expressed as:
    a (mod N) + b (mod N) ≡ c (mod N)
    This means (a + b) mod N is congruent to (a mod N + b mod N) mod N. It shows that you can either add the numbers first and then find the remainder, or find the remainders of the individual numbers first, add those remainders, and then find the remainder of that sum. The final result will be the same (or congruent modulo N).

  • Reference 3: Adding Congruent Numbers
    If two numbers a and b are congruent modulo N (a ≡ b (mod N)), and two other numbers c and d are also congruent modulo N (c ≡ d (mod N)), then adding these pairs preserves the congruence. The sum a + c will be congruent to the sum b + d modulo N.
    If a ≡ b ( mod N ) , and c ≡ d ( mod N ) , then a + c ≡ b + d ( mod N ) .
    This property is fundamental because it allows us to replace a number with any other number it is congruent to within a modular addition without changing the result modulo N.

  • Reference 2: Adding a Constant
    If two numbers a and b are congruent modulo N (a ≡ b (mod N)), adding the same integer k to both numbers maintains their congruence modulo N.
    If a ≡ b ( mod N ) , then a + k ≡ b + k ( mod N ) for any integer .
    This property shows that adding a constant shifts congruent numbers together.

  • Reference 4: Negation
    If a is congruent to b modulo N (a ≡ b (mod N)), then their negations, -a and -b, are also congruent modulo N.
    If a ≡ b ( mod N ) , then − a ≡ − b ( mod N ) .
    While not strictly about addition, this property is related as subtraction is addition of a negative number.

How to Perform Modular Addition

Practically, performing addition modulo N involves these steps:

  1. Add the numbers: Perform the standard addition of the numbers a and b to get their sum, S = a + b.
  2. Divide by the modulus: Divide the sum S by the modulus N.
  3. Find the remainder: The result of (a + b) mod N is the remainder obtained in Step 2. The remainder is always a non-negative integer smaller than N (in the range 0 to N-1).

Alternatively, based on Reference 1, you can also first find the remainder of each number when divided by N, add these remainders, and then find the remainder of that sum when divided by N.

(a + b) mod N ≡ ((a mod N) + (b mod N)) mod N

Example of Modular Addition

Let's add 17 and 11 modulo 5.

  1. Standard Sum: 17 + 11 = 28.
  2. Divide by Modulus: Divide 28 by 5. 28 ÷ 5 = 5 with a remainder of 3.
  3. Result: 17 + 11 ≡ 3 (mod 5).

Using the alternative method (from Reference 1):

  1. Find individual remainders:
    • 17 mod 5 = 2 (since 17 = 3 * 5 + 2)
    • 11 mod 5 = 1 (since 11 = 2 * 5 + 1)
  2. Add the remainders: 2 + 1 = 3.
  3. Find the remainder of the sum of remainders: 3 mod 5 = 3.

Both methods yield the same result: 3.

Here's another example in a table format:

Numbers to Add (a, b) Modulus (N) Standard Sum (a+b) Division: (a+b) ÷ N Remainder ( (a+b) mod N ) Modular Sum
17, 11 5 28 28 ÷ 5 = 5 R 3 3 3
8, 9 10 17 17 ÷ 10 = 1 R 7 7 7
5, 7 12 12 12 ÷ 12 = 1 R 0 0 0

Practical Application

Modular addition is used extensively in various fields:

  • Timekeeping: Clocks use modulo 12 (or 24) arithmetic for hours. If it's 10 o'clock and you add 4 hours, it's 2 o'clock (10 + 4 = 14; 14 mod 12 = 2).
  • Cryptography: Many encryption algorithms rely on modular arithmetic operations.
  • Computer Science: Operations on finite data types often implicitly use modular arithmetic (e.g., integer overflow).

In essence, adding modulus involves adding numbers within a system where the results are confined to a range defined by the modulus, effectively wrapping around when the limit is reached.

Related Articles