The rule being applied
USGS says each whole-number increase in magnitude is a tenfold increase in the amplitude measured on a seismogram, and about 32 times more energy release. Ten to the power 1.5 is approximately 31.6, which is the figure that gets rounded to “about 32.” Amplitude ratio is 10 raised to (second minus first). Energy ratio is 10 raised to 1.5 times that difference. Negative differences mean the second earthquake is smaller.
USGS also publishes an estimate of radiated energy, log E = 5.24 + 1.44 Mw. This tool does not convert that into joules, because the page we cite is being used here for the factor-of-32 teaching rule, not for a unit conversion. Moment magnitude itself is Mw = 2/3 (log10 of seismic moment minus 9.1), from the same USGS page.
Read magnitude versus intensity for why a bigger magnitude is not automatically harder shaking at your house, and depth for the Northridge and Nisqually comparison.