I am trying to find a way of determining the probability that the sum of two continuously uniformly distributed random variables is less than some constant $C$, formally:

Let $A \sim \mathcal{U}(0,a)$ and $B\sim\mathcal{U}(0, b)$ and $C \in \mathbb{N}$, how can we calculate: $$\mathbb{P}[A+B<C]$$

Now, my line of reasoning is as follows; we can find the cumulative probability that the first variable takes a value less than $C$ and multiply it by the cumulative probability that the second variable takes a value less than $C-x$, where $x$ is the value of the first variable.

This would give us an expression (if $C < a+b$):

$$\begin{align*}\mathbb{P}[A+B<C]&=\int_{0}^{C}\mathbb{P}[A=x]\mathbb{P}[0 \leq B < C-x]\:\mathrm{d}x \\ &= \int_{0}^{C}\frac{1}{a}\int_{0}^{C-x}\frac{1}{b}\:\mathrm{d}y\:\mathrm{d}x \\ &= \int_{0}^{C}\frac{C-x}{ab}\:\mathrm{d}x \\ &= \frac{C^{2}}{2ab}\end{align*}$$

So in general we should have:

$$\mathbb{P}[A+B<C]=\begin{cases}\frac{C^{2}}{2ab} & C < a+b \\ 1 & C \geq a+b \\ 0 & \text{otherwise}\end{cases}$$

However, in the case where $a = 1185$, $b=3968$, $C=3649$, I am told that $\mathbb{P}[A+B<C]=\frac{6113}{7936}$, however, applying the above formula gives us:


What is wrong with my approach?

  • $\begingroup$ There are many conditions. For instance, if $a + b < C$, then $P = 1$. If $a < b \land a < C \land b > C$ then $P = (2C -a)/2b$. And so forth. Please state your conditions on $a$, $b$ and $C$. $\endgroup$ – David G. Stork Jan 27 '15 at 1:48
  • $\begingroup$ @DavidG.Stork The only conditions I have are: $a,b,C\in\mathbb{N}$. Why would the relative ordering of $a$ and $b$ matter, as $a+b = b+a$? $\endgroup$ – Thomas Russell Jan 27 '15 at 1:50

You have to go through each case: $ \begin{cases} 1 & a+b<C \\ \frac{C^2}{2 a b} & (a\geq b\lor a\geq C)\land (a<b\lor b\geq C)\land C>0 \\ \frac{C-b}{a} & a+b=C \\ -\frac{a-2 C}{2 b} & a<b\land a<C\land b\geq C \\ -\frac{b-2 C}{2 a} & a>b\land b<C\land a\geq C \\ -\frac{a^2-2 a C+(b-C)^2}{2 a b} & a+b>C\land ((a<b\land b<C)\lor (a>b\land a<C)) \\ -\frac{2 b^2-4 b C+C^2}{2 a b} & a=b\land b<C\land a+b>C \end{cases} $

  • $\begingroup$ I see where the problem was, I was always assuming that $a \geq b \geq C$; thank you for pointing this out! $\endgroup$ – Thomas Russell Jan 27 '15 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.