0

For some $M \in \mathbb{N}$, let $a,b,r,s \in [0, M)$.

Compute the following:

$$ x = (a+r) \mod M$$ $$ y = (b+s) \mod M$$ $$ z = (x \cdot y) \mod M = (a \cdot b + a \cdot s + b \cdot r + r \cdot s) \mod M$$

Assume that the following values are given:

  1. $M$
  2. $z$
  3. $A = (a \cdot s) \mod M$
  4. $B = (b \cdot r) \mod M$
  5. $C = (r \cdot s) \mod M$

Is it possible to compute $D = (a \cdot b) \mod M$?

Note that since we are dealing with real numbers (in contrast to integers), we can't simply let:

$$ D = (z - A - B - C) \mod M$$

The reason is discussed by @MichaelHardy in his elegant answer to another question. A counterexample to the above naive computation is as follows:

$$M = 11, \qquad a = 0.1,\quad b = 1.4,\quad r = s = 10$$

Sadeq Dousti
  • 3,291

1 Answers1

2

Your trouble here is that your specification $$ z = (x\cdot y)\bmod M = (a\cdot b+a\cdot s+b\cdot r+r\cdot s)\bmod M$$ is inconsistent. The two $\text{mod}$s are not equal in general. We can rewrite them to $$ ((a+r)\bmod M)(b+s)\bmod M) \bmod M \mathrel{=?} (a+r)(b+s)\bmod M$$ but as Michael Hardy points out in the answer you link to, taking modulo is not compatible with multiplication, so in general $$ PQ \bmod M \neq (P\bmod M)(Q\bmod M)\bmod M $$

Therefore, since your definition of $z$ is inconsistent (unless you're lucky with the particular values, such as if $a+r$ and $b+s$ are both in $[0,M)$ already, or everything are integers), you can't trust anything you compute from "knowing" its value.