

The Lagrangian is

with partial derivatives (all set equal to 0)

for
, and

Substituting each
into the second sum gives

Then we get two critical points,

or

At these points we get a value of
, i.e. a maximum value of
and a minimum value of
.
A cube has sides that are all equal lengths .
Volume of a cube is S^3, where S is the length of the side.
Volume = 3^3 = 3 x 3 x 3 = 27 cubic inches.