According to the picture,
Thus, the cost equation is
To get this in terms of one variable, note by the Pythagorean theorem, we have
Hence, we have
Differentiating yields
Setting the derivative to 0 yields
Notice that the negative answer is inadmissable since it corresponds to a side length (and x should be positive to minimize cost). Now, the endpoints are x = 0 and x = 8. Then,
and so the minimum occurs at