I came across this problem a few weeks back. Couldn't solve it.
There are 100 people waiting in a queue waiting to enter a movie theater. The theater has exactly 100 seats numbered 1 to 100. The first person in the queue enters and chooses any seat he likes and sits there. The n-th person in the queue, where n can be 2,3,...100, enters the theater after the (n-1)-th person is seated. He sits in seat no. n if he finds it vacant; otherwise he takes up any unoccupied seat. Find the total number of ways in which 100 seats can be filled up provided the 100-th person occupies seat no. 100.
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Good problem! I've been thinking about it on and off and here's what I've come up with so far.
Let's start from the beginning. If person 1 sits in seat 1, he displaces no one, so everyone else sits in their respective seats (person 2 in seat 2, person 3 in seat 3, etc.). If person 1 sits in, say, seat 50, then he displaces person 50. Persons 2 through 49 sit in their respective seats, but person 50 must choose where to sit. If person 50 sits in seat 1, he displaces no one else, so persons 51 through 100 sit in their respective seats. If person 50 does not sit in seat 1, but instead, say, seat 75, he displaces person 75. Persons 51 through 74 sit in their respective seats. Person 75 must then choose whether to sit in seat 1, thus displacing no one, or one of the other seats, which displaces someone else. Of course, seat 100 is always reserved for person 100 by the problem description.
So, we see a basic pattern emerging here. For each person pi, that person can do one of three things:
Special cases are p1, who needn't do #1, and p100, who always sits in s100.
The interesting bit of the problem what I've been calling "displacement" events. When, say, p10 displaces p50, players p11 through p49 are unaffected, and sit in their respective seats. In other words, the unaffected people don't represent any choices being made. In general, only p1 and any displaced players represent choices.
Anyway, this all suggests the following counting formula:
f(p)=1+i=p+1∑99f(i)
f(p) could be thought of as the number of ways to fill the remaining seats assuming that player p has been displaced. The 1 is the case where s1 is chosen--this gives 1 way to fill the seats, since no one else is displaced when s1 is chosen. The summation represents the possibilities of displacing each person after person p. (Of course, p1 cannot be displaced, but f(1) still handles p1 correctly, since p1 can either choose s1, displacing no one, or s2 through s99, displacing someone.)
f(1) should give the solution to the problem. Embarrassingly, I don't know how to compute the closed form of such a thing. Experimental results (yeah, yeah) suggest that f(1)=2100−2=298, which is the answer we seek. Maybe someone else can show how to get the closed form?
Log in to reply
Let g(n) be the number of ways of sitting n people in the cinema with n seats, with visitor n sitting in seat n. Certainly g(1)=g(2)=1 and g(3)=2.
Suppose that n≥4. Suppose that the first visitor sits in seat j.
If j=1, then every visitor sits in their own numbered seat.
If 2≤j≤n−1, then visitor k sits in seat k for 2≤k≤j−1. What happens to visitors j to n is basically the original problem, but for a cinema of size n+1−j, as you noticed.
Thus g(n)=1+j=2∑n−1g(n+1−j)=j=2∑ng(n+1−j)=j=1∑n−1g(j)(⋆) and we note that this identity is in fact true for all n≥2.
Consider the generating function G(x)=n=1∑∞g(n)xn (as we shall see below, this power series has radius of convergence 21, so all these calculations will be eventually seen to be valid). Now (1−x)−1G(x)x(1−x)−1G(x)1−x1−2xG(x)G(x)======(∑m=0∞xm)(∑n=1∞g(n)xn)=∑N=1∞(∑n=1Ng(n))xN∑N=1∞g(N+1)xN∑N=1∞g(N+1)xN+1=∑N=2∞g(N)xN=G(x)−x[1−(1−x)−1]G(x)=x1−2xx(1−x)=(x−x2)∑n=0∞2nxnx+∑n=2∞2n−2xn so that g(n)=2n−2 for all n≥2.
Of course, if we had guessed the answer that g(n)=2n−2 for all n≥2, then the result could have been proved by induction using (⋆). The use of generating functions enabled us to get the answer without knowing it first!
much like solving binary problems...
9.33e155