Explanation:
AB = DC = 40 - 2x
AD = BC = 30 - 2x
there is not more explanation possible, I think.
we cut off from each side 2 pieces of x cm. so, AB, DC, AD, BC are the the remaining lengths.
the volume of the box is ground area times height (x is the length of the remaining flaps after the cut, so, when folding up these flaps/sides, they will be x cm high).
Volume = y = AB×AD×x
=> y = (40-2x)×(30-2x)×x = (1200 - 60x - 80x + 4x²)×x =
= (1200 - 140x + 4x²)×x = 4x³ - 140x² + 1200x