2
$\begingroup$

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!

  • 0
    That's the *usual definition* of multiplication mod $m$! What definition do you have?2017-02-10

3 Answers 3

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$

  • 0
    so the entire statement of `b′k+a′j+jkm` boils down to a single constant?2017-02-11
  • 0
    A single integer, yes, I'm not sure "constant' is the right word but yeah.2017-02-11
1

if

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

and

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

then

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

so that

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

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.