0
$\begingroup$

As we see in the answers of this linked question which is counting the solutions $(a_1,a_2,\ldots,a_n)$ with integer $0\leq a_i\leq r_i$ for $i \in \{1,2,\ldots,n\}$ such that

$$a_1+a_2+a_3+\ldots+a_n=N$$

Mike Earnest answered like this:

$$ W = \sum_{S\subseteq \{1,2,\dots,n\}}(-1)^{|S|}\binom{N+n-1-\sum_{i\in S}(r_i+1)}{n-1} $$

But this is a little hard to calculate. Is there any approximation that be close to the answers of this statement?

Edit: Let me clear my question with some example. I test the result for $a_1+a_2+a_3=N$ such that

$$ 0 \leq a_1 \leq 1\text{,} \qquad 0 \leq a_2 \leq 3 \text{,} \qquad 0 \leq a_3 \leq 5$$

for $ 0\leq N \leq9$. This is how the result look like in system of coordinates with $N$ for $x$-axis and $W$ for $y$-axis

(N,W)

As we see by increasing $N$, $W$ begins from $1$ and hits a maximum value and then decreases to $1$ again.

But in unbounded case, it rises:

unbounded case

The reason that there is no maximum value for $0\leq N$ is that by increasing $N$ the bounds for $a_i$, which is $0 \leq a_i \leq N$, increase too, but in other case we have a fixed bound.

In this example by trial and error I found this polynomial approximation

$$ W = -\frac{2}{5}\left( N-\frac{9}{2}\right)^2 + 8 $$

(N,W) with Ap

It makes me wonder if can we find a polynomial approximation for $W(N,n,r_i)$ in any bounded case?

$\endgroup$
3
  • $\begingroup$ For this to be an acceptable question, you need to give us more info. Why do you need this approximation, what is the context? We need to know this to be able to ascertain if our answers are good enough for your purposes. You can't just ask us to kick a football, you need to give us goalposts to aim for. $\endgroup$ Commented Apr 8, 2023 at 18:03
  • $\begingroup$ That being said, this question might have useful ideas. $\endgroup$ Commented Apr 8, 2023 at 18:04
  • $\begingroup$ @MikeEarnest thanks . I Edit the question with more info $\endgroup$
    – kodar
    Commented Apr 9, 2023 at 11:43

1 Answer 1

0
$\begingroup$

I know how to handle the situation where all of the upper limits are equal to each other. Let us say the common upper limit for the variables is $r$.

Imagine you choose $n$ integers randomly between $0$ and $r$ inclusive, independently of each other. Let $S$ be the sum of the chosen integers. Then $S$ is a random integer between $0$ and $nr$. This is useful because $P(S=N)$ is related to the number of solutions of $x_1+\dots+x_n=N$, via $$ \text{number of solutions} = (r+1)^n\cdot P(S = N) $$ The reason is because the probability space has $(r+1)^n$ equally likely outcomes; there are $n$ variables, each of which can take on $r+1$ values. The rule for the probability of an event in a uniform discrete set is $\text{probability}=(\text{# favorable outcomes})/(\text{# total outcomes})$.

To approximate $P(S=N)$, we use the the central limit theorem. Since $S$ is a sum of i.i.d. random variables, as long as $n$ is large enough, $S$ will be approximately equal in distribution to a normal random variable with the same mean and variance as $S$. Since $\mathsf E[S]=nr/2$ and $\mathsf{Var}[S]=n\cdot \frac{(r+1)^2-1}{12}$, we conclude that $$ P(S=N)\approx \frac1{\sqrt{2\pi \sigma^2}}e^{-(x-\mu)^2/(2\sigma^2)}, $$ where $\mu=nr/2$ and $\sigma^2=n\cdot \frac{(r+1)^2-1}{12}$. Combining the last two displayed lines gives the desired approximation. This is not a polynomial approximation like you requested, but you can turn it into a polynomial approximation by truncating the MacLaurin series for $e^t$. That is, you replace $e^t$ with $\sum_{k=0}^K \frac{t^k}{k!}$ for some natural number $K$, where $t=-(x-\mu)^2/(2\sigma^2)$.

You can attempt to do a similar thing in the case where the upper limits are unequal. The result would be $$ \text{number of solutions} = P(S=N)\cdot \prod_{i=1}^n (r_i+1),\\ P(S=N)\stackrel?\approx \frac1{\sqrt{2\pi \sigma^2}}e^{-(x-\mu)^2/(2\sigma^2)},\quad\text{where}\\ \mu=\frac12\sum_{i=1}^n r_i,\qquad \sigma^2=\sum_{i=1}^n\frac{(r_i+1)^2-1}{12} $$ This approximation is not always good, and it is exceedingly bad if the upper limits are widely and non-uniformly spread out. It does work well when the upper limits are approximately equal to each other, and it seems to work well if the upper limits are evenly spread out, like if $(r_1,r_2,\dots,r_7)=(1,3,5,7,9,11,13)$.

$\endgroup$
4
  • $\begingroup$ waw! thanks . so it was not polynomial it was normal distribution . I had a few question first why we should multiply our probability with $(r+1)^n$ ? does If n go's to infinity our approximation be more precisely even if upper limits spread out non-uniformly ? @MikeEarnest $\endgroup$
    – kodar
    Commented Apr 10, 2023 at 8:31
  • $\begingroup$ and I think at the second " number of solutions " the place of n and N must be switch . and do you know any reference that discussed about this problem and your answer ? @MikeEarnest $\endgroup$
    – kodar
    Commented Apr 10, 2023 at 8:37
  • $\begingroup$ I fixed the n/N typo, and explained multiplying by $(r+1)^n$ in an edit. The only reference I have is this other MSE question I linked, and I have no idea how to answer your question about $n\to\infty$. $\endgroup$ Commented Apr 10, 2023 at 16:34
  • $\begingroup$ from Lindeberg–Lévy CLT $ \frac {S_n - n μ }{\sqrt(nσ^2)}\approx N(0,1)$ how we can show $N(μ ,σ^2 )$ or $\frac1{\sqrt{2\pi \sigma^2}}e^{-(x-\mu)^2/(2\sigma^2)}$ @MikeEarnest $\endgroup$
    – kodar
    Commented Aug 1, 2023 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .