WWikiLLemmasCongruence is compatible with addition and multiplication
Lemma·L74
Replacing the inputs by congruent ones does not change the congruence class of a sum or product.
Fix
. If
and
(D113), then
and
, for all
.
In words
If a may be replaced by a congruent a-prime and b by a congruent b-prime, modulo n, then the sum a plus b is congruent to a-prime plus b-prime and the product a times b is congruent to a-prime times b-prime, modulo n.
Never needed: F10 · A03 · A04 · A05 · A07 · A09 (computed from the citation graph, not asserted).
Proof
- 1By hypothesis and D113, and for some .
- 2
- 3
- 4
∎
Remarks
This is what makes modular arithmetic arithmetic: the congruence class of a sum or product depends only on the classes of the inputs, never on the chosen representatives. It is exactly the well-definedness needed for the operations addition and multiplication on
, and it says the quotient map
preserves
and
. Concretely one may reduce intermediate results modulo
at any point: to compute
modulo
, replace
and
by their remainders first.