Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose we have a unit cube (side=1) and a plane with equation $x+y+z=\alpha$. I'd like to compute the volume of the region that results once the plane sections the cube (above the plane). There are three cases to analyze, and I can't quite visualize one of them.

Case 1: $0 \le \alpha < 1$

In this case, the section looks like a triangle, and the volume of interest is 1 minus the volume of the lower left tetrahedron, i.e., $$V = 1 - \int_0^\alpha \int_0^{\alpha-x} \int_0^{\alpha-x-y} dz\,dy\,dx = 1 - \frac{\alpha^3}{6}.$$

Case 3: $2 < \alpha \le 3$.

Here, the section is again a triangle, and the volume of interest is the upper right tetrahedron, i.e., $$V = \int_{\alpha-2}^1 \int_{\alpha-x-1}^1 \int_{\alpha-x-y}^1 dz\,dy\,dx = \frac{(3-\alpha)^3}{6}.$$

Case 2: $1 \le \alpha \le 2$.

This is where I'm sort of stuck. The section is a hexagon, with one of the inequalities being $\alpha-x-y \le z \le 1$, hence the innermost integral should be $\int_{\alpha-x-y}^1 dz$. The projection of the hexagon slice onto the $xy$-plane is described by $y \ge \alpha-1-x$ and $y \le \alpha-x$. Hence, the area of the hexagon projection is $$ A = \int_0^{\alpha-1} \int_{\alpha-x-1}^1 dy\,dx + \int_{\alpha-1}^1 \int_0^{\alpha-x} dy\,dx$$

Question: When I move from $A$ to $V$ am I allowed to distribute the innermost integral between the summing terms, i.e. is it correct to write $$V = \int_0^{\alpha-1} \int_{\alpha-x-1}^1 \int_{\alpha-x-y}^1 dz\,dy\,dx + \int_{\alpha-1}^1 \int_0^{\alpha-x} \int_{\alpha-x-y}^1 dz\,dy\,dx \quad ??$$

If not, what's the approach?

Note that there's a neat connection between this problem and figuring out the CDF of a sum of a random variable that has triangular distribution with support on $[0,2]$ and a random variable with uniform distribution on $[0,1]$ (assuming independence). Hence, I know what the answer should be for Case 2 because I worked out the convolution, but I just want to figure out the answer geometrically as well.

share|improve this question
Are you certain that it's a pentagon and not a hexagon? –  abiessu Jul 29 '13 at 4:52
I think it's a pentagon, because the bottom of the cube is not touched by the slice. I may be wrong. –  baudolino Jul 29 '13 at 4:54
If I recall the slicing correctly, you get triangles hexagons triangles when you view the cross-section of a cube as it passes from corner to corner through a surface... Is this a different interpretation from what you are describing? –  abiessu Jul 29 '13 at 4:58
I don't think you can get a pentagon by slicing a cube (though I can't prove this). –  bubba Jul 29 '13 at 5:39
You're right about it being a hexagon after all (because the plane rests on $xy$ as well). However, in general, getting a pentagon is also possible (the section looks like a baseball diamond). Just make the cut starting at some height $z$ above the base and go at an angle so that you exit the cube on the top facet, but beyond that square's diagonal. –  baudolino Jul 30 '13 at 0:24

5 Answers 5

up vote 7 down vote accepted

For $1 \le \alpha \le 2$, it is much easier to visualize the integral by subtracting instead of adding pieces of the volume.

As shown in the picture below, when $1 \le \alpha \le 2$, the volume of cube section below intersection of the plane $x + y + z = \alpha$ is the difference of the volume of one big tetrahedron with width/height/depth $= \alpha$ with three smaller ones with width/height/depth $= \alpha-1$. So the volume above the intersection becomes

$$1 - \left( \frac16 \alpha^3 - 3 ( \frac16 (\alpha-1)^3 )\right) = 1 - \frac16 \alpha^3 + \frac12 (\alpha-1)^3$$

Cube section 1


About the question whether this argument can be extended to higher dimension, the answer is yes. Let's look at the 3-dimension $2 \le \alpha \le 3$ case first.

Cube section 2

As one increases $\alpha$ beyond $2$, the three tetrahedron in first figure start overlap. As shown in second figure, the intersection of the three tetrahedra are now three even smaller tetrahedra of width/height/depth = $\alpha -2$.

Previous way to compute the "volume" of cube section below the plane $x + y + z = \alpha$ now subtract too much from this three even smaller tetrahedron. One need to add them back. As a result, the volume above the plane becomes:

