Can be done using a simple formula for percentage :
Decrease in consumption = [% Price increase/(100 + % Price Increase)]×100
So , If price of onion rises by 25% =>
Decrease in consumption = [25/(100+25)] × 100
= [25/125]×100 = 20
Hence , consumption of onion should be decreased by 20 % so that there is no change in the expenditure.