Modular Arithmetic

Modular arithmetic is used in discrete mathematics to output remainders. It is an arithmetic of congruences and is sometimes referenced as "clock arithmetic." This is the case because numbers are said to wrap around our modulus which is the fixed quantity. Below is an example using a clock:
Notice that when labeling the clock with our numbers it is only \(0,1,2,3\) with modulus \(4\) because we computed \(m-1\) to get a clock of modulus \(4.\) So to compute \(8\) mod \(4\), we start at \(0\) and move over \(8\) positions clockwise. By doing this, we land on \(0.\)
A more mathematical definition for modular arithmetic is pictured below:
This definition reads that two integers \(a\) and \(b\) are congruent to (mod \(m\)) if and only if \(m\) divides \(\left(a-b\right).\)