# Probability Urn simulator

This calculator simulates 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 you can often find problems with probability urn. 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 probability urn or box, and can be used to calculate probabilities of different events.

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

Save the calculation to reuse next time or share with friends.

## 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 clicking on top checkbox and then clicking on "bin" icon on table header.
- Add urn configuration. Note that the quickest way to do it is to "import" data. Click on "import" icon on table header and enter the following values

`Head;H;1`

`Tail;T;1`

- Define 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 elementary event, use its "alias" (second column in the table). Note that alias should be unique. To combine events, use comma.**So, enter in the "event" text field the following:

`HH,HT,TH`

Do not use any spaces. - Set "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 clicking on top checkbox and then clicking on "bin" icon on table header.
- Add urn configuration. Note that the quickest way to do it is to "import" data. Click on "import" icon on table header and enter the following values

`Normal;N;190`

`Defective;D;10`

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

`DD`

Do not use any spaces. - Ensure that "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 clicking on top checkbox and then clicking on "bin" icon on table header.
- Add urn configuration. Note that the quickest way to do it is to "import" data. Click on "import" icon on table header and enter the following values

`Green;G;6`

`Black;B;4`

`Red;R;8`

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

`BB,RR,GG`

Do not use any spaces. - Ensure that "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 could be tedious and any mistake will lead to incorrect probability calculation, so you should be very careful or calculate the probability of the complement event, like in the following example**

## Example 4

Problem: A box contains 4 red balls, 3 green balls and 2 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 box configuration. Note that the quickest way to do it is to "import" data. Click on "import" icon on table header and enter the following values

`Red;R;4`

`Green;G;3`

`Yellow;Y;2`

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

`RGY,RYG,GRY,GYR,RYG,RGY`

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

After that you will get the probability of the complement event 0.2857, so the asnwer 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 6 black, 8 red, and 4 white socks. Two socks are picked at random from the drawer. What is the probability that both socks are white if it is known that they are of the same color?

How to use the calculator:

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

`Black;B;6`

`Red;R;8`

`White;W;4`

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

`WW`

Do not use any spaces. - Ensure that "With replacement" option is not set.
- Set "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
## Comments