# Urn probability simulator

This calculator simulates the urn (or box with colored balls) often used for probability problems, and can calculate probabilities of different events.

When you start learning probability and statistics it is common to come across probability urn problems. According to wikipedia, "in probability and statistics, an urn problem is an idealized mental exercise in which some objects of real interest (such as atoms, people, cars, etc.) are represented as colored balls in an urn or other container like box. One pretends to remove one or more balls from the urn; the goal is to determine the probability of drawing one color or another, or some other properties."

Once you grasp the idea – and all the stuff like permutations, combinations and arrangements – the problems are often trivial, however, they can require tedious calculations. The calculator below simulates the probability urn or box, and can be used to calculate probabilities of different events.

To use it, you need to input a "probability urn" configuration and the event of interest. Below the calculator you can find some examples.

### Example 1

Problem: If a fair coin is flipped twice, what is the chance of finding at least one head?

How to use the calculator:

- Select "default data" in the table and delete it by clicking on top of the checkbox and then clicking on the "bin" icon on the table header.
- Add the urn configuration. Note that the quickest way to do this is to "import" data. Click on the "import" icon on the table header and enter the following values

`Head;H;1`

`Tail;T;1`

- Define the event of interest. Since we need at least one head, our event consists of the following elementary events: head-head, tail-head, head-tail.
**To input the elementary event, use its "alias" (second column in the table). Note that the alias should be unique. To combine events, use a comma.**So, enter in the "event" text field the following:

`HH,HT,TH`

Do not use any spaces. - Set the "With replacement" option. If an object is picked out and then replaced before the next object is selected, this is sampling with replacement. Otherwise, it is sampling without replacement.

After that you will get the probability of 0.75.

Show me### Example 2

Problem: If we randomly pick two cars in succession from a shipment of 200 cars of which 10 have defects, what is the probability that they will both be defective?

How to use the calculator:

- Select "default data" in the table and delete it by clicking on top of the checkbox and then clicking on the "bin" icon on the table header.
- Add the urn configuration. Note that the quickest way to do this is to "import" data. Click on the "import" icon on the table header and enter the following values

`Normal;N;190`

`Defective;D;10`

- Define the event of interest. Enter in the "event" text field the following:

`DD`

Do not use any spaces. - Ensure that the "With replacement" option is not set.

After that you will get the probability of 0.0023.

Show me### Example 3

Problem: A box contains six green balls, four black balls, and eight red balls. Two balls are selected from the box without replacement. What is the chance that both balls are the same color?

How to use the calculator:

- Select "default data" in the table and delete it by clicking on top of the checkbox and then clicking on the "bin" icon on the table header.
- Add the urn configuration. Note that the quickest way to do this is to "import" data. Click on the "import" icon on the table header and enter the following values

`Green;G;6`

`Black;B;4`

`Red;R;8`

- Define the event of interest. Enter in the "event" text field the following:

`BB,RR,GG`

Do not use any spaces. - Ensure that the "With replacement" option is not set.

After that you will get the probability of 0.3203.

Show me**Of course, for some problems entering the event is likely to be tedious and any mistake will lead to an incorrect probability calculation, so you should be very careful, or calculate the probability of the complement event, such as in the following example**

### Example 4

Problem: A box contains four red balls, three green balls and two yellow balls. Three balls are selected without replacement from the box. What is the probability that at least one color is not drawn?

How to use the calculator:

- Add the box configuration. Note that the quickest way to do this is to "import" data. Click on the "import" icon on the table header and enter the following values

`Red;R;4`

`Green;G;3`

`Yellow;Y;2`

- Define the event of interest. For this task it is more practical to find out the probability of the complement event. Enter in the "event" text field the following:

`RGY,RYG,GRY,GYR,YRG,YGR`

Do not use any spaces. - Ensure that the "With replacement" option is not set.

After that you will get the probability of the complement event 0.2857, so the answer is 0.7143.

Show meThis calculator can also be used to calculate the probabilities of conditional events. The conditional probability of an event A, given that event B has occurred, is defined as

,

given that

### Example 5

Problem: A drawer contains six black, eight red, and four white socks. Two socks are picked at random from the drawer. If you know that both socks are of the same colour, what is the probability that colour is white?

How to use the calculator:

- Add the urn configuration. Note that the quickest way to do this is to "import" data. Click on the "import" icon on the table header and enter the following values

`Black;B;6`

`Red;R;8`

`White;W;4`

- Define the event of interest. Enter in the "event" text field the following:

`WW`

Do not use any spaces. - Ensure that the "With replacement" option is not set.
- Set the "Find conditional probability" option
- Enter the following in the "given event" text field

`WW,RR,BB`

After that you will get the probability of 0.1224.

Show me#### Similar calculators

**

**PLANETCALC, Urn probability simulator

## Comments