$$\begin{align}&1 - \left( \frac16 \alpha^3 - 3(\frac16 (\alpha-1)^3 + 3(\frac16 (\alpha-2)^3 \right)\\ = & 1 - \frac16 \alpha^3 + \frac12 (\alpha-1)^3 - \frac12 (\alpha-2)^3\\ = & \frac{(3-\alpha)^3}{6} \end{align}$$

Let us switch to the $k$-dimension case. To compute the "volume" of the hypercube section above the hyperplane $x_1 + \ldots + x_k = \alpha$, the first step is to subtract the volume of a $k$-simplex of size $\alpha$ from 1.

  1. if $\alpha \le 1$, we are done.
  2. if $\alpha > 1$, we over subtract the volume of $\binom{k}{1}$ simplices of size $\alpha-1$ and need to add them back.
  3. if $\alpha > 2$, the $\binom{k}{1}$ simplices of size $\alpha-1$ in step 2 intersect and the intersection is a union of $\binom{k}{2}$ $\;k$-simplices of size $\alpha-2$. This means in step 2, we have added back too much and need to subtract the volume again.

Repeat these arguments and notice in the middle of the process, we need to either add or subtract the volumes of $\binom{k}{i}$ $\;k$-simplices of size $\alpha-i$. The "volume" of interest finally becomes:

$$1 -\sum_{i=0}^{\lfloor \alpha \rfloor} (-1)^i \binom{k}{i} \frac{(\alpha-i)^k}{k!}$$

share|improve this answer
This is a great way to think about it. Am I correct in asserting that one can expand this argument so that on a $[0,1]^k$ hypercube the "volume" of interest should be given by $$V = 1- \dfrac{1}{k!}\sum_{i=0}^{\lfloor \alpha \rfloor} {(-1)^i \binom{k}{i} (\alpha-i)^k} \quad ?$$ –  baudolino Jul 30 '13 at 22:16
+1. Good idea, and nice picture. –  bubba Jul 31 '13 at 1:45

Put $\alpha:=1+\beta$ with $0<\beta<1$. Then the plane $x+y+z=1+\beta$ cuts the top face of the cube in the segment connecting $(0,\beta)$ with $(\beta,0)$ at $z$-level $1$, and cuts the bottom face of the cube in the segment connecting $(\beta,1)$ with $(1,\beta)$ at $z$-level $0$.

Consider the vertical stalk through a fixed point $(x,y)$ on the bottom face $Q$ of the cube. It intersects your polyhedron $P$ in a vertical segment whose length $\ell(x,y)$ is given by $$\ell(x,y)=\cases{0&$(x+y<\beta)$ \cr x+y-\beta\quad&$(\beta\leq x+y\leq \beta+1)$ \cr 1&$(x+y>\beta+1)$\cr}\ .$$ The volume of $P$ is then given by $$\eqalign{{\rm vol}(P)&=\int\nolimits_Q \ell(x,y)\ {\rm d}(x,y)\cr &=\int_0^\beta\int_{\beta-x}^1 (x+y-\beta)\ dy\ dx+\int_\beta^1\int_0^{1+\beta-x}(x+y-\beta)\ dy\ dx +{1\over2}(1-\beta)^2\ .\cr}$$

share|improve this answer

This can be interpreted as trying to find $1$ minus the CDF of the sum of three uniformly distributed random variables in $[0, 1]$. The PDF is the quadratic B-spline given by

$$f(x)=\begin{cases} \frac{x^2}{2} & x\in[0,1] \\ \frac{x^2}{2} - \frac{3(x-1)^2}{2} & x\in[1,2]\\ \frac{x^2}{2} - \frac{3(x-1)^2}{2} +\frac{3(x-2)^2}{2} & x\in[2,3] \end{cases} $$

The CDF follows from this by integration.

share|improve this answer
Box splines, perhaps? –  bubba Jul 29 '13 at 10:49
Thank you, I have mentioned this solution approach in my question. I want to derive the answer in another fashion, using geometrical intuition. –  baudolino Jul 30 '13 at 0:25

The object created by slicing is a polyhedron, obviously. Then, the volume of a polyhedron can be computed conveniently by decomposing it into tetrahedra and adding up the (signed) volumes of these tetrahedra. You can find an explanation of the technique in this document. There is also a paper by Michael Kallay on the same subject that gives slightly simpler formulae. Ask again if this is of interest and you can't find it.

All of this is still computation of volume intergals, really. But, in the case of tetrahedra, the values of the integrals can be expressed by simple closed-form formulae, so the integration is somewhat hidden.

You'll still need to consider several cases (depending on where/how the plane slices the cube).

Actually, I think there are three cases, depending on whether the planar slice has three, five, or six sides. These are shown in the picture below:

cube slices

The blue and brown slices are 3-sided, the red and green ones are 5-sided, and the pink one is 6-sided.

share|improve this answer

I had the same problem and I came up with the following very simple (and very implicit) formula (I'm unfamiliar with stackexchange's maths notation, forgive me for posting Mathematica code):

volPart[q___, r_] := Module[{v, d, t, h},
  v = Select[Chop[{q}], (# =!= 0) &];
  d = Length[v];
  t = Tuples[{-1, 1}, d];
  h = (t/2).v + r;
  (HeavisideTheta[h] h^d).(Times @@@ t)/(d! Times @@ v)

The return value of volPart[q1, q2, ..., r] should be a volume of a part of the unit hypercube centered at $\{0, 0, ...\}$ above the hyper-plane $x1 q1 + x2 q2 + ... + r > 0$. By appropriate scaling and offsetting the arguments, the formula could be generalised to other cases.

For zero valued numerical coefficients in linear form the formula effectively reduces to lower dimension case. For symbolic coefficients approaching zero, the limit must be taken, though.

The basic idea is that the volume above the hyper-plane for fixed arguments is a linear combination of vertices' "heights" above (but only these above) the hyper-plane raised to the power of effective dimension. Note the alternating sign for each connected vertex (Times @@@ t).

In your particular case this reduces to: $$\frac{\alpha^3{\theta}(-\alpha)+3(1-\alpha)^3{\theta}(1-\alpha)-3(2-\alpha)^3{\theta}(2-\alpha)+(3-\alpha)^3{\theta}(3-\alpha)}{6}$$

By expanding $\theta$, this could also be rewritten as: $$\begin{cases} 1 & \alpha \le 0\\ 1-\frac{\alpha^3}{6} & 0 < \alpha \le 1 \\ \frac{\alpha^3}{3}-\frac{3 \alpha^2}{2}+\frac{3 \alpha}{2}+\frac{1}{2} & 1 < \alpha \le 2 \\ -\frac{(\alpha-3)^3}{6} & 2 < \alpha \le 3 \\ 0 & 3 < \alpha\end{cases}$$

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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