Suppose we have a cuboid with dimensions $A\times B\times C$ composed of $1\times 1\times 1$ cubes with $\gcd(A,B)=gcd(A,C)=gcd(B,C)=1$.

Considering any vertex of the cuboid as origin, say $O$, we select $3$ vertices $P$,$Q$ and $R$ such that $OP$, $OQ$ and $OR$ are mutually perpendicular. If we cut the cuboid along the plane $PQR$ in two parts, how many $1\times 1\times 1$ cubes will be cut?

I have till now solved the problem in $2D$ system with a line slicing an $A\times B$ rectangle through the diagonal. In that case the answer turns out to be $A+B-1$. With similar logic I established that any needle through the diagonal of cuboid will pierce through $A+B+C-2$ cubes (correct me if I'm incorrect). But I could not wrap my head around the cuboid and plane problem.

  • 1
    $\begingroup$ Why the down-votes? :( $\endgroup$
    – prateek
    Jun 30, 2014 at 19:07
  • $\begingroup$ I don't know, @Prateek, but here's a MathJax tutorial :) $\endgroup$
    – Shaun
    Jun 30, 2014 at 19:23
  • $\begingroup$ Thanks @Shaun got it now :) $\endgroup$
    – prateek
    Jun 30, 2014 at 19:34
  • $\begingroup$ Do you mean how many $1 \times 1$ squares on the surface, or how many $1 \times 1 \times 1$ cubes? $\endgroup$
    – augurar
    Jun 30, 2014 at 20:23
  • 1
    $\begingroup$ Also, are you sure you don't need $\gcd(A,B)=\gcd(A,C)=\gcd(B,C)=1$? $\endgroup$
    – augurar
    Jun 30, 2014 at 21:47

1 Answer 1


Let's start with the 2D case. Consider an $A \times B$ rectangle with a line through $(0, A)$ and $(B, 0)$. The line contains all points $(x,y)$ satisfying $Ax+By = AB$. We will say that points $(x,y)$ such that $Ax + By < AB$ are below the line. Notice that there is a one-to-one correspondence between squares intersected by the line, and lattice points on the boundary of the rectangle below the line!

2D example

This approach generalizes to $n$ dimensions. For the $A \times B \times C$ cuboid, the answer is:



You must log in to answer this question.

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