Expected number of distinct sums of two sets modulo an integer

71 Views Asked by At

Let $m$ be a fixed integer and $r,s\ll m$ given integers. We pick uniformly at random two sets $A$ and $B$ of classes modulo $m$ the first with $r$ elements and the second with $s$ elements. I would like to know what is the expected number $E\vert A+B\vert$ of distinct sums $a+b$ modulo $m$ with $a \in A, b\in B$.

I found this problem while trying to optimize an algorithm to solve numerically a problem in number theory. For the present I'm happy with the following approximation (I think a lower bound): the probabiity that a random integer $x$ mod $m$ is not in $A+b$ for a fixed $b$ is $1-\frac{r}{m}$, so if all these probabilities were independent then the probability of $x$ not being in $A+B$would be $(1-\frac{r}{m})^s$ and the expected number of classes in $A+B$ would be: $$ E\vert A+B \vert = m \left(1- (1-\tfrac{r}{m})^s\right) $$ but then reversing $A$ and $B$ in the argument we would have also $$ E\vert A+B \vert = m \left(1- (1-\tfrac{s}{m})^r\right) $$ and these two numbers are in general different (and so the probabilities are not independent). But this approximation is not bad, at least in my range of interest (when $rs$ is at most several times $m$).

Is there an easy way to improve this approximation? or even better a closed formula for $E\vert A+B\vert$?

1

There are 1 best solutions below

0
On BEST ANSWER

I have finally managed to solve the problem, so I post the answer in case it might be useful for someone. It is a lot simpler than I expected:

Let $m,A,B,r,s$ as in the question, we start counting all the pairs $A,B$ such that $A+B$ does not contain 0. We can chose $A$ in $\binom mr$ ways, and given $A$ we have to pick $B$ so that it doesn't contain any of the classes in $-A$, so there are $\binom {m-r}s$ possible choices for $B$. So there are $$ \binom mr \binom{m-r}s $$ pairs $A,B$ such that $A+B$ does not contain zero. By the symmetry we can chose any other number instead of zero and get the same result, so there are a total of
$$ m \binom mr \binom{m-r}s $$ numbers missed between all the pairs $A,B$, so the expected number classes of missed in $A+B$ is then $$ m \frac{\binom mr \binom{m-r}s}{\binom mr \binom{m}s} = m\frac{(m-r)!(m-s)!}{(m-r-s)!m!} $$

So the exact formula for the expected number of distinct elements in $A+B$ is $$ E|A+B| = m\left ( 1 - \frac{(m-r)!(m-s)!}{(m-r-s)!m!} \right) $$

I'm also interested in a numerical approximation, playing with Stirling approximation it is easy to find good approximation in my range of intereset is given by

$$ E|A+B| \approx m\left(1-\frac{ \bigl(1-\tfrac{r}{m}\bigr)^{m-r} \bigl(1-\tfrac{s}{m}\bigr)^{m-s}}{\bigl(1-\tfrac{r+s}{m}\bigr)^{m-r-s}}\right) \approx m\left(1-\exp\bigl(-\frac{rs}m\bigr)\right) $$

The last approximation is rough but good enough for my purposes.