Calculate the probability that the sum of multiple ranges of numbers is above a value

probability

My question is similar to this question, with the key difference being that I'm concerned about multiple ranges of values.

Calculating probability when range of values is given


Let's say that I'm going to be given three integers, all from different ranges. All integer values are equally likely, within each range.

A number between 30 and 32
A number between 11 and 13
A number between 42 and 47

It's pretty easy to calculate min/max values, and the chance of them occurring.
However, I want to calculate the chance of the value being either above or below a certain value. For example, I might want to find the chance that my three numbers sum up to more than 88.

I know that if I graphed out these values, I'd get a bit of a bell curve, so I'm wondering if maybe there's a way to solve it like that?

I've also considered simplifying it to just dealing with the ranges:

29 + (1 to 3, all values equally likely)
10 + (1 to 3, all values equally likely)
41 + (1 to 6, all values equally likely)
=
80 + (3 to 12, some values are FAR MORE likely than others)

This would leave me with something that's pretty similar to a dice roll: 80 + 2d3 + 1d6. So I guess this could be solved with a dice calculator? But I'd still like a formula, rather than increasingly complicated dice-rolls.

Of course, I can brute-force it for this simple example, but what if I had 20 different number ranges?


In summary

Is there a formula for finding the chance of the sum of numbers from multiple ranges being above a certain value?

Best Answer

As I see it, since there are $3$ equally likely choices for ranges $(1)$ and $(2)$, and $(6)$ equally likely choices for range $(3)$, you have $(3 \times 3 \times 6) = 54$ various combinations to examine. The challenge, as you noted in your posting is to avoid brute force, and find an approach that generalizes well.

I think that Stars and Bars kicks in here.

Let $x_1, x_2, x_3$ denote the numbers assigned to the 1st, 2nd, and 3rd ranges respectively.

You are trying to determine the probability that the randomly chosen $x_1 + x_2 + x_3$ will have a sum $> 88$.

The first thing to do, in accordance with the Stars and Bars format is to normalize the variables, so that each variable has a lower bound of $0$.

To that end, let:
$y_1 = x_1 - 30 \implies 0 \leq y_1 \leq 2.$
$y_2 = x_1 - 11 \implies 0 \leq y_2 \leq 2.$
$y_3 = x_1 - 42 \implies 0 \leq y_3 \leq 5.$

Then, $x_1 + x_2 + x_3 > 88 \iff y_1 + y_2 + y_3 > 5.$

Here, I would attack the problem by letting
$S$ = the number of possible combinations of terms $(54)$.
$T$ = the number of possible combinations such that
$y_1 + y_2 + y_3 \leq 5.$

Then, the desired ratio will be $\frac{S - T}{S}.$


Therefore, the problem has been reduced to enumerating $T$.

Introduce a new variable $(c)$ that is required to be a non-negative integer. Then, $T$ may be enumerated by enumerating the number of solutions to

$$y_1 + y_2 + y_3 + c = 5 ~~: ~~y_1, y_2 \leq 2, ~y_3 \leq 5.\tag1$$

Here, you have to use Inclusion-Exclusion.

First of all, the number of solutions to $a_1 + a_2 + \cdots + a_k = n$, where $a_1, \cdots, a_k$ can be any non-negative integers is given by $\binom{n + [k-1]}{k-1}.$

So the number of solutions to (1) above, where all of the upper bound constraints are ignored is

$$T_0 = \binom{8}{3} = 56.$$

The next thing to do, in accordance with Inclusion-Exclusion is to consider how many solutions there are when the upper bound of the 1st variable is violated, the upper bound of the 2nd variable is violated, and the upper bound of the 3rd variable is violated.

I will use the syntax that an equation bijects to another equation to indicate that they each have the same number of solutions.

The equation $y_1 + y_2 + y_3 + c = 5 ~: ~y_1 \geq 3$ bijects to $y_1 + y_2 + y_3 + c = 2 ~: ~y_1 \geq 0.$

This will have $\binom{2 + [4-1]}{[4-1]} = \binom{5}{3} = 10$ solutions. Since the upper bound on $y_2$ is identical to that on $y_1$, you have that altering $y_2$ (alone) will also have $10$ solutions. Note that alteration of $y_3$ is rejected here, because raising $y_3$ from a lower value of $(0)$ to a lower value of $(6)$ will not permit the sum $y_1 + y_2 + y_3 + c = 5$ to have any solutions.

This means that $T_1 = 2 \times 10 = 20$.

Therefore, the running total, with respect to Inclusion-Exclusion, at this point is

$$T_0 - T_1 = 56 - 20 = 36.$$

Now, in accordance with Inclusion Exclusion, you have to calculate $T_2$, which will represent the number of solutions where the upper bound of $2$ of the $3$ variables is violated.

However, if $y_1, y_2$ are each increased to a lower bound of $3$, then the equation $y_1 + y_2 + y_3 + c = 5$ will not have any solutions. Therefore, $T_2 = 0$.

Therefore, $$T = T_0 - T_1 = 36.$$

Therefore, the probability that the sum of the original $(3)$ numbers will be $> 88$ will be

$$\frac{54 - 36}{54} = \frac{1}{3}.$$


Note
To the best of my knowledge, the only two viable approaches to the problem as stated are [Stars and Bars + Inclusion-Exclusion] which I used or [generating functions] which I don't know anything about.

If you have never used Inclusion-Exclusion and never used Stars and Bars before, then you will need to study the pertinent articles (and perhaps other articles that you find by googling on "Inclusion-Exclusion" or "Stars and Bars Math"). This way you will stretch your intuition, which I regard as mandatory, for such an assignment.