TITLE: The number of bottles of beer one can buy with $10, after exchanging bottles and caps
QUESTION [8 upvotes]: My answer to this question is 15, but my dad insists I am wrong. Who is right?

$2 can buy 1 bottle of beer.
  4 bottle caps can be exchanged for 1 bottle beer.
  2 empty bottles can be exchanged for 1 bottle of beer.

How many bottles of beer can you buy with $10?
I feel like some of the answers I've gotten so far... don't really make sense or really follow what I am trying to ask.
So I think I will clarify what I am trying to ask for.
YOU CAN (have to) TRADE / EXCHANGE bottle caps and empty bottles to get new bottles.
So how many can you buy with $10?
The answer he got is 20, which is correct. I just don't understand why.

REPLY [3 votes]: Similar as in other answers, a state is described by a tuple $(z,m,b,e,c)$ where $z=$ number of bottles drunk, $m=$ available money in dollars, $b=$ full bottles in inventory, $e=$ empty bottles i inventory, $c=$ caps in inventory. The followig steps can be applied, each adding a specific tuple to the current tuple:

Buy a bottle: $(0,-2,+1,0,0)$
Drink a bottle: $(+1,0,-1,+1,+1)$
Trade two empty bottles: $(0,0,+1,-2,0)$
Trade four caps: $(0,0,+1,0,-4)$

We start with the tuple $(0,10,0,0,0)$ and are allowed to apply the above steps in any order, provided that no component ever becomes negative, and our goal is to maximze the $z$ component. 
Among all step sequences that lead to the maximal possible $z$, consider one that minimizes the sum of the index positions in the sequence where we execute a "drink" step.
Then before each drink step we have $b=1$: Certainly $b\ge 1$ as otherwise we cannot drink. On the other hand, if for some dringk steps $b\ge 2$, consider the first drink step applied to a state with $b\ge2$. Then the preceding step (which must exist because initially $b=0$) must be a buy or trade step, and it is possible to swap the order of these two steps without changing the final result, contradicting the minimality of drink-index sum.
On the other hand, we certainly have $b=0$ after the last step as otherwise we could have yet another drink, contradicting optimality of the sequence.
Since the only possible way to reach $b\le 1$ from $b\ge2$ would be drinking and drinking occurs only at $b=1$, we conclude that $b\ge 2$ never holds. Therefore, the four possible steps occur only in the following combinations:

Buy and drink: $(1,-2,0,1,1)$
Trade bottles and drink: $(1,0,0,-1,1)$ 
Trade caps and drink: $(1,0,0,1,-3)$

By repeating the argument with a sequence that minimizes the sum of indices where we "buy and drink" among all double step sequences leading to optimal $z$, we see that "buy and drink" can always be swapped before any preceeding "trade  bottles/caps and drink" (simply because the only thing it decreases, $m$, is not changed by the other double steps). 
Thus we may assume that we start with a few  (by optimality: five) "buy and drink" double steps and after that only "trade and drink". So essentially, we start with $(5,0,0,5,5)$ and can apply only $(1,0,0,-1,1)$ (provided $e\ge2$) or $(1,0,0,1,-3)$ (provided $c\ge 4$) from then on.
By induction, we conclude that $e\equiv c\pmod 2$ throughout, because neither of the two trading double steps changes this fact.
Likewise by induction, $z+2e+c=20$ and $e\ge1$ and $c\ge 1$.
Using $e\ge1, c\ge1$ the next thing we show by induction is $e+c\ge 3$: It holds initlyy when $c=e=5$ and it holds after each trade doublke step because one of te numbers is increased from being $\ge1$ before the double step and the other is $\ge1$ anyway.
After the final step we have $e=1$ by optimality because $e\ge2$ would allow us to get yet another drink. Similary, $1\le c\le 3$ after the final step. 
As $e\equiv c\pmod 2$ and $e+c\ge 2$, we conclude $c=3$.
Therefore in the end $$z=18-e-c=15.$$