Household Numbers: the Mathematics CapstoneHousehold Numbers
0 / 0

Workbench / Household Numbers: the Mathematics Capstone

S7 · B1·07

The Household in Percentages

Stage 7, after chapter 7: each person's share of the month as percentages that add to exactly 100; what happened to prices, item by item and for the whole basket; and a bill with GST added line by line and rounded half up, the way an invoice is built.

6 topics · ~7 min read
Updated Suggest a correction

Stage 7: the household in percentages

The brief

What you'll build. Three reports that turn the household's paise into the percentages people talk in: each person's share of the month's shared costs, the change in prices you pay from last year to this, and a bill with GST added per line at its rate.

Why a real household needs this. "You pay 39 %" is easier to agree to than a list of rupee amounts; "rice is up 14 %, but our basket is down" is what actually matters for the budget; and checking a bill's GST line by line catches mistakes before you pay.

Why now. Chapter 7 gives percent as hundredths of a stated base, percentage change measured from the starting value, adding a percentage by multiplying, and the habit of asking "a percentage of what?". Stage 6's fractions become percentages here.

What you'll have at the end. percent.py; your own shares, price changes and one real bill checked.

Theory to own

  1. A share as a percentage. Asha's share is 10,584.8426,836.00 of the month. Why is multiplying that fraction by 100 the same as asking "how many hundredths"? (Chapter: "Per hundred".)
  2. Percentages that add up. Rounded shares can add to 99.99 % or 100.01 %. Why does the largest remainder rule from stage 6 fix this here too? (Companion, drill D4.)
  3. The base of a change. Why is a rise from ₹60 to ₹66 a 10 % rise, while the fall from ₹66 back to ₹60 would be about 9.09 %? (Chapter: "Percentage change".)
  4. The basket isn't the average. Why can every item but one get dearer while the basket gets cheaper? (Chapter 6: combining amounts, not rates; companion, "What the chapter oversimplifies", point 3.)
  5. Adding GST. Why is the price with 18 % GST the price × 1.18, and the GST inside a GST-inclusive total 18118 of it? (Chapter: "A pay rise, a discount and GST"; companion, drill D3.)

Build it

Step 1: by hand. From stage 6, take each person's total and write it as a percentage of the month to two places. Pick four things you buy regularly and find last year's price (an old bill, a receipt, a bank statement): work out each change. Take one recent bill with GST and check one line.

Step 2: the code. Amounts in paise, percentages in hundredths of a percent, rounding half up and stated:

Python
"""Stage 7: the household's numbers as percentages: shares, price changes and GST on a bill."""
def rupees(p):
    return f"₹{p // 100:,}.{p % 100:02d}"

def half_up(n, d):
    return (2 * n + d) // (2 * d)

