Introduction to Modulo Arithmetic

Introduction to Modulo Arithmetic:

Root Image

Hi everyone. In this post, we will learn about modulo arithmetic and discuss
some rules.

Modular arithmetic is a system of arithmetic for integers, which consists of remainders.
Consider the following expression:
a=qn+r0r<a a = qn + r \quad | \quad 0 \le r \lt a

,    ar    (mod    n) \therefore\:, \;\; a \equiv r \;\; (mod \;\; n)
For example,
1321    (mod    2) 13 \equiv 21 \;\; (mod \;\; 2)
as
13=1    (mod    2) 13 = 1 \;\; (mod \;\; 2)
and
21=1    (mod    2) 21 = 1 \;\; (mod \;\; 2)

Note: \equiv is not the same as ==


Addition properties

  • If a+b=ca + b = c, then a  (a\;(mod N)N) ++ b  (b\;(mod N)N) \equiv c  (c\;(mod N)N).
  • If ab  (a \equiv b \;(mod N)N), then a+kb+k  (a + k \equiv b + k \;(mod N)N) for any integer kk.
  • If ab  (a \equiv b \;(mod N)N) and cd  (c \equiv d \;(mod N)N), then a+cb+d  (a + c \equiv b + d \;(mod N)N).
  • If ab  (a \equiv b \;(mod N)N), then ab  (-a \equiv -b \;(mod N)N).

Multiplication properties

  • If ab=ca \cdot b = c, then a  (a\;(mod N)N) \cdot b  (b\;(mod N)N) \equiv c  (c\;(mod N)N).
  • If ab  (a \equiv b \;(mod N)N), then kakb  (ka \equiv kb \;(mod N)N) for any integer, kk.
  • If ab  (a \equiv b \;(mod N)N) and cd  (c \equiv d \;(mod N)N), then acbd  (ac \equiv bd \;(mod N)N).

Exponentiation property

If ab  (a \equiv b \;(mod N)N), then akbk  (a^k \equiv b^k \;(mod N)N), for any positive integer, kk.


Division property

If gcd(k,N)=1(k, N) = 1, and kakb  (ka \equiv kb\;(mod N)N), then ab  (a \equiv b\;(mod N)N).

You can’t just divide both sides, unless the above property is true.


Modular inverse

If aa and NN are integers such that gcd(a,N)=1(a, N) = 1, then there exists an integer,
xx, such that ax1  (ax \equiv 1 \;(mod N)N).

Comments