Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,447 members, 7,819,650 topics. Date: Monday, 06 May 2024 at 07:54 PM

The Door-Goat-Car Logic Problem - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / The Door-Goat-Car Logic Problem (3556 Views)

Help Me Keep My Brain In My Skull! Solve This Logic! / ATTENTION: Programming Logic Comparison / Simple Logic!think U Can Crack This? (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: The Door-Goat-Car Logic Problem by ektbear: 1:33am On Apr 04, 2012
So in short, my best strategy is to switch, since 2/3 > 1/3
Re: The Door-Goat-Car Logic Problem by queensmith: 1:33am On Apr 04, 2012
if a door has been removed from 3 you end up with 2? so you choose one out of the 2, i don't get how you got the 2/3 probability?
Re: The Door-Goat-Car Logic Problem by ektbear: 1:37am On Apr 04, 2012
OK. We start out with 3 doors. The location of the car is chosen uniformly at random.

I pick a door.

Do we agree that the probability of me being correct is 1/3? And thus the probability of me having chosen the wrong door is 2/3?
Re: The Door-Goat-Car Logic Problem by queensmith: 1:39am On Apr 04, 2012
yes
Re: The Door-Goat-Car Logic Problem by ektbear: 1:40am On Apr 04, 2012
OK.

So you are the game host.

No matter which door I pick, since there are 2 goat doors, then there will be at least one goat door remaining.

You the host eliminate one goat door.

You offer me the chance of switching.
Re: The Door-Goat-Car Logic Problem by ektbear: 1:40am On Apr 04, 2012
So what is the chance of me winning if I don't switch? If I keep my door? It has to be 1/3rd, right? Since if I don't switch, I can only possibly win if I picked the right door from the beginning.

Do you agree on this part?
Re: The Door-Goat-Car Logic Problem by queensmith: 1:41am On Apr 04, 2012
delomos: @okeyxyz: see the pattern in Story 1 & Story 2, ' that the previous choice\door which turns out to be wrong is put back into the pool of choices\doors", why isn't it taken out?

ahhhhhhhh! i get it now, so the doors have been put back.

ok that makes sense.
Re: The Door-Goat-Car Logic Problem by queensmith: 1:42am On Apr 04, 2012
ekt_bear: So what is the chance of me winning if I don't switch? If I keep my door? It has to be 1/3rd, right? Since if I don't switch, I can only possibly win if I picked the right door from the beginning.

Do you agree on this part?

yes!
Re: The Door-Goat-Car Logic Problem by ektbear: 1:44am On Apr 04, 2012
Good.

So let's calculate my chance of winning if I switch.

Well, let's ask something slightly different. What is my chance of LOSING if I switch? I lose if I switch iff I picked the right door from the beginning, right?

But again, I only pick the right door with probability 1/3rd. So I lose after switching with probability 1/3rd.

So I win if I switch with probability 2/3, since:

Prob(Win after Switch) + Prob(Lose after switch) = 1

Do you agree so far?
Re: The Door-Goat-Car Logic Problem by ektbear: 1:48am On Apr 04, 2012
The mistake most people make when thinking about this is somehow thinking that the car is equally likely to be behind the two doors, after the host eliminates a goat door.

But as we see from this and as the 1 billion door example shows, this isn't true.

The host helps me out a lot by eliminating doors. And of the two doors remaining, I trust the other one more, since I probably choose the wrong door at the start of this game.
Re: The Door-Goat-Car Logic Problem by queensmith: 1:50am On Apr 04, 2012
ekt_bear: Good.

So let's calculate my chance of winning if I switch.

Well, let's ask something slightly different. What is my chance of LOSING if I switch? I lose if I switch iff I picked the right door from the beginning, right?

But again, I only pick the right door with probability 1/3rd. So I lose after switching with probability 1/3rd.

So I win if I switch with probability 2/3, since:

Prob(Win after Switch) + Prob(Lose after switch) = 1

Do you agree so far?

omg yes!! i agree,

quick question i hope this isn;t foolish- is your door among the unopened doors?
Re: The Door-Goat-Car Logic Problem by ektbear: 1:51am On Apr 04, 2012
Yes.


My door is not opened. Neither is the other one the host selects. However, the third door has been opened and a goat revealed inside of it.
Re: The Door-Goat-Car Logic Problem by queensmith: 1:57am On Apr 04, 2012
im actually learning, thanks dude

with the 1 billion door excercise is the probability of choosing the correct door after switching still 2/3?
Re: The Door-Goat-Car Logic Problem by ektbear: 1:59am On Apr 04, 2012
No, with 1 billion doors it is 999,999,999 divided by 1 billion.

So it really illustrates how advantageous it is to switch.

The key point with the 1 billion example is:
1) I almost certainly picked a useless goat door
2) The door the host picks almost certainly has the car. So he really helps me out a lot.
Re: The Door-Goat-Car Logic Problem by queensmith: 2:07am On Apr 04, 2012
this is actually pretty cool, i'm trying to apply this to the game deal or no deal,

