Let

k = unit price

Total cost:

$C = [ \, \frac{1}{4}\pi D^2 + \pi D(H - \frac{1}{2}D) + \frac{1}{2}\pi D^2 \, ] \, k$

$C = [ \, \frac{1}{4}\pi D^2 + \pi DH \, ] \, k$

$\dfrac{dC}{dD} = \left[ \, \frac{1}{2}\pi D + \pi \left( D \dfrac{dH}{dD} + H \right) \, \right] \, k = 0$

$D + 2D \dfrac{dH}{dD} + 2H = 0$

$\dfrac{dH}{dD} = -\dfrac{2H + D}{2D}$

Volume of silo = volume of cylinder + volume of hemisphere:

$V = \frac{1}{4}\pi D^2(H - \frac{1}{2}D) + \frac{1}{12}\pi D^3$

$V = \frac{1}{4}\pi D^2 H - \frac{1}{24}\pi D^3$

$\dfrac{dV}{dD} = \frac{1}{4}\pi \left( D^2 \dfrac{dH}{dD} + 2DH \right) - \frac{1}{8}\pi D^2 = 0$

$2D \dfrac{dH}{dD} + 4H - D = 0$

$\dfrac{dH}{dD} = -\dfrac{D - 4H}{2D}$

$\dfrac{dH}{dD} = \dfrac{dH}{dD}$

$-\dfrac{2H + D}{2D} = -\dfrac{D - 4H}{2D}$

$-2H - D = D - 4H$

$H = D$

Total height = diameter *answer*