# Calculate probability of random numbers adding up to or being greater than another number

What's a simple formula I can use for calculating the probability of a set of random numbers adding up to or being greater than another number? Where $W$ is the amount of random numbers picked, $X$ is the lower limit, $Y$ is the upper limit and $Z$ is the number I need to reach.

Example 1: 2 numbers are picked randomly from 500 to 800, what is the probability they will total 1300 or greater.

Example 2: 3 numbers are picked randomly from 400 to 600, what is the probability they will total 1500 or greater.

The random numbers can include the upper and lower limit and will only be whole numbers.

Edit 1: I should also add the exact same number can be picked multiple times (so they are replaced) and that any number is equally as likely as another.

Edit 2: Could the formula be any of these?

1) $P=\left(\frac{Y-(Z/W)}{Y-X}\right)^{W}$

2) $P=\frac{Y-(Z/W)}{Y-X}$

3) $P=\frac{\frac{Y-(Z/W)}{Y-X}}{W}$

Do any of those work? If not, why not?

• You're choosing integers? If so I think this has probably been dealt with in some of the posts on adding results from throwing various kinds of dice. – Glen_b -Reinstate Monica Apr 22 '16 at 4:39
• And, to an excellent approximation, the probabilities can be found by using results on the sums of uniform distributions. – whuber Apr 22 '16 at 14:30
• 1. I strongly advise against throwing collections of formulas at a problem and trying to back-guess which one applies -- that a recipe for muddy thinking and no gain in understanding, leaving you unable to solve similar but equally easy problems that don't have exactly the same formula (you lose any hope of generalizable knowledge, which is nearly always the actual aim). Instead you should apply probability ideas to derive a formula if you require one, and then apply some reaosnableness checks, and find a way to check that it's correct in particular cases. $\,$ 2. Is this problem for a class? – Glen_b -Reinstate Monica Apr 23 '16 at 0:17
• Regarding #2, the context for this question is a little side project where in a game a Tank can deal random damage between two values, which for each hit is subtracted from an opposing Tank's health pool (for example, if I fired 2 shells that do between 700 and 900 damage, and the opposing Tank has 1700 health, what's the chance that those 2 shells will destroy it). I currently have a spreadsheet in progress as I continue to figure out how to calculate the probability: docs.google.com/spreadsheets/d/… – Mark Apr 23 '16 at 5:07
• Thanks for the details on what you're doing (not least because it makes it more interesting to give the solution). – Glen_b -Reinstate Monica Apr 24 '16 at 10:24

Rename lower limit to $L$ and upper limit to $U$, and denote sum of draws as $S$.

Example 1: We denote first draw by $X$ and second draw by $Y$, and $Z$ the number you need to reach:

$P(S\geq Z) = P(X+Y\geq Z) = \sum_{x=L}^U P(X=x) P(Y\geq Z -x)$.

But, if $Z-U > L$, then there is a lower limit $L_1$ in $(L,U)$ that the first draw needs to be greater than, so we must have:

$P(S\geq Z) = P(X+Y\geq Z) = \sum_{x=L_1}^U P(X=x) P(Y\geq Z-x)$

I do not know if you are able to find an explicit formula, though. The probabilities totally depend on your limits in each case. The reasoning is to me analogous for Example 2.

@whuber and @Erosennin have already provided you with some helpful ideas here for the general case. A simple (depending on your definition of simple) is available for the case when the number of draws, $n=2$. In that case, let the value of the first draw be $X_1$ and the second, $X_2$, and their sum, $X_1+X_2=Z.$ Then, the probability that $Z=z$ is given by:

\begin{eqnarray*} P\left(Z=z\right)=f_{Z}(z) & = & \begin{cases} \frac{4}{(b-a+1)(b-a+2)} & ,\,\mathbf{if}\,2a+2\le z\le2b-2\\ \frac{2}{(b-a+1)(b-a+2)} & ,\,\mathbf{if}\,2b-2<z\le2b\\ \frac{2}{(b-a+1)(b-a+2)} & ,\,\mathbf{if}\,2a\le z<2a+2\\ 0, & \mathbf{otherwise} \end{cases} \end{eqnarray*}

where $a$ is the number of the lower bound and $b$ is the number of the upper bound. For more general cases, @whuber's suggestion to use sums from continuous uniform distributions is likely to be as accurate as you'd need in most practical applications.

None of the formulae that you provide work. They can be easily shown to be incorrect through a counterexample. Take the relatively simple instance where you draw 3 numbers from 1 to 3 and want to determine the probability that their sum is 9. In this case each of the formulae that you provide involve the numerator term $Y-(Z/W)$ (using your notation). In this case, that $Y-(Z/W)=3-(9/3)=0$, which implies the probability is zero, but this can't be the case since we know that if you draw, {3, 3, 3}, the numbers sum to 9, which implies $P(Z=9)>0$.