def shares_as_percent(parts):
    """Each part as a percentage to 2 places, by largest remainder so they add to exactly 100.00."""
    total = sum(parts.values())
    exact = {k: (v * 10_000, total) for k, v in parts.items()}          # hundredths of a percent
    out = {k: n // d for k, (n, d) in exact.items()}
    for k in sorted(exact, key=lambda k: (-(exact[k][0] % exact[k][1]), k))[:10_000 - sum(out.values())]:
        out[k] += 1
    return {k: f"{v // 100}.{v % 100:02d}%" for k, v in out.items()}

# 1. Who pays what share of the month (stage 6's totals, in paise).
paid = {"Asha": 10_584_84, "Bilal": 8_125_58, "Chitra": 8_125_58}
print("shares of the month:", shares_as_percent(paid))

# 2. What happened to prices: last year and this year, in paise.
prices = {"rice 5 kg": (3_45_00, 3_95_00), "milk 1 l": (60_00, 66_00),
          "cooking gas": (1_105_00, 905_00), "internet": (999_00, 999_00)}
for item, (old, new) in prices.items():
    change = half_up((new - old) * 10_000, old) if new >= old else -half_up((old - new) * 10_000, old)
    sign = "+" if change > 0 else "-" if change < 0 else " "
    print(f"{item:<12} {rupees(old):>9} -> {rupees(new):>9}  {sign}{abs(change) // 100}.{abs(change) % 100:02d}%")
basket_old = sum(o for o, _ in prices.values())
basket_new = sum(n for _, n in prices.values())
print(f"whole basket: {rupees(basket_old)} -> {rupees(basket_new)},",
      f"{(basket_new - basket_old) * 100 / basket_old:+.2f}% (not the average of the item changes)")

# 3. A bill with GST added per line, rounded half up, then the total.
bill = [("ceiling fan", 2_499_00, 18), ("LED bulbs x4", 396_00, 12), ("wiring work", 1_200_00, 18)]
subtotal = tax = 0
for item, price, rate in bill:
    gst = half_up(price * rate, 100)
    subtotal += price
    tax += gst
    print(f"{item:<13} {rupees(price):>10}  GST {rate}% {rupees(gst):>9}")
print(f"subtotal {rupees(subtotal)} + GST {rupees(tax)} = {rupees(subtotal + tax)}")
print("GST as a share of the bill:", shares_as_percent({"price": subtotal, "GST": tax}))
Text
shares of the month: {'Asha': '39.44%', 'Bilal': '30.28%', 'Chitra': '30.28%'}
rice 5 kg      ₹345.00 ->   ₹395.00  +14.49%
milk 1 l        ₹60.00 ->    ₹66.00  +10.00%
cooking gas  ₹1,105.00 ->   ₹905.00  -18.10%
internet       ₹999.00 ->   ₹999.00   0.00%
whole basket: ₹2,509.00 -> ₹2,365.00, -5.74% (not the average of the item changes)
ceiling fan    ₹2,499.00  GST 18%   ₹449.82
LED bulbs x4     ₹396.00  GST 12%    ₹47.52
wiring work    ₹1,200.00  GST 18%   ₹216.00
subtotal ₹4,095.00 + GST ₹713.34 = ₹4,808.34
GST as a share of the bill: {'price': '85.16%', 'GST': '14.84%'}

Step 3: read the output. The month's shares are 39.44 %, 30.28 % and 30.28 %, adding to exactly 100.00 % because the leftover hundredth is allocated, not left to chance. Rice is up 14.49 % and milk 10 %, but cooking gas is down 18.10 %, and because gas is the biggest amount in the basket, the basket as a whole is 5.74 % cheaper: the average of the four item changes (+1.6 %) would have said the opposite. On the bill, each line's GST is its price times its rate, rounded half up to the paisa; ₹713.34 of GST is 14.84 % of the ₹4,808.34 total, which is why "GST is 18 % of my bill" is wrong even when most items are at 18 %. (The rates here are examples; real GST rates depend on the item and change from time to time, so check them on the bill and the official rate list.)

Step 4: your numbers. Run it with your own shares, prices and a real bill. Add one check: for a GST-inclusive price on a receipt, work backwards to the pre-GST price (divide by 1+rate) and confirm the receipt's GST line to the paisa.

Senior and architect lens

  • Store amounts, derive percentages. Percentages are views; store paise and compute percentages when showing them, so they can never disagree with the amounts.
  • Name the base in every label. "Share of the month", "change since last year", "GST as a share of the total": a percentage without its base invites the misreadings chapter 7 lists.
  • Weighted, not averaged. A basket's change is computed from the summed amounts, never the mean of item changes; the same rule applies to conversion rates, returns and any rate combined across groups.

Evidence

  • percent.py with your own data, and its output.
  • One real bill with its GST checked by hand, line by line.
  • One sentence on whether your basket got dearer or cheaper, and which item decided it.

Carry forward

Stage 8, after chapter 8, compares rates and ratios properly: price per unit across sizes and brands, fuel cost per kilometre for two ways of commuting, and a recipe or a monthly budget scaled up and down in proportion.