Let us assume a pure random number generator generates a random number between the given range $[0,m]$ with equal probability.

Given $m_1$, let it generate a random number($r_1$) in the range $[0,m_1]$. Given $m_2$, let it generate a random number($r_2$) in the range $[0,m_2]$.

Now what is the probability that $r_1 + r_2 < K$ ( another number)?

How can I calculate this probability?

  • 8
    $\begingroup$ Considering $X = (r_1, r_2)$ as a point in $\Bbb{R}^{2}$ may help you calculate the probability. $\endgroup$ Aug 2, 2013 at 12:23
  • 12
    $\begingroup$ "How can I calculate this probability?" By drawing the part $H$ of the line $x+y=K$ in the rectangle $R=(0,m_1)\times(0,m_2)$, computing the area of the triangle with a vertex at $(m_1,m_2)$ with hypotenuse $H$ and dividing it by the area of $R$. The result is the probability that $r_1+r_2\gt K$. (Unrelated: homework?) $\endgroup$
    – Did
    Aug 2, 2013 at 12:25
  • 1
    $\begingroup$ Not entirely sure, but perhaps this should help - math.stackexchange.com/questions/427139/…. $\endgroup$ Aug 2, 2013 at 12:27
  • $\begingroup$ It is not a home work. I am just learning probability. I found this question interesting on a website. $\endgroup$ Aug 2, 2013 at 12:28
  • 1
    $\begingroup$ Suspense... $ $ $\endgroup$
    – Did
    Aug 2, 2013 at 14:55

3 Answers 3


A picture to go with Did's excellent hint.

enter image description here

  • 5
    $\begingroup$ Black magic!$\left . \right .$ $\endgroup$
    – Thomas
    Aug 2, 2013 at 15:22

$$ {m_{1}m_{2} \over m^{2}} - {\left(m_{1} + m_{2} - K\right)^{2} \over 2m^{2}}\,,\quad K < m_{1} + m_{2} $$

  • $\begingroup$ Probably could have been a comment, but $(+1)$ anyway :) $\endgroup$
    – Mr Pie
    Mar 19, 2018 at 9:18
  • $\begingroup$ @FelixMarin How did you come to that conclusion? I feel like my answer is wrong compared to your equation, could you take a look at mine? (I just learned the answer and decided to try and express it in my own words) math.stackexchange.com/a/2950353/473500 $\endgroup$ Oct 10, 2018 at 18:27

We are looking for the probability of the sum of two random numbers being less than or equal to K, the two random numbers, $r_1$ and $r_2$, are constrained as followed:

$0 \leq r_1 \leq m_1 $

$ 0 \leq r_2 \leq m_2$

Let's say that: $$ m_1=6, m_2=6, K=2$$

Let's visualize it:

enter image description here

This is a "sum box". The sides are not discrete but continuous. Inside the box, we have indefintely many numbers summarized by adding up the number from $[0, m_1]$ and the number from $[0, m_2]$. Basically this shows all the possible combinations that you are able to create.

The area of possible outcomes is: $$m_1 \cdot m_2=6\cdot6=36$$

The area of possible outcomes of which $m_1+m_2<=K$ (the area of the green triangle) is: $$(K \cdot K)/2 = (22)/2=2 $$

We can now calculate the probability of the sum of the two numbers each with their own constrained interval as follows: (area of green triangle)/(area of grey square) = $2/36$

We can now conclude that the probability of the sum of two numbers chosen randomly from the interval $[0,6]$ the probability of the sum being less than or equal to 2 is $2/36$


You must log in to answer this question.

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