Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, let's say you have 5 friends, and went on a trip together and over different occasions, different people paid for different things, with a plan of combining all the bills together at the end and splitting them evenly across all.

What is the best way of achieving this mathematically?

share|cite|improve this question
Can you explain why "Add up the total and divide by 5" isn't satisfactory? – Peter Taylor Sep 12 '11 at 12:13
hm. I guess what I want is to find out who needs to pay how much to whom, since each person would have paid different amount for different bills - some more, some less. Does that make sense? – ebae Sep 12 '11 at 12:22
@Peter: That wouldn't be satisfactory because there are $6$ people. – TMM Sep 12 '11 at 14:25
@Thijs, that's a good point. Oops. – Peter Taylor Sep 12 '11 at 14:55
up vote 7 down vote accepted

If you add up the total and divide among the number of people you get the amount each person should have paid. If you add up the bills each person has paid and subtract from the amount they should have paid you have the amount each person owes. These amounts should total to 0.

In terms of optimising, I understand that you want to split this up into person-to-person debts rather than person-to-group and group-to-person debts in such a way as to minimise the number of person-to-person debts. This looks rather like a bin-packing problem, so it is probably NP-complete to optimise.

(From a social point of view, the best solution is probably to have one trusted person collect from those who owe to the group and pay to those who are owed).

share|cite|improve this answer

If you are interested in broader questions about mathematical insights into fairness questions that arise in fair division, cost allocation, apportionment, etc. take a look at this book for a good introduction: Equity in Theory and Practice, H. Peyton Young, Princeton U. Press, 1994.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.