# 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.

## Example 1

Problem: If a fair coin is tossed twice, what is the probability of getting 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 selected and then replaced before the next object is selected, this is known as sampling with replacement. Otherwise, it is called sampling without replacement.

After that you will get the probability of 0.75.

Show me## Example 2

Problem: If we randomly pick two television sets in succession from a shipment of 240 television sets of which 15 are defective, 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;225`

`Defective;D;15`

- 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.0037.

Show me## Example 3

Problem: A box contains five green balls, three black balls, and seven red balls. Two balls are selected at random without replacement from the box. What is the probability 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;5`

`Black;B;3`

`Red;R;7`

- 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.3238.

Show meProblem: A box contains four $10 bills, six $5 bills and two $1 bills. Two bills are taken at random from the box without replacement. What is the probability that both bills will be of the same denomination?

How to use the calculator: Use the same logic as above.

**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 two following examples**

## Example 4

Problem: An urn contains 3 red balls, 2 green balls and 1 yellow ball. Three balls are selected at random and without replacement from the urn. What is the probability that at least 1 color is not drawn?

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

`Red;R;3`

`Green;G;2`

`Yellow;Y;1`

- 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.3, so the asnwer is 0.7.

Show me## Example 5

Problem: Mr. Flowers plants 10 rose bushes in a row. Eight of the bushes are white and two are red, and he plants them in random order. What is the probability that he will consecutively plant seven or more white bushes?

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

`White;W;8`

`Red;R;2`

- Define event of interest.
**Here you need to be very careful.**Enter in the "event" text field the following:

`WWWWWWWWRR,WWWWWWWRWR,WWWWWWWRRW,RWWWWWWWWR,RWWWWWWWRW,WRWWWWWWWR,WRRWWWWWWW,RWRWWWWWWW,RRWWWWWWWW`

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

After that you will get the probability of 0.2. And, yes, it is probably faster to calculate this manually.

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 by

,

given that *P(B)>0*

## Example 6

Problem: A drawer contains 4 black, 6 brown, and 8 olive socks. Two socks are selected at random from the drawer. What is the probability that both socks are olive 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;4`

`Brown;R;6`

`Olive;O;8`

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

`OO`

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

`OO,RR,BB`

After that you will get the probability of 0.5714.

Show me
## Comments