Source: https://web.math.ucsb.edu/~helena/teaching/math8/handouts/congruence.pdf