2

I'm taking a cryptography class and we are going over proofs and modulus equations for hashing. On our homework assignment, one of the questions is to prove the following...

(ab) mod m = [(a mod m)(b mod m)] mod m

I understand that a = b mod m means that m | (a - b) and that m | (a - b) by definition means that a = b + mk but I'm struggling to make the connection on how to prove the above equation and the professor's slides and notes aren't very helpful as this is far more difficult than the examples he's done in class.

Any help or guidance is much appreciated!

tc216
  • 903
m_callens
  • 131

3 Answers3

2

This is a just do it type question.

Let $a \equiv a' \mod m$ and $b \equiv b' \mod m$. That means $a = a' + k m$ for some integer $k$ and that $b = b' + jm$ for some integer $j$.

So just do it.

$ab = (a' + km)(b'+jm) = a'b' + b'km + a'jm + jkm^2$

$= a'b' + m(b'k + a'j + jkm)$ so

$ab = a'b' + m(b'k + a'j + jkm)$ "for some integer $b'k + a'j + jkm$".

So $ab \equiv a'b' \mod m$

or $ab \equiv (a \mod m)(b \mod m) \mod m$

fleablood
  • 130,341
1

if

$a=mp+r$ with $0\le r<m$

and

$b=mq+s$ with $0\le s<m$

then

$ab=m(mpq+ps+qr) + rs$

so that

$(ab)$ mod $m$ = $rs$ mod $m$ = [($a$ mod $m$)($b$ mod $m$)] mod $m$

Adren
  • 8,184
1

There's a math mod and then there's a mod used in computer programs, a function of two integer variables which returns an integer, sometimes called the remainder.

In math terms, $x=y \bmod m$ means there is some integer $z$ such that $x=y+zm$, i.e., equality mod $m$ is a relation rather than a function. Thus, you want to prove is that if $u=a\bmod m$ and $v=b\bmod m$, then $ab = uv \bmod m$. Easy: write $u=a+km$, $v=b+lm$, so $uv=ab+vkm+ulm+klm^2$. Because $vkm=0\bmod m$, $ulm=0\bmod m$, and $klm^2=0 \bmod m$, you get $uv=ab\bmod m$ as desired.

ForgotALot
  • 3,971
  • 2
  • 15
  • 17