Visit our sponsor Five Planet Juices  
Home
Microsoft Interview Process
Microsoft HR Questions
Technical Questions
Puzzles/Riddles
Resume Tips and Template
Discuss
Question to Interviewer
Interview Tips
Term Of Use
Site Feedback


Crazy Guy On The Airplane

A line of 100 airline passengers is waiting to board a plane. they each hold a ticket to one of the 100 seats on that flight. (for convenience, let's say that the nth passenger in line has a ticket for the seat number n.)

Unfortunately, the first person in line is crazy, and will ignore the seat number on their ticket, picking a random seat to occupy. all of the other passengers are quite normal, and will go to their proper seat unless it is already occupied. if it is occupied, they will then find a free seat to sit in, at random.
What is the probability that the last (100th) person to board the plane will sit in their proper seat (#100)?

 

I haven't written up a solution for this yet, but smarter people than me can put the solution in comment section


Comments:

Solution
By psyang on Tuesday, August 29, 2006 (UMST)

Took me about 10 minutes to work this out. Cool puzzle.

 

Let P(i) = probability that the ith person after the crazy guy loses their seat. What we want to know is P(99). 

P(1) = 1/100 (the crazy guy picks seat 1). Notice that it is not 1/99 - the crazy guy could pick his own seat since he selects purely by random. 

P(2) = 1/100 (crazy guy picks his seat) + P(1)*1/99 (crazy guy picks the first guy's seat, and the first guy picks the second guy's seat).

Following this sequence, we get the following recursive relationship: 

P(n) = P(n-1)(1/(101-n))

If we start to work this relationship out, we get a surprising answer:

P(1) = 1/100

P(2) = 1/99

P(3) = 1/98

and, more generally,

P(n) = 1/(101-n) ( for n<100)

Thus, P(99) = 1/(101-99) = 1/2

 

-Peter

Reply to this Comment

100 pepole on an airplane
By mnause on Saturday, October 07, 2006 (UMST)
This is not a riddle or a question of probability. It is a simple question of common sense. If you're trying to be logical you must consider all factors, like the , "Hey nutso, get your ass outa my seat. Your ticket says seat 18, go find it," factor. What I mean is that you have to assume that the crazy guy has seat one or he wouldn't be first in line. He's crazy, not stupid, neither are the fellow passengers, who would line up correctly and go find their seats. But for argument's sake, let's just say he randomly jumps in the front of the line holding the ticket for seat number 22 and sits in seat 57. All the other passengers, instead of following their seat numbers begin sitting down at the first seat and follow on in order. The first 21 would be in the right seats. The next 36 (including the crazy guy) would not. At seat 58, order would be restored and the last 43 people would be in their correct seats. So, the only way the last guy's seat gets screwed up is if 'Nutso' randomly jumped in it to begin with. 1 in 100 chancwes right. So the probability is that he/she will end up in the correct seat is 99%.

Reply to this Comment

Whaaaattt?!?!?!
By mnause on Saturday, October 07, 2006 (UMST)
Hello Peter, wake up you're dreaming. You have taken to complicated an approach to this. Ten minutes? Are you the crazy guy in the riddle? Five seconds at best.

Reply to this Comment

Sorry Mnause
By Celton on Thursday, December 07, 2006 (UMST)
The puzzle specifically states that the other passengers randomly choose a seat if their seat is taken, they don't "follow on in order", as you put it.  Peter's solution is correct.

Reply to this Comment

100 pepole on an airplane
By matyagi on Monday, January 08, 2007 (UMST)

I think, in such problems we should start from end. Let the 100th passenger sit on 100th seat no.. Now we can make 99 other passangers sit in 99! ways. Therefore the probabilty of 100th passenger sitting on correct seat no. is 99!/100! which comes out to be 0.001

 

Thoughts?

--Manoj

Reply to this Comment

Nice Problem.
By rob on Tuesday, February 13, 2007 (UMST)
One, potentially, nice way of thinking about the problem is like this. There are four possible things that can happen when a person goes to sit. (1) They sit in their expected seat (it is vacant). (2) They sit in the last person's spot. (3) They sit in some unseated person's spot, and this spot is NOT the last person's spot. (4) They sit in the crazy person's appropriate spot. (Seat 1.) If condition 1 or 3 happens, the chance of the last person sitting in their spot remains unchanged! The "end game" conditions, are thus 2 and 4. In case 4 every remaining person can now sit in their assigned seat. Because there is a closed loop of people sitting in the wrong seats. So by permuting that group everyone can now be sitting correctly. In case 2, there will only be one seat left for the last person... seat one. (The last person will then complete the loop of people in the wrong seat.) Fortunately, the probability of case 4 happening is exactly the same as the probability of case 2 happening. Namely 1/(#_of_available_seats). Therefore: Chance of last person sitting in correct seat = chance of them sitting on only remianing seat (seat number 1) = 1/2. :) ----- P.S. I did a preview and like breaks weren't displaying! I tried inserting them with HTML code, but the preview just showed the HTML tags. So I hope this is formatted nicely, if not, my apologies.

Reply to this Comment

Intuitive Answer
By tristanreid on Wednesday, February 21, 2007 (UMST)

The recursive solution (1/2) was correct, but I think you're all making this too complicated. 

 

Consider this:

For any passenger that is choosing randomly (including the initial crazy guy) there are 3 sets of seats: 

 

-1 seat that belongs to crazy guy.  Sitting here will stop the random behaviour, and the 100th passenger WILL get their seat.

 

-1 seat that is the 100th passenger's. Sitting here will also stop the random behaviour, the 100th passenger WILL NOT get the correct seat.

 

-Any other seat will just pass the randomness on to the next passenger, who will be faced with the same probabilities.

 

So there are EQUAL probabilitys of getting the 100th passenger's seat or crazy guys seat.  

 

1/2 is the answer. 

 

-t.

Reply to this Comment

Explanation from Peter (psyang)
By vadimtsarik on Saturday, March 24, 2007 (UMST)

There's something wrong with Peter's (psyang's)  explanation:

 

> P(2) = 1/100 (crazy guy picks his seat) + P(1)*1/99 (crazy guy picks the first guy's seat, and the first guy picks the second guy's seat).

> Following this sequence, we get the following recursive relationship:

> P(n) = P(n-1)(1/(101-n))

 

The formula for P(n), with n=2 gives: P(2) = P(1)(1/(101-2)) = P(1)*1/99; Correct me if I'm wrong, but it's not the same as P(2) = 1/100 + P(1)*1/99.

Am I missing something?

 

- Vadim

Reply to this Comment

1/100
By punterguy on Tuesday, April 24, 2007 (UMST)

I think only mnause is correct.

 

P (The crazy guy pick his own seat accidentally) = 1/100

 

If the crazy guy does not pick his own seat (99/100 chance), he will occupy someone else's seat. If someone else's seat is occupied, the particular person will take another person's seat..so on and on.. And we can deduce that in the end, the 100th person will not sit in his proper seat.

 

Therefore the probability that the 100th person will sit in his proper seat will depend on the crazy guy to pick his own seat = 1/100

Reply to this Comment

My answer
By waterouyang on Wednesday, April 25, 2007 (UMST)

In my opinion, this puzzle should be solve from the end,which means the last passenger.

 

For him,there is only two possibilities:the right seat or not.

 

If he finally sits on the 100th seat.That is to say,the others(99 passengers) acommucate themselves with in the first 99 seats.

 

So: P(100)=(99!)/(100!)=0.01

 

P(100) stands for the possibility that 100th passenger get what he deserves.

 

My approach is exactly the same with  former,which comment is put above.

 

But I think he just makes a mistake at the final answer,maybe a input mistake.:)

 

If someone know the official answer,please let me know.thanks

 

Reply to this Comment

crazy guy
By nadteks on Saturday, May 05, 2007 (UMST)
Peter, your solution is the only one that comes close to solving the problem. However you have not considered all possible cases. E.g. for P(2) what if the crazy guy picks seat #2? My solution is 1/100 + [(1/100 x 1/99) + (1/100 x 1/99 x 1/98) + ... + (1/100 x 1/99 x 1/98 x ... x 1/2)] + [(1/100 x 1/98) + (1/100 x 1/98 x 1/97) + ... + (1/100 x 1/98 x 1/97 x ... x 1/2)] + ... + [(1/100 x 1/3) + (1/100 x 1/3 x 1/2)] + [(1/100 x 1/2)] I don't know if that's correct and I don't have time to type up an explanation for it right now. I will think some more about this problem and come back later.

Reply to this Comment

Crazy Guy On The Airplane
By kuntalam on Thursday, May 24, 2007 (UMST)

Peter is Correct but very complecated.

Answer is 1/2

There are n seats for n passangers. So for every passenger (after the Crazy one) will either get his/her own seat or not. Hence Probability is 1/2 irespective of the passenger number.

Reply to this Comment

Other terms missing
By prasanna on Thursday, June 28, 2007 (UMST)
P(1) = 1/100 (the crazy guy picks seat 1). Notice that it is not 1/99 - the crazy guy could pick his own seat since he selects purely by random. This is fine P(2) = 1/100 (crazy guy picks his seat) + P(1)*1/99 (crazy guy picks the first guy's seat, and the first guy picks the second guy's seat).this is also fine now p(3) = 1/100 + p(1) * 1/99 + p(1)*1/98....is it not where are the other terms in the generalization??? so the general recursive tem should be p(n) = 1/100(1+1/99+1/98+.....+1/101-n) so put n = 99 and get the answer.....

Reply to this Comment

duck duck goose
By wtsaila on Thursday, August 16, 2007 (UMST)
If you are familiar with the childhood game duck duck goose, you can see this is a game of duck duck goose with a slight modification. There's an empty seat that belongs to the crazy passenger and you can be the 100th passenger. The crazy passenger is the "goose" and picks someone at random to become the next goose/crazy passenger. This goes on (we can stipulate without repeating passenger) until the goose either picks you or the empty seat. Restated this way, it is easy to see the odds is 1/2 and it is somewhat easy to see this is the same problem. If you did not play duck duck goose as a kid or watched your kids play it, then my solution is no fun. But just think that whenever the crazy passenger picks a seat other than his seat or the final seat, the rightful owner of the seat becomes the crazy passenger, and again it is 50-50 each time whether the original crazy passenger seat is picked or the final passenger seat.

Reply to this Comment

The answer
By Leon on Monday, September 24, 2007 (UMST)

1/2.

it's simple.

you can try 2 men.

then 3men .

then 4men .

........

and you will finnally see all the answer is 1/2

Reply to this Comment

Simple thinking... (100-1)
By AMusallami on Wednesday, September 26, 2007 (UMST)

I agree that we should start from the end in such (crazy) situations...

 

All what we care about is the probability of the last passenger #100, and taking into consideration that there is only one Crazy, that's = 1/100

 

Then the rest is the probability for the non crazy 99/100 = 99%

 

Suggestions...

 

Ahmad

Reply to this Comment

100 people in the plane
By vvinnakota on Friday, September 28, 2007 (UMST)

I think its 1/100 chances as its just probability which comes out to be 0.01

 

thanks

Reply to this Comment

Hate to be stupid, but.....
By Palasky on Tuesday, November 06, 2007 (UMST)
Being simple minded, he either does or he does not....  1/2 gots to be right!

Reply to this Comment

Another explanation
By Tralcor on Wednesday, November 28, 2007 (UMST)

The answer is 1/2.

I love Palasky's explanation "either he does or doesn't."

While Peter proves it mathematically I hope to demonstrate it a little more visually - I always think that helps.

Let's start simply with 2 people.  There a only 2 possible permutations (2x1) which are;
1 2
2 1
person 2 sits in his seat 1 out of the 2 possible combinations or 1/2.

Now 3 people.  There are a total of 6 permutations (3x2x1) however 2 are not possible in this scenario as each person will sit in their seat if it is available.  Therefore, apart from position 1, you cannot have a higher number in a particular position number.  The impossible combinations I have marked with **
1 2 3
1 3 2 **
2 1 3
3 1 2
2 3 1 **
3 2 1
person 3 sits in his seat 2 out of the 4 possible combinations 2/4 = 1/2.

Now 4 people.  There are a total of 24 permutations (4x3x2x1) and in this case there are 16 combinations that are not possible (marked **)
1 2 3 4
1 2 4 3 **
1 3 2 4 **
1 3 4 2 **
1 4 2 3 **
1 4 3 2 **
2 1 3 4
2 1 4 3 **
3 1 2 4
3 1 4 2 **
4 1 2 3
4 1 3 2
2 3 1 4 **
2 4 1 3 **
3 2 1 4
3 4 1 2 **
4 2 1 3
4 3 1 2 **
2 3 4 1 **
2 4 3 1 **
3 2 4 1 **
3 4 2 1 **
4 2 3 1
4 3 2 1 **

person 4 sits in his seat 4 out of the 8 possible combinations 4/8 = 1/2.

You could go ahead and follow this same process with 100 people but it would take an awful lot of paper, there are 9.332621544394418e+157 combinations, but I hope this proves the point.

Reply to this Comment

Crazy Guy On A Plane
By srmoody on Thursday, November 29, 2007 (UMST)

Time to figure out... about 1 sec.
The reason is as some have already alluded to, it’s not a mathematics problem is a simple logic problem. The other stuff, the number of people, the crazy guy and his random seat jumping, really has little bearing on the outcome. Think of it this way... You are the 100th passenger, you wait your turn, and you walk down the ramp and enter the plane and head for your seat designation. The question comes down to a binary state. The seat is either occupied or it is not, it really doesn’t matter what the transition was to get it to that state, it’s a simple binary solution; yes/no, true/false, 0/1, empty/occupied. So if you look at it like that then of course the answer is 50/50 or 50% your seat will be empty, regardless of how many people are on the plane 2, 10,100, 10000, and regardless of how many times the seat was occupied and then vacated... it all boils down to that one state and a 50% chance it will be open
-Steve

Reply to this Comment

Tristan's answer is elegant and correct
By MikeH on Sunday, January 06, 2008 (UMST)
Tristan's answer is elegant and correct, (I would suggest with the slight amendment that "any other seat will just pass the randomness on to the next passenger WHO NEEDS TO CHOOSE RANDOMLY, (I.E. THE ONE WHOSE SEAT HAS JUST BEEN OCCUPIED), who will be faced with the same probabilities". [The suggestion that the answer is 1/2 just because there are two possibilities, (i.e. that the 100th passenger's seat is occupied or is not), is too simple. It hits the right answer, but for the wrong reason. (If the problem stated that EVERYONE picked a seat at random regardless, there are still the two possibilities, that the 100th passenger's seat will be occupied or not, but the probability that it is unoccupied is 1/100, not 1/2)].

Reply to this Comment

Hmm
By tthomass on Monday, January 14, 2008 (UMST)
Hmm..At first thought I would agree with Peter and say that is a probability of .5 based on his approach. But think about this: - There is a 1/100 chance that the crazy guy picks his own seat. - IF he picks one of the 99 other seats, then the 98 next passengers would pick his/her own seat if not occupied, else they would pick another at random, and by that push the "problem" on to the next passenger. - When passenger 100 boards the plane, it's just a question of whether there IS a problem, which is then pushed on to him, or if it's not and he'll get his seat. I.e. 1/100 chance. Thoughts? Thomas.

Reply to this Comment

1/2 is the prob...
By rahul.sahukar on Saturday, January 19, 2008 (UMST)
there are two cases... 1. he sits in his seat ie., 100 2. he sits in any other seat. (1 - 99 ) if he sits in any seat other than 100, the result is the same. so, the probabilities are 1/2 + 1/2 so, his prob of sitting in his seat is 1/2 correct me if its a mistake.

Reply to this Comment

I also think 1/2 is the answer
By koonlo on Sunday, February 10, 2008 (UMST)

The question is for 100 passengers. 

 

If there is only one passenger.

P(1) = 1

 

If there are 2 passengers

P(2)  = Pass1 gets seat 1 = 1/2

 

If there are 3 passengers

P(3)  = Pass1 gets seat 1 + (Pass1 gets seat 2 and P(2))

         = 1/3 + 1/3 (P(2)) = 1/3 (1 +P(2)) = 1/2 (1 + 1/2) = 1/2

(after pass1 gets seat 2, pass2 only have 2 seats left where 1 now becomes his right seat, so it is a P(2) problem).

 

If there are 4 passengers

P(4)  = Pass1 gets seat 1 + (Pass1 gets seat 2 and P(3))  + (Pass1 gets seat 3 and P(2))

         = 1/4 + 1/4 (P(3))  + 1/4 (P(2)) = 1/4 (1 + P(2) + P(3)) = 1/4 (2) = 1/2

 

(after pass1 gets seat 2, pass2 has only 3 seats left where 1 now becomes his right seat, so it is a P(3) problem).

 

after pass1 gets seat 3, pass2 will take seat2.  pass3 has only 2 seats left where 1 now becomes his right seat, so it is a P(2) problem).

 

It can deduced that if there are n passengers,

P(n) = 1/n (1 + P(2) + P(3) + ...P(n-1))

       = 1/n (1 + 1/2 + ...+1/2) = 1/n ( 1+ (n-2)/2) = 1/n (n/2) = 1/2

 

So, I also think it is 1/2

Reply to this Comment

What if
By taocoyote on Thursday, February 28, 2008 (UMST)
What if the person displaced by the crazy guy picks the seat the crazy guy was supposed to be in? Is that probability considered the same as the crazy guy picking his own seat?

Reply to this Comment

1/100 it is
By mstpguy on Monday, March 03, 2008 (UMST)
For guys thinking on peter's line, it is way to complicated. For people trying to explain that it is 1/2, their's approach is too simple, apparently convincing, but lacking insight. The people who have concluded the answer that 1/100 is correct is by the way of assertion. Those who agree can rejoice. Those who fail to realize the mistake in 1/2 approach can read further. Consider this example. What is the probability that I get two heads. The answer obviously is 1/4 cause possible outcomes are HH, HT, TH, TT. So, out of these only HH satisfies the requirement. Now, consider this incorrect logic. Either I get HH or I don't. So, the probability is 1/2. Now, it should be clear why the answer is 1/100 and not 1/2. If it were as simple as deciding yes or no, we wouldn't "Probably" be studying probability ;-) -amit

Reply to this Comment

The Answer
By SohaNasr on Friday, March 14, 2008 (UMST)
Its quite easy & it doesn't need all these calculations it's like the probability of tossing a coin. Therefor, the sample space contains 2 events head or tail & since the probability of the sample space =1 Therefor, the prob. of each the head & the tail = 1/no of events = 1/2 like that, the sample space contains 2 events sitting or not sitting. Therefor, the probability of sitting = 1/2

Reply to this Comment

The answer is logical
By Adhiraj on Wednesday, June 11, 2008 (UMST)
At any time, if n is the pessenger number, all the seats before n except 1 are certainly filled up. i.e. If its 34th pessenger's turn, all the seats from 2 to 33 are certainly occupied. So at 100th pessenger's time, the seats numberred 2 to 99 are certainly occupied. Only free seat is either 1 or 100. Since pessenger's choose the seats at random (if their's is occupied), the chances that 100th seat is free is 50%. Hence the probability = 0.5

