"40% of the cubes were yellow."
yellow % (at first) → 40%
blue % (at first) → 100 - 40 = 60%
"A box contained some yellow cubes and 72 blue cubes."
blue (at first) → 72
60% (at first) → 72
40% (yellow, at first) → 72 ÷ 60 x 40 = 48
"After some red cubes were added into the box, 32% of the cubes were yellow. "
we need to know what is the percentage of red cubes in the end, to get the number of red cubes
48 cubes (in the end, yellow) → 32%
72 cubes (in the end, blue) → 32 ÷ 48 x 72 = 48%
% red cubes (in the end) → 100 - 48 - 32 = 20%
32% (in the end, yellow) → 48
20% (in the end, red) → 48 ÷ 32 x 20 = 30