[Math] Maximizing the volume of a rectangular prism

contest-mathgeometryoptimization

A rectangular prism has a surface area of $300$ square inches. What whole number dimensions give the prism the greatest volume?

This is a math olympiad problem. It involves the volume and surface area of a prism.

Please, find a good solution.

Thank You!

Best Answer

If we are assuming a fully rectangular prism---right angles all around---then there actually are only two candidates: $(h,w,l)=(20,5,2)$ and $(h,w,l)=(12,9,2)$. The former has a volume of 200, the latter has a volume of 216. So $(12,9,2)$ it is.

I solved this by exhaustive search. Here's my very dumb MATLAB code. Certainly it's not the most efficient but sometimes life calls for quick and dirty solutions. At least I limit the loops to 75, since the largest single dimension to achieve a surface area of 300 has to be less than that: $(75,1,1)$ gives us a surface area of 302:

for h = 1 : 75,
    for w = 1 : h,
        for l = 1 : w,
            if 2*(h*w+h*l+w*l) == 300,
                [h,w,l,h*w*l]
            end
        end
    end
end

So how would you do this without code? Well, I'd probably begin an exhaustive search, frankly, but with some efficiency. Let's rewrite the surface area formula as follows: $$2(hw+hl+wl)=300 \quad\Longrightarrow\quad hw+l(w+h)=150 \quad\Longrightarrow\quad (h+l)(w+l)=150+l^2$$ So for a fixed value of $l$, $150+l^2$ must admit an integral factorization $pq$ with $p,q>l$.

  • Consider $l=1$: we have $pq=151$. Since 151 is prime, so there are no solutions. Continuing:
  • $l=2$, $pq=154$, prime factors 2, 7, and 11. Since $p,q>2$, our choices are $(p,q)\in\{(22,7),(14,11)\}$ or $(h,w,l)\in\{(20,5,2),(12,9,2)\}$. These are the two answers we found above.
  • $l=3$: $pq=159$, prime factors 3 and 53; since $p,q>3$, there are no solutions.
  • $l=4$: $pq=166$, prime factors 2 and 83; no solutions with $p,q>4$.
  • $l=5$: $pq=175$, factors 5, 5, and 7. The only solution with $p,q>5$ is $(p,q)=(25,7)$, which gives us $(h,w,l)=(20,2,5)$, a permutation of our previous solution (and not even the optimal one, at that!).
  • $l=6$: $pq=186$, factors 2, 3, 31; no solutions with $p,q>6$.
  • $l=7$: $pq=199$, prime, no solutions.

I could continue, but since this is a contest problem I probably would have taken a chance on $(12,9,2)$ pretty much as soon as I acquired it. Even if I had time I doubt I would have bothered to proceed past $l=4$ or $l=5$.