# Finding $P( x_1 + x_2 + x_3\le 8)$ where the variables are uniformly distributed

Problem:
Suppose that $$x_1$$, $$x_2$$ and $$x_3$$ are independent uniformly distributed on the interval $$[1,3]$$. What is the probability that $$x_1 + x_2 + x_3 < 8$$.
Let $$p$$ be the probability we seek. The density for these three random variables is: $$f(x) = \begin{cases} \frac{1}{2} & \text{for } 1 \leq x \leq 3 \\ 0, & \text{otherwise } \end{cases}$$ \begin{align*} p &= \int_{1}^{3} \int_{1}^{5-x_1} \int_{1}^{8-x_1-x_2} \left( \frac{1}{2}\right)^3 \, dx_3 \, dx_2 \, dx_1 \\ p &= \int_{1}^{3} \int_{1}^{5-x_1} \frac{x_3}{8} \, \Big|_{x_3 = 1}^{x_3 = 8-x_1-x_2} \, dx_2 \, dx_1 \\ p &= \int_{1}^{3} \int_{1}^{5-x_1} \frac{8 - x_1 - x_2}{8} - \frac{1}{8} \, dx_2 dx_1 \\ p &= \int_{1}^{3} \int_{1}^{5-x_1} \frac{7 - x_1 - x_2}{8} \, dx_2 \, dx_1 \\ p &= \int_{1}^{3} \frac{7x_2 - x_1 x_2 - \frac{x_2^2}{2}}{8} \Big|_{1}^{5-x_1} \, dx_1 \\ p &= \int_{1}^{3} \frac{7(5-x_1) - x_1(5-x_1) - \frac{(5-x_1)^2}{2} }{8} - \frac{1}{8} \, dx_1 \\ p &= \int_{1}^{3} \frac{14(5-x_1) - 2x_1(5-x_1) - (5-x_1)^2 - 2 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ 70 - 14x_1 - 2x_1(5-x_1) - ( 25 - 10x_1 + x_1^2 ) - 2 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ 70 - 14x_1 - 2x_1(5-x_1) - 25 + 10x_1 - x_1^2 - 2 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ - 14x_1 - 2x_1(5-x_1) + 10x_1 - x_1^2 + 43 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ -4x_1 - 2x_1(5-x_1) - x_1^2 + 43 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ -4x_1 - 10x_1 + 2x_1^2 - x_1^2 + 43 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ x_1^2 - 14x_1 + 43 }{16} \, dx_1 \\ p &= \int_{1}^{3} \frac{ x_1^2 - 14x_1 }{16} \, dx_1 + (3-1)\left( \frac{43}{16} \right) \\ p &= \int_{1}^{3} \frac{ x_1^2 - 14x_1 }{16} \, dx_1 + \frac{43}{8} \\ p &= \left( \frac{1}{16 }\right) \int_{1}^{3} ( x_1^2 - 14x_1 ) \, dx_1 + \frac{43}{8} \\ \end{align*} Using an online integral calculator, I find: $$\int_{1}^{3} ( x_1^2 - 14x_1 ) \, dx_1 = - \frac{142}{3}$$ \begin{align*} p &= \left( \frac{1}{16 }\right) \left( - \frac{142}{3} \right) \,+ \frac{43}{8} \\ p &= -\frac{71}{3(8)} + \frac{43}{8} = \frac{139 - 71}{24} \end{align*} Since $$p$$ is greater than $$1$$, my answer cannot be right. Were did I go wrong?

I would also like to know if I setup the integral correctly.

I ran the following R script:

count = 0
limit = 10*1000*1000
for ( i in 1:limit ) {
num =  sum( runif( 3, 1, 3 ) )
if ( num <= 8 )
count = count + 1
}


The result was around 0.979. Therefore, I question the answer of $$\frac{7}{8}$$.

• The boundary points of your integrals are not correct: both $x_2$ and $x_3$ should be $\le 3$. Dec 29, 2019 at 14:22
• for example $8-x_1-x_2$ can be higher than 3, so you should replace $8-x_1-x_2$ with $min(8-x_1-x_2,3)$ similarly replace $5-x_1$ with $min(5-x_1,3)$. Dec 29, 2019 at 14:59
• Calculations can be simplified by realizing, that $Y_i := X_i -1$ follows a uniform distribution on $(0,2)$, so you could instead calculate $P(Y_1+Y_2+Y_3 \leq 5)$, which would simplify the calculations. Dec 29, 2019 at 15:06
• The $5-x_1$ part is unnecessary. Pls see my answer. Dec 29, 2019 at 16:44
• The answer is $47/48 \approx 0.979$, not $7/8$. Dec 29, 2019 at 17:19

I disagree with the other answer (and OP, and another commenter) that the $$x_2$$ limit has to be $$\min(5-x_1, 3)$$. Why should it be that? $$x_2$$ can be the entire range $$[1,3]$$. There is zero reason to restrict $$x_1+x_2 \le 5$$ because, for any $$(x_1,x_2) \in [1,3]^2$$ we can account for $$x_1+x_2+x_3 \le 8$$ simply by integrating $$x_3 \in [1, \min(8-x_1-x_2,3)]$$. E.g. the point $$(3,3,1.9)$$ is a part of the event (i.e. it satisfies the inequality) but is not part of the integral if we use the limits $$x_2 \in [1, \min(5-x_1, 3)] = [1, 2]$$.

I.e. I think the correct integral should be:

$$\int_1^3 dx_1 \int_1^3 dx_2 \int_1^{\min(8-x_1-x_2,3)} \frac18 dx_3 = {47 \over 48}$$

as evaluated by wolfram alpha. Note that $$7/8$$ has to be way off because

$$\frac18 = P(x_1 > 2) P( x_2 > 2) P(x_3 > 2)$$

but it is very obvious that $$x_1, x_2, x_3 > 2$$ are necessary but very insufficient for $$x_1 + x_2 + x_3 > 8$$.

As @Leander point out, you missed in the limits that the information of $$x_1$$, $$x_2$$ and $$x_3$$ must lie on $$[1,3]$$. Thus your correct integral should be

$$p = \int_{1}^{3} \int_{1}^{\min\{5-x_1,\,3\}} \int_{1}^{\min\{8-x_1-x_2,\,3\}} \left( \frac{1}{2}\right)^3 \, dx_3 \, dx_2 \, dx_1 = \frac{7}{8}\lt 1.$$

• IMHO this answer is wrong. Pls see my answer. What do you think? Dec 29, 2019 at 16:44
• I think it is correct, no reason to restrict $x_2$.
– V.J.
Dec 29, 2019 at 17:33
• No reason to restrict $x_2$ to $< 5-x_1$, so you don't need that in the integral limit. Dec 29, 2019 at 17:35
• @antkam I think you are right.
– Bob
Dec 29, 2019 at 17:35