If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Congruence modulo

## Congruence Modulo

You may see an expression like:
A, \equiv, B, left parenthesis, start text, m, o, d, space, end text, C, right parenthesis
This says that A is congruent to B modulo C.
We will discuss the meaning of congruence modulo by performing a thought experiment with the regular modulo operator.
Let's imagine we were calculating mod 5 for all of the integers:
Suppose we labelled 5 slices 0, 1, 2, 3, 4. Then, for each of the integers, we put it into a slice that matched the value of the integer mod 5.
Think of these slices as buckets, which hold a set of numbers. For example, 26 would go in the slice labelled 1, because 26, start text, space, m, o, d, space, end text, 5, equals, 1.
Above is a figure that shows some integers that we would find in each of the slices.
It would be useful to have a way of expressing that numbers belonged in the same slice. (Notice 26 is in the same slice as 1, 6, 11, 16, 21 in above example).
A common way of expressing that two values are in the same slice, is to say they are in the same equivalence class.
The way we express this mathematically for mod C is: A, \equiv, B, space, left parenthesis, start text, m, o, d, space, end text, C, right parenthesis
The above expression is pronounced A is congruent to B modulo C.
Examining the expression closer:
1. \equiv is the symbol for congruence, which means the values A and B are in the same equivalence class.
2. left parenthesis, start text, m, o, d, space, end text, C, right parenthesis tells us what operation we applied to A and B.
3. when we have both of these, we call “\equivcongruence modulo C.
e.g. 26, \equiv, 11, space, left parenthesis, start text, m, o, d, space, end text, 5, right parenthesis
26, start text, space, m, o, d, space, end text, 5, equals, 1 so it is in the equivalence class for 1,
11, start text, space, m, o, d, space, end text, 5, equals, 1 so it is in the equivalence class for 1, as well.
Note, that this is different from A, start text, space, m, o, d, space, end text, C: 26, does not equal, 11, start text, space, m, o, d, space, end text, 5.

## Insights into Congruence Modulo

We can gain some further insight behind what congruence modulo means by performing the same thought experiment using a positive integer C.
First, we would label C slices 0, comma, 1, comma, 2, comma, dots, comma, C, minus, 2, comma, C, minus, 1.
Then, for each of the integers, we would put it into a slice that matched the value of the integer start text, m, o, d, space, end text, C.
Below is a figure that shows some representative values that we would find in each of the slices.
If we looked at the bucket labelled 0 we would find:
dots, comma, minus, 3, C, comma, minus, 2, C, comma, minus, C, comma, 0, comma, C, comma, 2, C, comma, 3, C, comma, dots
If we looked at the bucket labelled 1 we would find:
dots, comma, 1, minus, 3, C, comma, 1, minus, 2, C, comma, 1, minus, C, comma, 1, comma, 1, plus, C, comma, 1, plus, 2, C, comma, 1, plus, 3, C, comma, dots
If we looked at the bucket labelled 2 we would find:
dots, comma, 2, minus, 3, C, comma, 2, minus, 2, C, comma, 2, minus, C, comma, 2, comma, 2, plus, C, comma, 2, plus, 2, C, comma, 2, plus, 3, C, comma, dots
If we looked at the bucket for C, minus, 1 we would find:
dots, comma, minus, 2, C, minus, 1, comma, minus, C, minus, 1, comma, minus, 1, comma, C, minus, 1, comma, 2, C, minus, 1, comma, 3, C, minus, 1, comma, 4, C, minus, 1, dots
From this experiment we can make a key observation:
The values in each of the slices are equal to the label on the slice plus or minus some multiple of C.
This means the difference between any two values in a slice is some multiple of C.
This observation can help us understand equivalent statements and equivalence classes next.