you start with 22 boxes, the chances of picking 250k from the beginning 1/22

as they open the boxes they are always adamant the box they have chosen is the 250k, why not apply this reasoning by eliminating the box that probably isnt 250k and saving another box instead?

Re: The Door-Goat-Car Logic Problem by ektbear: 2:10am On Apr 04, 2012
From the way you describe it, then it sounds like an instance of this problem for N=22 boxes. So the same strategy of switching should be the best one.
Re: The Door-Goat-Car Logic Problem by delomos(m): 2:23am On Apr 04, 2012
Aha .... All I need now is a solid bowl of Eba and palm wine + @ekt_bear's analysis and I'm all set.

@ekt_bear, will this same be true of a "being" blind to the emotional attachment of being wrong on choice 1?

Say, there are 1 billion doors, 1st wrong, 2nd wrong, 3rd wrong... does following a [1-(1/n)] progression make sense (again assume the door chooser doesn't have the human factor e.g a computer) ?
Re: The Door-Goat-Car Logic Problem by ektbear: 2:35am On Apr 04, 2012
What?

What does human/computer have to do with this?

The only assumptions made are:

1) The choice of the door with the car is made uniformly at random, and I as the player have no knowledge of it
2) The game host opens up N-2 goat doors.

So I don't think human sentiment comes into play here..?
Re: The Door-Goat-Car Logic Problem by okeyxyz(m): 8:24am On Apr 04, 2012
this problem will be easily solved by implementing a binary search tree. first we ask the game-moderator\computer to sort the contents behind the door, and since we know that there is only one car and the rest are goats, so the sorting will place all goats to one side and the car to the other side like this:
array(goat, goat, goat, goat,..., car)
so, this increases our chance of being right to just 1/2 by choosing between the two extremes & ignoring the in-betweens.
Re: The Door-Goat-Car Logic Problem by delomos(m): 9:57am On Apr 04, 2012
@ekt_bear:
Umm, perhaps not, do see this graph here(at the very bottom): http://www.cs.dartmouth.edu/~afra/goodies/monty.pdf

