Monte Hall problem: the probability of turning over

Source: Internet
Author: User

The Monte Hall problem is a mathematical game problem derived from game theory. It is roughly from the TV game program "Let's Make a Deal ". The name of the question comes from Zhu's role as Monty.
Hall ). In this game, contestants will see three closed doors, one of which is followed by a car. Then the contestant selects a door and the host opens one of the remaining two doors to reveal one goat. Afterwards, the host will ask the contestants if they want to change to another closed door. This is a problem. Should contestants change it?


This problem gives people the most intuitive feeling that there is no need to change, because the door is not a car, the car must be in 1 or 2, of course, the probability of a car in each door is 50%. But the answer to this question should be changed, and the probability of having a car after the change is as high as 2/3!

This result is indeed incredible. We first use a program to verify its correctness.

Code List:

Import Java. util. random; public class mengtehuoer {public static void main (string [] ARGs) {Boolean [] A = new Boolean [3]; // triplicate random = new random (); int n = 10000; int COUNT = 0; For (INT I = 0; I <n; I ++) {// perform n tests cyclically for (Int J = 0; j <3; j ++) A [J] = false; int indexofcar = random. nextint (3); // randomly generated car location a [indexofcar] = true; int indexofchoose = random. nextint (3); // randomly select an int indexofopen; // The door opened by the host for (IND Exofopen = 0; indexofopen <3; indexofopen ++) {If (indexofopen! = Indexofcar & indexofopen! = Indexofchoose) break;} int indexofchange; // the door to be exchanged for (indexofchange = 0; indexofchange <3; indexofchange ++) {If (indexofchange! = Indexofopen & indexofchange! = Indexofchoose) break;} indexofchoose = indexofchange; if (a [indexofchoose] = true) Count ++;} system. Out. println (count * 1.0/n );}}

Output result: 0.6633 (equal to 2/3)

Where is the problem? The root cause is that if the contestant has not made a choice, the host opens a door that is not a car, and then selects it by the contestant. Therefore, the probability of a car in each door is 1/2, when a contestant chooses a door, the probability of a car is 1/3. When the host opens a door that is not a car, the probability of a car selected by the contestant is still 1/3! Why? Because there must be at least one of the two doors not selected by the contestant has a goat, and the host opens the door, the probability of the two doors as a whole is 2/3, when you open a door that is not a car, the probability of such a door changing to 0, and the probability of another door is of course 2/3.

Finally, we use a strict probability theory to prove the following:


Proof:

Settings:

Event O1 indicates that the contestant will not change the door and eventually get the car.

The event O2 changed the door for the contestant and eventually got the car.

Event M1 is the door selected by the contestant.

Event m2 is the door selected by the contestant without a car.

The event m3 contains a car for the door to be exchanged.

Because M1 and M2 are completely independent events, P (M1) = 1/3, P (m2) = 2/3;

If the door is not changed: P (O1) = P (M1) = 1/3;

If the door is changed: P (m3/M1) = 0, P (m3/m2) = 1,

Therefore, the formula for full probability is as follows: P (O2) = P (M1) * P (m3/M1) + P (m2) * P (m3/m2) = 1/3*0 + 2/3*1 = 2/3.

Pass.

========================================================== ========================================================== ============================

Author: Nash _ Welcome to repost. sharing with others is the source of progress!

Reprinted Please retain the original address: http://blog.csdn.net/nash_/article/details/8485118

========================================================== ========================================================== ==============================

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.