A Game of Change

Eight people line up in a queue to buy a ticket. Four of these people hold a $ 5 \$5 note and the other four hold a $ 10 \$10 note each. The price of a ticket is $ 5 \$5 . The clerk starts up with no cash in hand, but she manages to always give the correct change (that is, whenever a person that has a $ 10 \$10 note comes in, the clerk always has a $ 5 \$5 note in hand). Find the number of ways the people can line up for this to happen.


The answer is 8064.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

What is required is that at no time have more $10 note holders approached the clerk than $5 note holders. So form an x y xy -grid with the number of $5 note holders who have approached the clerk represented on the x x -axis and the number of $10 note holders who have approached the clerk represented on the y y -axis. Then the allowable "paths" from ( 0 , 0 ) (0,0) to ( 4 , 4 ) (4,4) , (where each move involves going either to the right or up one unit), are those that never go above the line y = x y = x .

Now since we just have a 4 4 by 4 4 grid this is straightforward enough to count manually, with the number of allowable paths being 14 14 . In general, for an n n by n n grid the number of such paths is the Catalan number , C n C_{n} .

Now for each of these 14 14 allowable paths we can arrange the $5 note holders in 4 ! = 24 4! = 24 ways and the $10 note holders in 4 ! = 24 4! = 24 ways.

Thus α = 14 24 24 = 8064 \alpha = 14*24*24 = \boxed{8064} .

In Response To Brain Charlesworth: \textbf{In Response To Brain Charlesworth:} Excellent Solution..

Vraj Mehta - 6 years, 5 months ago

Log in to reply

Thanks. Excellent problem. :)

Brian Charlesworth - 6 years, 5 months ago
Daniel Liu
Jun 25, 2015

Since Brian Charlesworth solved the question indirectly by establishing a 1-to-1 correspondence to a known problem, I will provide a direct solution to the problem.

Let a 5 5 dollar person be F F and a 10 10 dollar person be T T . Then we need to find all the orderings of F , F , F , F , T , T , T , T F,F,F,F,T,T,T,T given that there is always more or an equal number of F F 's than T T 's as we go along the line from left to right.

Consider the first person; this person must be an F F . Then, consider the first T T such that after this person has paid, the number of people who paid who are F F 's is the same as the number of people who paid who are T T 's: F [ A ] T [ B ] F [A ]T[B]

Now in the spaces [ A ] [A] and [ B ] [B] , we have smaller versions of the same problem, so let's use recursion. Define f ( n ) f(n) to be the number of ways to order n n F F 's and n n T T 's. Then, we see that f ( n + 1 ) = f ( 0 ) f ( n ) + f ( 1 ) f ( n 1 ) + + f ( n ) f ( 0 ) f(n+1)=f(0)f(n)+f(1)f(n-1)+\cdots +f(n)f(0) = k = 0 n f ( k ) f ( n k ) =\sum_{k=0}^{n}f(k)f(n-k)

Obviously f ( 0 ) = f ( 1 ) = 1 f(0)=f(1)=1 . Using the recursion, we find that f ( 2 ) = 2 , f ( 3 ) = 5 , f(2)=2, f(3)=5, and finally, f ( 4 ) = 14 f(4)=\boxed{14}

@Daniel Liu What inspired you to make this sequence?

I find the generalization of the formula awkward: The second term becomes f ( k ) f ( n k ) = f ( 1 ) f ( n 1 ) f(k)f(n-k) = f(1)f(n-1) which does not quite fit the sequence?

Sualeh Asif - 5 years, 11 months ago

Log in to reply

Ah sorry, I typoed. There shouldn't be any conflict now.

As for making this sequence, I suppose it is a lot more motivated to imagine the F F 's as a left bracket [ [ and the T T 's as a right bracket ] ] .

We know that for every right bracket, there must be a left bracket that pairs with it, which basically corresponds to the restriction of this problem.

Now I want to find a recursive solution, so I want to find smaller instances of this problem in it. The first element clearly has to be a left bracket, so I draw that in first.

Then, following along with my motivation to find smaller versions of the problem, I realize that after this first bracket, there is a smaller version of the problem, ended at the corresponding right bracket that pairs with the first left bracket. Then I notice that after that right bracket, there is yet another smaller version of the problem.

Thus, I do casework on there the right bracket that corresponds to the left bracket is, and the recursion pops up.

Daniel Liu - 5 years, 11 months ago

Log in to reply

Another Typo I guess, Look at the last term shouldn't it be f ( k ) f ( n k ) = f ( n ) f ( 0 ) f(k)f(n-k) = f(n)f(0) . And here is the Wikipedia link on it: Catalan Numbers I think ithas some good information on it and related problems.

Can you post a photo of the casework?

Sualeh Asif - 5 years, 11 months ago

Log in to reply

@Sualeh Asif Okay sorry, fixed.

I did the casework in my head. It's just moving the T T : starting next to the first F F , and moving two spaces right each case.

And you're right, this recursive sequence exactly describes the Catalan Numbers.

Daniel Liu - 5 years, 11 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...