## Comparative advantage
Say Alice and Bob both like, and can make, both gizmos and widgets.
Alice takes 5 hours to make a gizmo and 6 hours to make a widget.
Bob takes 8 hours to make a gizmo and 7 hours to make a widget.
Consider a 100-hour period of their work.
If each person likes gizmos and widgets equally, so that they want a balance:
- Alice will make and have 9 gizmos and 9 widgets
- Bob will make and have 7 gizmos and 6 widgets
Alice is more efficient at both tasks.
Alice is better at making gizmos than widgets.
Bob is better at making widgets than gizmos.
If Alice and Bob trade:
- Alice will make 16 gizmos and 3 widgets
- Bob will make 14 widgets
- Alice trades 7 gizmos for 7 widgets
- Alice will have 9 gizmos and 10 widgets
- Bob will have 7 gizmos and 7 widgets
Then both of them are better off.
This situation arose sith Bob has a "comparative advantage" in making widgets.
## Trading with yourself
None of the maths here exploited the assumption that Alice and Bob are different people.
You get the same situation with a comparative advantage of one person's changing abilities over time.
In that case, there is no actual trade, just an accumulation of value within your own life.
Say you consistently value both exercise and study.
Studying gives 1 unit of knowledge per 10 minutes.
Exercising gives 1 unit of fitness per 5 minutes, when the gym is open, or per 15 minutes, when the gym is closed.
Consider 1 hour of open gym, and 1 hour of closed gym.
If you don't "trade with yourself" (i.e. apply the allocation principle I'm justifying here):
- when the gym is open, you study 4 units of knowledge and exercise 4 units of fitness
- when the gym is closed, you study 3 units of knowledge and exercise 2 units of fitness
- and in total, you get 7 units of knowledge and 6 units of fitness
If you do trade with yourself:
- when the gym is open, you exercise 8 units of fitness and study 2 units of knowledge
- when the gym is closed, you study 6 units of knowledge
- and in total, you get 8 units of knowledge and 8 units of fitness
This is the fancy mathematical justification behind the rule that if a task (done efficiently) depends on a resource, when the resource is available, you should prefer that task over others disproportionately to its value.