Consider a cuboid with dimensions
divided into unit cubes as shown below,

Now, draw a diagonal of the cuboid and find the number of unit cubes through which the diagonal reaches its other end. Are you getting 4? You can consider the number of points of intersections of planes with the diagonal that are parallel to the faces and separated by
. Note that each intersection leads you to a new unit cube and thereby we can find the number of unit cubes crossed by the diagonal. Number of planes = Number of horizontal planes along
+ Number of vertical planes along
+ Number of vertical planes along other
. So, number of intersections = 3+2+2-(1+2)=4. We have subtracted
to account for overcounting because the diagonal and the planes are concurrent at two points (two planes at the center point and three planes at the corner end of cuboid).
We can now generalize this result for a cuboid with arbitrary integer dimensions, i.e., say the dimensions are
, where
are positive integers. Try to find the answer in terms of
and read this post further.......

The answer would be
. We will here a discuss a short proof of this answer using almost the same logic as before by finding the number of points of intersections of diagonal with parallel planes to the faces.
counts the number of planes intersected by the diagonal and
counts the number of intersections of diagonal that has the 2 planes parallel to
and
passing through them and
counts the the number of intersections of diagonal that has 3 planes parallel to all three non-parallel faces of cuboid passing through them.
So,
counts the number of intersections of diagonal with 2 planes passing through them but again here, the number of intersections with 3 planes through them are counted thrice, so we subtract
to get the above expression. Hence, we have accounted for the overcounting due to concurrency at the intersections.
Now, you can try to give a rigid proof of this idea in the comments for further discussions. Join us at SuMON Slow Math Program to solve more exciting problems like this every fortnight, which require only logical thinking rather than conceptual prerequisites making math fun! These kind of problems are not available in wide range of math text books. We also provide detailed solution to each problem for every fortnight.