Calculating dimensions of a Pyramid to fit inside of a Cuboid I am trying to fit a pyramid inside of a cuboid, but maximize the dimensions of the pyramid while still remaining inside of the cuboid.
Given the dimensions of the cuboid (length, width, height), how could I calculate the dimensions of the pyramid in order to maximize it's volume inside of the cuboid?
I am looking to have the pyramid originate in the position shown in the photos below.  I think the angle of rotation of the pyramid is important too.  But I am not really sure how to perform the math for these calculations.


 A: There are two possible candidates for the largest right pyramid, with rectangular base, inscribed in a cuboid. The most obvious is the "upright" one, having as base a face of the cuboid and as vertex the center of the opposite face. The volume of this pyramid is ${1\over3}abc$, where $a$, $b$ and $c$ are the cuboid dimensions.
The other possible candidate is the "slanted" one, which reaches its greatest volume when its vertex $V$ is the midpoint of an edge (see diagram below: of course you need $FB\ge BC$). But it turns out that the volume of such a pyramid is, once again, ${1\over3}abc$.

The reason for that can also be seen in the plane: blue and red isosceles triangles in figure below have the same area, for any rectangle. Indeed, if blue triangle has base $a$ and altitude $b$, then red triangle has base $b$ (right side of the rectangle) and altitude $a$.

And inscribed isosceles triangles not having a side in common with the rectangle have lower area, as can be seen in the two examples above: if we divide each triangle into two smaller triangles with the dashed line, taken as common base, then the sum of the altitudes is $\le a$ and the base is $\le b$.
A: Lets take a cube.
Now on visualizing, it becomes clear that the enclosed pyramid would have its one side along diagonal of the cube's face, which means one of the other two vertices would be on the opposite side facing downwards and remaining would be hanging or not touching any side/plane.
Which means if the cube has side of unit length then the pyramid/tetrahedron will be having that of SQRT2
And so the last or hanging vertex will be along the opposite diagonal of the cube's face mentioned above but at a distance of (SQRT3 /2) COS(PI -ATAN(SQRT2) -ACOS(1÷3) or 1/2 ​from the center and at a depth of
(SQRT3 /2) SIN(ATAN(SQRT2) + ACOS(1÷3)) or 1/SQRT2 from the face of the cube.
So the converse calculations show that for a pyramid/tetrahedron of side SQRT2, the smallest cuboid  or cube will be
of dimensions 1 *1 *1/SQRT2
