Does the infinite limit probability of additive closure for pairs of elements from $(0, 1, 2 \cdots, n)$ not exist?

26 Views Asked by At

Suppose that we have a sequence of non-negative integers $S_n = (0, 1, 2 \cdots, n)$. At a given value of $n$ we can uniformly sample two elements of $S$ with replacement. We can check if adding those two elements elements together gives us an integer that is itself in $S_n$.

We can simulate this with the following code:

from random import sample
import numpy as np
import matplotlib.pyplot as plt

reps = 10**4

probs = []
for size in range(2, 1000):
    space = set(range(size))
    batch = []
    for i in range(reps):
        a, b = sample(space, 1)[0], sample(space, 1)[0]
        batch.append(a+b in space)
    probs.append(np.mean(batch))

plt.plot(probs)
plt.xlabel('n')
plt.ylabel('$Pr(a+b \in S)$')
plt.show()

This produces the plot:

enter image description here

It is evident that the probability in these finite cases seems to trend toward $Pr(a+b \in S_n) \approx \frac{1}{2}$ fairly quickly. If I were to guess the value of $\lim_{n \rightarrow \infty} Pr(a+b \in S_n)$ based on the plot above, I would think it would be $\frac{1}{2}$.

But $S_{\infty}$ would just be the increasing sequence of all natural numbers (with zero). The set of natural numbers is closed for addition (excluding subtraction for the inverse problem) of any of its elements. Thus I would think that $Pr(a+b \in S_{\infty}) = 1$ because the closure is provable.

So if the limit does not equal the correct value, then the limit doesn't exist. Alternatively, I have erred in my thinking. Is my conclusion correct, and for the reasons I stated?

1

There are 1 best solutions below

0
On BEST ANSWER

$\frac12$ is the correct value for the limit: consider that the sum must be either less than $n,$ equal to $n,$ or greater than $n.$ For each $x+y < n$ with $x$ and $y$ in our set, we also have that $n - x$ and $n - y$ are in the set, so $(n - x) + (n - y) = 2n - (x + y) > 2n - n = n,$ so $$P(x + y > n) = P(x + y < n) = \frac12 \left(1 - P(x + y = n)\right)$$

$$P(x+y \leq n) = P(x + y < n) + P(x + y = n) = \frac12 \left(1 + P(x + y = n)\right)$$

and because there are $n+1$ ordered pairs of $(x,y)$ which sum to $n$ in our set (the pairs $(x, n-x)$ for any $x$ in our set) and there are $(n+1)^2$ such ordered pairs, if we select uniformly then we'll have $P(x + y = n) = \frac1{n+1},$ so:

$$P(x + y \leq n) = \frac12 + \frac1{2(n+1)}$$

which clearly goes to $\frac12$ as $n$ gets large.

As a reminder, when we take a limit at infinity, we're not actually looking at the behavior "at infinity," but rather what happens as we look at arbitrarily large finite numbers. In general, when we take a limit approaching a point, the behavior at that point isn't relevant, only the behavior "near" the point.