# How to calculate volume given by inequalities?

I need to find the volume of the 3d space that is given by the following conditions: \begin{array}{c} 0 < x_1 < 1\\ 0 < x_2 < 1\\ 0 < x_3 < 1\\ x_1 + x_2 + x_3 < a. \end{array} I also need to solve this problem for the $n$-dimensional space. Could anybody, please, tell me if this problem is solvable analytically and how one can find the solution?

1. I need results only for a between 0 and 1.

2. I know how to solve the 2D case. It is trivial. I think that I could even manage to solve the 3D case, but I need a general solution scalable to higher dimensions.

• Do you know how to solve the 2D case? – Did Aug 17 '11 at 10:11
• Do you need the result for arbitrary $a$, or just $0<a<1$? – Hans Lundmark Aug 17 '11 at 10:15
• Continuing on my last comment... Well, since you know how to solve the 2D case (and since, according to your addendum, this is trivial), you could use it to decompose the 3D case as an $x_3$-integral of 2D cases. Likewise for the nD case and the (n+1)D case. (Of course, all this is rather moot since @Thomas Ahle gave a solution valid in any dimension, there: math.stackexchange.com/questions/31365). – Did Aug 17 '11 at 12:43

If $X_1,\ldots,X_n$ are inedependent uniform$(0,1)$ random variables, then $${\rm P}(X_1+ \cdots +X_n \leq a) = {\rm volume}(A),$$ where $$A = \{ (x_1 , \ldots ,x_n ) \in (0,1)^n :x_1 + \cdots + x_n < a\} .$$ For the probability density function of the sum $X_1+ \cdots +X_n$, see this answer.
EDIT: When $0 < a \leq 1$, it holds $${\rm volume}(A) = \frac{{a^n }}{{n!}}.$$
EDIT 2: Probabilistic proof for the case $0 < a \leq 1$. Let $X_1,X_2,\ldots$ be independent uniform$(0,1)$ variables. We want to show that, for any $0 < a \leq 1$, $${\rm P}(X_1+ \cdots +X_n \leq a) = \frac{{a^n }}{{n!}}.$$ This can be easily done by induction, as follows. The case $n=1$ is trivial: ${\rm P}(X_1 \leq a) = a$. Assume that the result is true for $n$, and let $m = n+1$. By the law of total probability, $${\rm P}(X_1+ \cdots + X_m \leq a) = \int_0^1 {{\rm P}(X_1 + \cdots + X_m \le a|X_m = u)\,du}$$ $$= \int_0^a {{\rm P}(X_1 + \cdots + X_m \le a|X_m = u)\,du} = \int_0^a {{\rm P}(X_1 + \cdots + X_n \le a - u)\,du}.$$ Hence, by the induction hypothesis, $${\rm P}(X_1+ \cdots + X_m \leq a) = \int_0^a {\frac{{(a - u)^n }}{{n!}}\,du} = - \frac{{(a - u)^{n + 1} }}{{(n + 1)!}}\bigg|_0^a = \frac{{a^{n + 1} }}{{(n + 1)!}}.$$ The result is thus proved.
Here's a more geometric take. You're asking about the volume of the convex hull of the $n+1$ points ${\bf 0}, {\bf a}_1, {\bf a}_2, \ldots {\bf a}_n$, where ${\bf a}_i$ is the point with an $a$ in coordinate $i$ and $0$'s elsewhere.
The convex hull of $n+1$ affinely independent points is called an $n$-simplex. The volume of an $n$-simplex is known to equal the volume of its corresponding $n$-parallelotope, divided by $n!$.
Since in this case the corresponding $n$-parallelotope is the $n$-cube $\{ (x_1 , \ldots ,x_n ) \in (0,a)^n\}$, which obviously has volume $a^n$, the volume you want is $a^n/n!$.