The volume of a rectangular prism can be obtained using the formula

the volume for the first box is

the volume for the second box is

if both volumes are equal then both expressions can be equaled

since both boxes have the same height, then h is equal on both sides and can be cancelled out.

solve the expression for w

the width of the second box should be 4 feet in order for them to have the same volume.