Reply to this Comment

I did a simple simulation - and the result is 0.9865
By cuchuoi on Wednesday, June 18, 2008 (UMST)
n = 10^7; c = 0; for k=1:n all = zeros(1,100); a = uint16(rand*99+1); all(a) = 1; for i=2:100 if all(i)==0 all(i)=i; else a = uint16(rand*99+1); all(a) = i; end end if all(100)==100 c=c+1; end end disp(c/n); Result: 0.9865

Reply to this Comment

.01
By Cibert on Thursday, July 03, 2008 (UMST)
I Think the correct answer its .01, cause the only way to have ALL people in order its that the cazy guy chose his sit, just think, he enter to the airplaine and he make a random from 1 to 100 and then came a number and he sits on that number, if he doesnt, THERE ARE NO ALL PEOPLE ON HIS SIT, cause he its not already in his sit soooo, theres is just one of 100 posibility for he to chose his sit.

Reply to this Comment

Add Your Comment

New Articles
  • Combinations in a character array.
    Write a program that takes input a char array and outputs all the combinations of the characters in the character array.
    Example: consier char array {'a','b','c'}
    the output shouold be abc,cab,bac,acb,cba,bca that is all the combinations of characters 'a','b','c'.


  • N-Queen Problem.
    Write a Program to solve N-Queen Problem.

  • Reverse a string
    Reverse a string using recursive function

  •  

    Most Popular Articles
  • Crazy Guy On The Airplane
    A line of 100 airline passengers is waiting to board a plane. they each hold a ticket to one of the 100 seats on that flight.

  • What are your greatest weaknesses
    Beware - this is an eliminator question, designed to shorten the candidate list. Any admission of a weakness or fault will earn you an “A” for honesty, but an “F” for the interview.

  • Question: Tell me about yourself.
    Many candidates, unprepared for the question, skewer themselves by rambling, recapping their life story, delving into ancient work history or personal matters.

  •  

    New Posts

  • dfasdf sd fsdf adult
    Posted by neteGaftFarse on Monday, July 07, 2008 (UMST)

  • King went already passed were understand offender.
    Posted by Kixhwwld on Monday, July 07, 2008 (UMST)

  • Another struck rapier himself troubled police crossbones.
    Posted by Gdpakshw on Sunday, July 06, 2008 (UMST)



  •