so hmm if you check the picture below, the area of the base is x*x and the top's is x*x and the sides, are 4 rectangles, each with area of h*x
thus


now, the cost function, or C(x), well, we know how much area is going to be used in x-term, so let's just apply the cost to each

so.... now just get the derivative of C(x) and zero it out out and check the critcal points for any minima