The word mod shows up in two places that look almost identical but play very different roles. One looks like this:

17 \bmod 5 = 2.

The other looks like this:

17 \equiv 2 \pmod{5}.

Both are read "seventeen mod five equals two" in a hurry. They involve the same three numbers. A student reads one as a restatement of the other and moves on, not noticing that the grammar has changed. But the first one is an operator — it takes two numbers and returns a third — while the second one is a relation — it takes three numbers and returns a yes/no verdict. Mixing them up causes notational accidents on exams and conceptual tangles when you start chaining congruences.

The operator: a mod n

a \bmod n is a function. You feed in a and n, and you get back a single number — the non-negative remainder when a is divided by n.

The mod operator

For integers a and positive integer n,

a \bmod n = r, \quad \text{where } 0 \leq r < n \text{ and } a = nq + r \text{ for some integer } q.

So 17 \bmod 5 = 2 means: when you divide 17 by 5, the remainder is 2. There is exactly one right-hand side. The statement is a computation, just like 17 - 5 = 12 is a computation.

Output range: always \{0, 1, 2, \dots, n-1\}. Never negative, never n or more. This is important for programmers — different programming languages disagree on what a % n returns when a is negative; the mathematical a \bmod n is always in [0, n).

The relation: a ≡ b (mod n)

a \equiv b \pmod{n} is a statement. You feed in a, b, and n, and you get back a yes or no — either n divides a - b (yes) or it does not (no). The symbol \equiv is the main verb; the \pmod{n} bit is a side-note telling you which modulus you are using.

The congruence relation

For integers a, b and positive integer n, the statement

a \equiv b \pmod{n}

is true iff n \mid (a - b).

So 17 \equiv 2 \pmod{5} means: 5 divides 17 - 2 = 15. That is a true statement. 17 \equiv 3 \pmod{5} means: 5 divides 17 - 3 = 14. That is a false statement. Neither of these is producing a "value" — they are claims you judge true or false.

The difference, side by side

Mod as operator compared with mod as relationTwo columns. The left column labelled operator shows the expression 17 mod 5 equals 2, inputs 17 and 5, output 2, type "integer" in the output range 0 to 4. The right column labelled relation shows 17 is congruent to 2 mod 5, inputs 17, 2, and 5, output true or false, type "yes or no verdict". An arrow between the two warns not to confuse them. operator 17 mod 5 = 2 inputs: 17, 5 output: a number (2) returns an integer in {0, 1, 2, 3, 4} a function relation 17 ≡ 2 (mod 5) inputs: 17, 2, 5 output: true / false asserts 5 | (17 − 2) = true here a statement same three numbers, very different grammar
The operator $a \bmod n$ takes two inputs and returns a number. The relation $a \equiv b \pmod n$ takes three inputs and returns a truth value. They use the same word "mod" and the same underlying divisibility fact, but they are grammatically different things.

How the two notations connect

They are not unrelated. The bridge is:

a \equiv b \pmod{n} \quad \Longleftrightarrow \quad a \bmod n = b \bmod n.

Translation: the relation a \equiv b \pmod{n} is true exactly when a and b give the same answer to the operator \bmod n.

This explains why 17 \equiv 2 \pmod{5} is true: 17 \bmod 5 = 2 and 2 \bmod 5 = 2 — same remainder, so the relation holds. It also explains why 17 \equiv 22 \pmod{5} is true: 17 \bmod 5 = 2 and 22 \bmod 5 = 2 — same remainder again.

But there is a quirk. The right-hand side of a congruence a \equiv b \pmod n does not have to be the reduced form a \bmod n. Both 17 \equiv 2 and 17 \equiv 22 and 17 \equiv -3 \pmod{5} are all true, because 2, 22, -3 all reduce to the same class. There are infinitely many valid right-hand sides. With the operator version, there is just one: 17 \bmod 5 = 2, exact and unambiguous.

Why the distinction matters

Three places where mixing the two breaks things.

1. Writing a reduced residue. When you compute something like 7^{2026} \pmod{11}, your final answer should be a specific number between 0 and 10. That is an operator question, not a relation one. Writing "7^{2026} \equiv 7^{2026} \pmod{11}" is a true-but-useless relation statement. The answer you want is a unique residue, so end with an equals sign: "7^{2026} \bmod 11 = 10" or the equivalent reduced form "7^{2026} \equiv 10 \pmod{11}" with 10 picked as the canonical representative.

2. Congruence manipulation. When you add, subtract, or multiply two congruences, you are working with the relation. You preserve truth: "two true congruences with the same modulus give a true sum-congruence." That would be an incoherent operation with the operator form — you cannot "add (17 \bmod 5) to (7 \bmod 5)" in the same way, because the inputs are already reduced numbers, not pairs-in-a-relation.

3. Programming. In Python or C, a % n is the operator. It returns a number. It does not make sense to say "if a % n then …" the same way you might say "if a \equiv b \pmod n then …". Every time you translate mathematics to code, you have to decide which of the two you are reaching for.

A quick exercise in spotting the difference

Which of the following statements are operator uses and which are relation uses?

  1. 100 \bmod 7 = 2.
  2. 100 \equiv 2 \pmod{7}.
  3. If a \equiv b \pmod n and c \equiv d \pmod n, then a + c \equiv b + d \pmod n.
  4. The clock time after 5 hours from 10 is (10 + 5) \bmod 12 = 3 o'clock.
  5. a \bmod n is always an element of \{0, 1, \dots, n-1\}.

Answers: 1 and 4 and 5 are operator uses — they return specific numbers. 2 and 3 are relation uses — they assert that something is true.

Compute both forms for $-7$ modulo $4$

Operator form. -7 \bmod 4 = ? Find the non-negative remainder: -7 = 4 \cdot (-2) + 1, so -7 \bmod 4 = 1.

Relation form. -7 \equiv ? \pmod 4. Any integer sharing the remainder class works: -7 \equiv 1 \pmod 4, -7 \equiv 5 \pmod 4, -7 \equiv -3 \pmod 4. All three are true.

Why: the operator gives you the unique representative in \{0, 1, 2, 3\}, which is 1. The relation lets you say -7 is in the same class as any representative — the "= 1" is one choice of many, useful because 1 is the cleanest.

So if an exam asks what is -7 \bmod 4, write one specific number1. If an exam asks to show some congruence modulo 4 holds for -7, write the most convenient form, usually the smallest non-negative one.

The pattern to internalise

When you see "mod," check the shape of the sentence.

Everything you learn about modular arithmetic — the cancellation rule, the lcm condition for combining moduli, Fermat's little theorem, the Chinese Remainder Theorem — uses the relation. Computing a specific remainder at the end of a problem uses the operator. Mixing them up is like confusing "x = 5" with "x is equal to 5" — fine in one-off reading, but costly when you try to manipulate.

Related: Modular Arithmetic · Why You Can't Divide Congruences Like Equations · Congruence Mod mn: Only When gcd = 1 · Number Line Wrapping into a Circle