Basic Modular Arithmetic Modulo N

Interactive · 3 questions

Modulo Arithmetic : The basic properties

Previous Part

In the last part of the article, we've look at what modulo arithmetic is. In this part, we'll look at some basic properties.

If a≡b(modm)a \equiv b \pmod{m}, and c∈Zc \in \mathbb{Z}, then

Choose all correct answers

Math as a puzzle

Many contest problems feel more like puzzles than homework. They are a good way to find out how much fun math can be. These are real problems from the AMC 8, AMC 10, AMC 12 and AIME, the national math competitions for middle and high school students, each with a worked solution on LIVE by Po-Shen Loh.

Read · 1 min

Performing operations in Modular Arithmetic

Addition and Subtraction

**A1: ** Given that a≡b(modn)a\equiv b \pmod n, then a+c≡b+c(modn)a+c\equiv b+c \pmod n

**Proof: ** (a+c)−(b+c)=a−b=kn(a+c)-(b+c)=a-b=kn

A2 Given that a≡b(modn)a\equiv b \pmod n and c≡d(modn)c\equiv d \pmod n, then a+c≡b+d(modn)a+c\equiv b+d \pmod n

Proof a≡b(modn)a\equiv b \pmod n implies a−b=kna-b=kn. c≡d(modn)c\equiv d \pmod n implies c−d=pnc-d=pn

Hence:

(a−b)+(c−d)=kn+pn(a-b)+(c-d)=kn+pn (a+c)−(b+d)=kn+pn(a+c)-(b+d)=kn+pn a+c≡b+d(modn)a+c\equiv b+d \pmod n

**Note: ** In the two properties of addition in modular arithmetic above, aa, bb, cc, and dd doesn't nessesarily have to be positive numbers, they can be negative as well, but they must be integers. Hence, these properties can be extended into subtraction.

Multiplication and Exponentation

**M1: ** Given that a≡b(modn)a\equiv b \pmod n, then ac≡bc(modn)ac\equiv bc \pmod n

**Proof: ** a≡b(modn)a\equiv b \pmod n implies a−b=kna-b=kn, multiplying both sides by cc acheives the desired result.

**M2: ** Given that a≡b(modn)a\equiv b \pmod n and c≡:d(modn)c\equiv :d \pmod n, then ac≡bd(modn)ac\equiv bd \pmod n

**Proof: **

a≡b(modn)  ⟹  ac≡bc(modn)c≡d(modn)  ⟹  bc≡bd(modn)ac≡bc≡bd(modn)  ⟹  ac≡bd(modn)\begin{aligned}a\equiv b \pmod n &\implies ac\equiv bc \pmod n \\c\equiv d \pmod n &\implies bc\equiv bd \pmod n \\ac \equiv bc \equiv bd \pmod n &\implies \boxed{ac\equiv bd \pmod n}\end{aligned}

**M3: ** Given that a≡b(modn)a\equiv b \pmod n, then ac≡bc(modn)a^c\equiv b^c \pmod n

**Proof: ** This is proven thorugh repeatedly applying property M2.

Interactive · 1 question

What is ab(modn)ab \pmod n if a(modn)a \pmod n is 1 and b(modn)b \pmod n is 1?

Choose one answer

Read · 1 min

Multiplication modulo C

(A×B)(A \times B) mod(C)(C) == (A(A mod(C))×(B(C)) \times (B mod(C))(C)) mod(C)(C)

This are easy to prove simply by considering AA as the number C⋅qa+raC \cdot q_a + r_a, and BB as the number C⋅qb+rbC \cdot q_b + r_b, where 0≤ra,rb<C0 \le r_a, r_b < C and qa,qbq_a, q_b are integers. This is possible to do because of the Quotient Remainder Theorem.

Substituting for AA and BB in the equation above, we get ((C⋅qa+ra)(C⋅qb+rb))((C \cdot q_a + r_a )(C \cdot q_b + r_b)) mod(C)=(ra⋅rb)(C) = (r_a \cdot r_b ) mod(C)(C).

Then, if we multiply out the left hand side, we get (C⋅(C⋅qa⋅qb+qa⋅rb+qb⋅ra)+ra⋅rb)(C \cdot (C \cdot q_a \cdot q_b + q_a \cdot r_b + q_b \cdot r_a) + r_a \cdot r_b ) mod(C)=(ra⋅rb)(C) = (r_a \cdot r_b ) mod(C)(C).

But, because CC mod(C)=0(C) = 0, the left hand side simplifies to (ra⋅rb)(r_a \cdot r_b) mod(C)(C), which equals the right side and completes our proof. □\square

Addition modulo C

(A+B)(A + B) mod(C)(C) == (A(A mod(C))+(B(C)) + (B mod(C))(C)) mod(C)(C)

This can be proved in a similar way as the one above. If we take AA as the number C⋅qa+raC \cdot q_a + r_a, and BB as the number C⋅qb+rbC \cdot q_b + r_b, we can prove this relationship quite easily. I will leave this proof as an exercise for the reader.

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems