ArticleslgStudy

science

Modular arithmetic

Modular arithmetic is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Modular arithmetic rather than just read about it. In short: In mathematics, modular arithmetic is a system of arithmetic operations for integers, differing from the usual ones in that numbers "wrap around" when reaching or exceeding a certain value, called the modulus. The modern approach to number theory using modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801.

Modular arithmetic — main illustration
Modular arithmetic — illustration

Key takeaways

  • Modular arithmetic belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Modular arithmetic to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Modular arithmetic from memory before moving on to harder problems.

Reference excerpt

In mathematics, modular arithmetic is a system of arithmetic operations for integers, differing from the usual ones in that numbers "wrap around" when reaching or exceeding a certain value, called the modulus. The modern approach to number theory using modular arithmetic was developed by Carl Friedrich Gauss in his book Disquisitiones Arithmeticae, published in 1801. Modular arithmetic modulo m consists of systematically replacing the results of additions, multiplications, and subtractions by the remainder of the division by m. A remarkable property of modular arithmetic is that the result of a computation does not depend on whether the division by m is performed after each operation, only once at the end of the computation, or at the end of the computation and after some intermediate results—typically when an intermediate result becomes too large.

Motivating example A familiar setting exhibiting modular arithmetic is the hour hand on a 12-hour clock. If the hour hand points to 7 now, then 8 hours later it will point to 3. Ordinary addition would result in 7 + 8 = 15, but 15 reads as 3 on the clock face. This is because the hour hand makes one rotation every 12 hours and the hour number starts over when the hour hand passes 12. We say that 15 is congruent to 3 modulo 12, and we write 15 ≡ 3 (mod 12), so 7 + 8 ≡ 3 (mod 12). Similarly, if one waits 8 hours and then 8 more hours (thus 16 hours in total), the clock will show the same time change as if one waited 4 hours. This is reflected by the identity 2 × 8 ≡ 4 (mod 12). After a wait of exactly 12 hours, the hour hand will be right where it started, so 12 acts as 0; one writes 12 ≡ 0 (mod 12).

Congruence Given an integer m ≥ 1, called a modulus, two integers a and b are said to be congruent modulo m, if their difference a − b is an integer multiple of m; that is, if there is an integer k such that

a − b = km. Congruence modulo m is a congruence relation, meaning that it is an equivalence relation compatible with addition, subtraction, and multiplication. Congruence modulo m is denoted by

a ≡ b ( mod m ) . {\displaystyle a\equiv b{\pmod {m}}.}

The parentheses mean that (mod m) applies to the entire equation, not just to the right-hand side (here, b). This notation is not to be confused with the notation b mod m or (b mod m) (without parentheses immediately before "mod"), which refers to the remainder of b when divided by m, known as the modulo operation; that is, b mod m denotes the unique integer r such that 0 ≤ r < m and r ≡ b (mod m). So, the relation a ≡ b ( mod m ) {\displaystyle a\equiv b{\pmod {m}}} must be read ( a ≡ b ) mod m , {\displaystyle (a\equiv b){\bmod {m}},} and is equivalent with a mod m = b mod m . {\displaystyle a{\bmod {m}}=b{\bmod {m}}.}

The congruence relation a ≡ b (mod m) may be rewritten as

∃ k ∈ Z a = k m + b , {\displaystyle \exists k\in \mathbb {Z} \quad a=km+b,}

explicitly showing its relationship with Euclidean division. However, the b here need not be the remainder in the division of a by m. Rather, a ≡ b (mod m) asserts that a and b have the same remainder when divided by m. That is,

a = p m + r, b = q m + r, where 0 ≤ r < m is the common remainder. We recover the previous relation (a − b = k m) by subtracting these two expressions and setting k = p − q. Because the congruence modulo m is defined by the divisibility by m and because −1 is a unit in the ring of integers, a number is divisible by −m exactly if it is divisible by m. This means that every non-zero integer m may be taken as a modulus.

Examples In modulus 12, one can assert that:

38 ≡ 14 (mod 12) because the difference is 38 − 14 = 24 = 2 × 12, a multiple of 12. Equivalently, 38 and 14 have the same remainder 2 when divided by 12. The definition of congruence also applies to negative values. For example:

2 ≡ − 3 ( mod 5 ) − 8 ≡ + 7 ( mod 5 ) − 3 ≡ − 8 ( mod 5 ) . {\displaystyle {\begin{aligned}2&\equiv -3{\pmod {5}}\\-8&\equiv {\phantom {+}}7{\pmod {5}}\\-3&\equiv -8{\pmod {5}}.\end{aligned}}}

Basic properties

The congruence relation satisfies all the conditions of an equivalence relation:

Reflexivity: a ≡ a (mod m) Symmetry: a ≡ b (mod m) if and only if b ≡ a (mod m). Transitivity: If a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m) If a1 ≡ b1 (mod m) and a2 ≡ b2 (mod m), or if a ≡ b (mod m), then:

… excerpt ends here. Continue reading the full article.

Illustrations

Modular arithmetic: Time-keeping on this clock uses arithmetic modulo 12. Adding 4 hours to 9 o'clock gives 1 o'clock, since 13 is congruent to 1 modulo 12.
Time-keeping on this clock uses arithmetic modulo 12. Adding 4 hours to 9 o'clock gives 1 o'clock, since 13 is congruent to 1 modulo 12.

Worked examples

Example 1 — a first encounter with Modular arithmetic

Start with the simplest possible case. Write down what Modular arithmetic claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Modular arithmetic before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Modular arithmetic ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Modular arithmetic

In research
Modular arithmetic appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Modular arithmetic in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Modular arithmetic is common in secondary-school and first-year university syllabi. It links to neighbouring topics Finite rings, Group theory, Modular arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Modular arithmetic outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Modular arithmetic in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Modular arithmetic means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Modular arithmetic out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Modular arithmetic in simple terms?

In mathematics, modular arithmetic is a system of arithmetic operations for integers, differing from the usual ones in that numbers "wrap around" when reaching or exceeding a certain value, called the modulus. The modern approach to number theory using modular arithmetic was developed by Carl Fried…

Why does Modular arithmetic matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Modular arithmetic?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Modular arithmetic.

Tags

  • Finite rings
  • Group theory
  • Modular arithmetic

Keep exploring