@okeyxyz: the premise of a binary search tree (at least to be efficient) is that it's sorted. Problem with this is, you can't eliminate half of your choices and proceed to the other half (at least not if it's large enough).
Re: The Door-Goat-Car Logic Problem by okeyxyz(m): 10:06am On Apr 04, 2012
delomos:
@okeyxyz: the premise of a binary search tree (at least to be efficient) is that it's sorted. Problem with this is, you can't eliminate half of your choices and proceed to the other half (at least not if it's large enough).

since we know it's only one car & the rest are goats, just do a two-step search(after sorting), select first door, if it's right, then end search, else choose last door.
Re: The Door-Goat-Car Logic Problem by okeyxyz(m): 10:26am On Apr 04, 2012
btw, the only thing sacrosanct in this method is that the contents are sorted, not how you conduct the search.
Re: The Door-Goat-Car Logic Problem by delomos(m): 2:01pm On Apr 04, 2012
@okeyxyz
okeyxyz: btw, the only thing sacrosanct in this method is that the contents are sorted, not how you conduct the search.

Exactly, there is no way to know the sort order of a reference to a sort order. If I'm looking for 999, in a list of 1000. It's easy to eliminate < 800 and proceed in find -- in this case you are blind to this, being lucky you get O(1) and as the story states you can never get that (considering the first choice is always wrong), so generally, you're looking at O(Log N), see my point?
Re: The Door-Goat-Car Logic Problem by ektbear: 3:51pm On Apr 04, 2012
delomos: @ekt_bear:
Umm, perhaps not, do see this graph here(at the very bottom): http://www.cs.dartmouth.edu/~afra/goodies/monty.pdf

That graph has nothing to do with human sentiment. It just compares the theoretical probability to that obtained from simulating 100k games.
Re: The Door-Goat-Car Logic Problem by delomos(m): 3:58pm On Apr 04, 2012
ekt_bear:

That graph has nothing to do with human sentiment. It just compares the theoretical probability to that obtained from simulating 100k games.

What I was point out was in simulation it, 1/n or n+1/n gives the same probability as it draw closer to that 100k, so in a computing environment your analysis has to be rethought.
Re: The Door-Goat-Car Logic Problem by ektbear: 4:44pm On Apr 04, 2012
I don't understand what any of this has to do with computing.

The graph shows that if you simulate 100k random games, you'll get a win probability almost indistinguishable from the true win probability (n-1)/n.

The analysis is correct regardless of computing, human sentiment, etc. It has nothing to do with those things, it is pretty much just probability theory stuff.
Re: The Door-Goat-Car Logic Problem by delomos(m): 6:41pm On Apr 04, 2012
ekt_bear: I don't understand what any of this has to do with computing.

The graph shows that if you simulate 100k random games, you'll get a win probability almost indistinguishable from the true win probability (n-1)/n.

The analysis is correct regardless of computing, human sentiment, etc. It has nothing to do with those things, it is pretty much just probability theory stuff.
ekt_bear: I don't understand what any of this has to do with computing.

The graph shows that if you simulate 100k random games, you'll get a win probability almost indistinguishable from the true win probability (n-1)/n.

The analysis is correct regardless of computing, human sentiment, etc. It has nothing to do with those things, it is pretty much just probability theory stuff.

Have you worked in the domain of computational statistics?
Re: The Door-Goat-Car Logic Problem by ektbear: 6:49pm On Apr 04, 2012
What is "computational statistics"? I mean that is a pretty broad term, and could mean lots of things.

Anyway, more importantly, what does that plot you reference have to do with human sentiment, door chooser with human factor, etc?
Re: The Door-Goat-Car Logic Problem by delomos(m): 7:20pm On Apr 04, 2012
ekt_bear:
#1 => What is "computational statistics"? I mean that is a pretty broad term, and could mean lots of things.

#2 => Anyway, more importantly, what does that plot you reference have to do with human sentiment, door chooser with human factor, etc?

#1: Not exactly: "Computational statistics, or statistical computing, is the interface between statistics and computer science. It is the area of computational science (or scientific computing) specific to the mathematical science of statistics." (wiki)

#2: I've noted the human sentiment really has nothing to do with it. I was referring that there is a limit on how much a human being can make good decisions w/o error, and of course the error increases the larger the number.

Since a computer most likely doesn't have that limit, would the problem be solved differently depending on who/what is opening the door? (that's where the graph comes in)
Re: The Door-Goat-Car Logic Problem by ektbear: 7:27pm On Apr 04, 2012
The optimal strategy can be played by a human or computer. Yes, for some problems there are probably limitations on what a human can do. But this isn't one of those problems. A human being can do just as well as a computer can. In both cases, they win (N-1)/N fraction of the time.

There is no connection between that plot and the problem being solved differently by a computer, changing who opens the door, etc.
Re: The Door-Goat-Car Logic Problem by delomos(m): 9:06pm On Apr 04, 2012
@ekt_bear: If you insist, ok.
Re: The Door-Goat-Car Logic Problem by ektbear: 9:11pm On Apr 04, 2012
??

What changes? The strategy doesn't depend on a computer or not.

The plot which you referenced is a monte carlo simulation of what is effectively coinflipping...basically showing that a coin which has N-1/N probability of coming up heads, when you flip it 100k times it will in fact have nearly that fraction of heads.

I don't see the connection is between it and what you are saying..

(1) (2) (3) (Reply)

What Is The Most Sought After Programming Language? / Is Java The Right Programming Language For Me? / Reasons We Have Less Female Programmers In Nigeria

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 58
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.