✦ScienexySCIENCE KNOWLEDGE LIBRARY
concept · SCI-MAT-002-073

Addition and Subtraction in Modular Arithmetic

Addition and subtraction in modular arithmetic follow the ordinary integer rules, but the final results are reduced to their corresponding remainders modulo a fixed positive integer.

(a + b) mod n = ((a mod n) + (b mod n)) mod n; (a − b) mod n = ((a mod n) − (b mod n)) mod n

Explanation

Modular addition and subtraction allow integers to be combined while keeping the results within a modular system. If a ≡ b (mod n) and c ≡ d (mod n), then a + c ≡ b + d (mod n), and a − c ≡ b − d (mod n). This means that each number can first be replaced by its remainder before performing the operation. For example, to calculate (18 + 23) mod 7, reduce the numbers to 4 and 2, respectively. Their sum is 6, so the result is 6 modulo 7. For subtraction, a negative result can be converted into its standard nonnegative residue by adding the modulus as many times as necessary. Modular addition and subtraction are useful in cyclic systems, divisibility problems, and algebraic calculations.

Variables

A

The first integer.

B

The second integer.

N

The positive modulus.

Mod

The operation that returns the standard remainder.

Example or application

Problem

Calculate (17 + 26 − 9) mod 8.

Solution

First reduce the numbers: 17 mod 8 = 1, 26 mod 8 = 2, and 9 mod 8 = 1. Then calculate (1 + 2 − 1) mod 8 = 2.

Answer

2

Text

The operations of addition and subtraction are compatible with congruence. The result can be simplified by reducing each operand modulo n before or after the operation.

Key Points

  • Modular addition follows ordinary integer addition followed by reduction modulo n.

  • Modular subtraction follows ordinary integer subtraction followed by reduction modulo n.

  • Each operand can be reduced before performing the operation.

  • A negative result can be converted to a standard nonnegative residue.

  • Addition and subtraction preserve congruence.

Applications

  • Calculating positions in cyclic systems.

  • Solving elementary congruence equations.

  • Working with clock arithmetic.

  • Simplifying large integer expressions.

  • Performing calculations in computer science and cryptography.

Learning Outcomes

  • Perform addition modulo a positive integer.

  • Perform subtraction modulo a positive integer.

  • Reduce operands before carrying out modular operations.

  • Convert negative modular results into standard residues.

Practice Questions

  • Calculate (14 + 19) mod 6.

  • Calculate (8 − 15) mod 7.

  • Find (37 + 48 − 22) mod 9.

  • If a ≡ 4 (mod 11) and b ≡ 8 (mod 11), find a + b modulo 11.

  • Explain why reducing operands before addition does not change the final residue.

Related Concepts

  • Congruence Relations

  • Modular Arithmetic

  • Residue Classes

  • Modular Multiplication

  • Linear Congruences

Common Mistakes

  • Forgetting to reduce the final result modulo n.

  • Treating a negative remainder as the standard nonnegative residue.

  • Using different moduli within the same congruence calculation.

  • Assuming modular subtraction must always produce a positive intermediate result.

Sources and verification

Sources are shown as provided in the project data. Not every source has yet been independently verified. Please report errors or missing citations.

  • Kenneth H. Rosen, Elementary Number Theory and Its Applications
  • David M. Burton, Elementary Number Theory

Suggest a correction or source · More in Arithmetic & Number Theory