Basic Probability, part 6

August 24, 2009

The another type of presentation the probability is a table with occasions and their frequencies. For example, we have been watching basketball game and the team is stable with 5 players, and we calculated that players scores in a row are following:
table1

If we are watching a random scene of the games and our team scored. The probability that this score has done by player 3 is P(E)=\frac{number~ of~all~scores~by~ player~3}{number~of ~total ~scores}=\frac{300}{100}=\frac{3}{10}.

Expectation.

Consider an example, there is a one-armed bandit machine in a casino and it works on following idea: on every 400 attempts to win machine gives to win 2 times with $25 and 1 time with $45. If each attempt costs $1, what we can expect as average winning in long run?

To answer on this question we need to know the notion “expectation”. Expectation or expected value is a long run average and is calculated as:

E(X)=X_1 *P(X_1)+X_2*P(X_2)+...+X_n*P(X_n),
where X_1 is the first occasion in numbers and P(X_1) is the probability for the first occasion, and so on for the rest occasions.

Now let us look at our example in a casino. Denote the first occasion as lose, so X_1 = -1 doll. and P(X1)=\frac{397}{400}, the second occasion is win $25, so X_2 =25 doll. and P(X1)=\frac{2}{400}, the third occasion is win $45, so X_3 =45 doll. and P(X1)=\frac{1}{400}. Put all information together in the table:
table2

Calculate expected value or expectation:
E(X)=-1*\frac{397}{400}+25*\frac{2}{400}+45*\frac{1}{400}=-\frac{302}{400}
Round the value to -\frac{3}{4}.
And what does it mean? It means that if we are going to play with the machine for a long time every arm dropped will cost to us $\frac{3}{4}. It is the average value that we loose.

Pretend the following case.
We has sat all the night in a casino and played in one-armed bandit. We dropped the arm 400 times, on 25th and 142nd attempt we won $25, on 177th drop we won $45, the rest attempts were lose.

You can see that sometimes we lose, sometimes we won, however it looks like we came to the machine and gave $ \frac{3}{4} for every attempt without losing $1 or winning $25 and $45.

Now let us see the view from the casino owners. When one is going to play in our casino in one-armed bandit and saying “I am going to win”, he(she) is wrong. We are going to win! And at an average on every drop we win $ \frac{3}{4} or approximately 66 cents.

Advertisements

Basic Probability, part 5

August 24, 2009

rez

Let us revise some information.

Pretend we at random choose two cards from a deck at the same time and we want to know what is the probability that we choose a queen or a king. As we know we these two events are mutually exclusive, because one card cannot be and a king and a queen at the same time, so we need to add two probabilities: P(queen ~ or ~ king)=\frac{4}{52}+\frac{4}{52}=\frac{8}{52}=\frac{2}{13}.

Independent events.

And now consider the case when we toss a coin an the choose at random on card from a deck. What is the probability that we get Heads and an ace? As we know we need multiple probabilities of those two events: P(H ~ or ~ Ace)=\frac{1}{2}*\frac{4}{52}=\frac{1}{26}. Current two events are called independent, because the second event “choose an ace” is not depend on the first event “get Heads”. The probability of getting an ace is P(Ace)=\frac{4}{52} and it is independent weather we toss coin or not. The same for coin.

The multiplication rule 1:
If event A and event B are independent, then
P(A~ and~ B)=P(A)*P(B).

Dependent events.
Let us get a queen from an ordinary deck with 52 cards. The probability of this event is P(Queen~ 1)=\frac{4}{52}. Now put the queen in a pocket. And try to get another queen from the deck. Notice that we have 51 cards and 3 queens! So the second event to get a queen has probability P(Queen ~2)=\frac{3}{51}.

These two events are called dependent events, the second event is dependent from the first. The probability that event B occurs given that event A has already occurred is denoted as P(B~|~A).

In our case with two queens the probability that we get a queen in the first choose and it is not replaced, and we get a queen in the second choose is:

P(Queen ~1 ~ and~Queen~2)=P(Queen~1)*P(Queen~2|~Queen~1)=\\ = \frac{4}{52}*\frac{3}{51}=\frac{1}{221}.

The multiplication rule 2:

If event A and event B are dependent, then
P(A~ and~ B)=P(A)*P(B~|~A).

Basic Probability, part 4

August 23, 2009

All previous examples were with mutually exclusive events. These are events that do not have common cases or cannot occur at the same time. For example, the event “select a king” and the event “select an ace” from the deck are mutually exclusive, because we cannot select them both if we take one card.

The additional rule 1:
If two events (A and B) are mutually exclusive, then
P(A~or~B)=P(A)+P(B).

Thus the probability for the event “select a king or a queen” from a deck is
P(Queen~or~King)=P(Queen)+P(King)=\frac{4}{52}+\frac{4}{52}=\frac{8}{52}=\frac{2}{13}.

The example of not mutual exclusive events is “select an ace” and “select the spades” in a deck, because there are 4 aces, 13 spades cards, and there is one common case – the spades ace! The spades ace belongs to the group “aces” and to the group “spades” at the same time.

The additional rule 2:
If two events (A and B) are not mutually exclusive, then
P(A~or~B)=P(A)+P(B)-P(A~ and~ B).

In our case the probability of the event “select an ace or an spades card” is
P(Ace~or~Spades)=P(Ace)+P(Spades)-P(Ace~ and~ Spades ~at ~the~ same~ time)=\frac{4}{52}+\frac{13}{52}-\frac{1}{52}=\frac{16}{52}=\frac{4}{13}.

Why do we need to subtract the probability of common cases P(A ~ and ~ B)?
Consider this issue in the next example. Look at the picture:
16

Let us find the probability of the event “randomly select a triangle or a yellow figure”. There are 12 figures at all and as we can see for our ask there are follow 7 figures:
33_2

So, the probability of the event “randomly select a triangle or a yellow figure” is P(Triangle~ or~ Yellow~figure)=\frac{7}{12}.

Good, but what do occur when we add the probability of the event “select a triangle” to the probability of the event “select a yellow figure”? There are 5 triangles and 5 yellow figures, so after add them up we get 10 figures, while we need 7 figures. The three excess figures occurs, because they are common and we have three yellow triangles, that belong to the group “triangles” and to the group “yellow figures” at the same time. Notice that after adding we count common figures two times: first, when we count triangles and second, when we count yellow figures:
33_3

Thus we need to subtract the number of common figures.

The probability of the event “randomly select a triangle or a yellow figure” is:
P(Triangle~ or~ Yellow~figure)=P(Triangle)+P(Yellow~figure)- \\-P(Triangle~ and~Yellow~figure)=\frac{5}{12}+\frac{5}{12}-\frac{3}{12}=\frac{7}{12}.

Basic Probability, part 3

August 23, 2009

Dice01

Dice are very old instruments for games, thus they had been found in Egyptian tombs, dated to 2000 BC. Dice gamble were greatly popular in ancient Greek, Rome, Asia, then in medieval Europe and it has been being popular today. In ancient times the throw of dice was believed to be controlled by the gods. Famous was the game with throwing two dice and guessing the sum of the numbers. People noticed that the number 7 as the sum turns out more frequently and they thought that the cause is the gods favour. Number 7 is the lucky number!

Today with maths help we can understand why the sum 7 appears more frequently.

Consider all possible cases in rolling two dice. The first die has 6 sides and 6 numbers, the same is for the second die – 6 sides with 6 numbers. All possible sums of these numbers are from 1+1=2 to 6+6=12.

The picture below presents the table with all possible cases, each intersection presents the sum of the numbers of two dice:
15

As you can see the sum 7 appears more frequently than any other sum. There are 6 cases with the sum 7 and there are 36 possible cases at all. Hence the probability that the sum of two rolled dice will be 7 is \frac{6}{36}=\frac{1}{6}.

The probability for the sum 7 is the greatest. For example, for the sum 5 the probability is \frac{4}{36}=\frac{1}{9}, since there are only four cases we can get the sum 5.

Moreover, the probability of getting the sum 7 is equal to the probability of getting the sum (2 or 3 or 11 or 12), since P(Sum ~2 ~or~ 3~ or~ 11~ or~ 12)= \frac{1}{36}+\frac{2}{36}+\frac{2}{36}+\frac{1}{36}=\frac{6}{36}=\frac{1}{6}.

Ancient people used the number 7 of the sum two dice to check cheating. If the sum 7 appeared often then dice are fair, if not then dice are loaded. Brilliant method!

Basic Probability, part 2

August 23, 2009

Another way to consider the probability is graphical way.

Consider the following case:
there are a coin and the five balls in a bag with numbers 1,2,3,4,5 respectively. We toss a coin and then take out from the bag a ball.
Let us draw first event – tossing the coin, there can be H with the probability \frac{1}{2} and T with the probability \frac{1}{2}:
12
Pretend that we get H, then we take a ball with the probability \frac{1}{5} for each number. Notice that the occasion there will be the same if we get T, and then take a ball with the probability \frac{1}{5} :
12_2

As we know to calculate the probability of two events we need to multiply them. Thus the probability of the event “T on the coin and the ball number 1” is P(E)=\frac{1}{2}* \frac{1}{5}=\frac{1}{10}.
The probability of the event “T on the coin and the ball number 2” is P(E)=\frac{1}{2}* \frac{1}{5}=\frac{1}{10}.
The probability of the event “H on the coin and the ball number 3” is P(E)=\frac{1}{2}* \frac{1}{5}=\frac{1}{10}, and so on.

12_3

And as we know the probability of all cases is equal 1:
the probability of getting H or T on the coin is P(E)=\frac{1}{2}+ \frac{1}{2}=1;
the probability of taking the ball with the number 1 or 2 or 3 or 4 or 5 5 is P(E)=\frac{1}{5}+ \frac{1}{5}+ \frac{1}{5}+ \frac{1}{5}+ \frac{1}{5}=1;
the probability of getting H or T on the coin and then taking the ball with the number 1 or 2 or 3 or 4 or 5 is P(E)=\frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}+ \frac{1}{10}=1. You can see it on the previous picture.

Score a goal.

Get an another example. We are watching football game and we know that the forward scored 300 goals in 1000 attacks. So the property that he score a goal in an attack is P(E)=\frac{3}{10}. If there were 2 attacks, what is the probability that the forward scored the goal on the first attack and missed on the second attack. To get answer we need to calculate the probability of the missing in an attack, it is P(Miss)=1-P(Score)=1- \frac{3}{10}=  \frac{7}{10}, since the forward could miss or score and nothing else. Denote “Score a goal” as S, “Miss a goal” as M, and show all possible variants on the picture:

14

As before we multiplied the probabilities. The probability that the forward scored the goal on the first attack and missed on the second attack is P(SM)=\frac{21}{100}.

For 3 or more events, for instance, when 3 attacks occurred we need to draw a picture with a larger tree (scheme). The idea is the same.

Score a goal in the five attempts.

Consider the case when we play the basketball and have 5 attempts to throw the ball. If we know that we can get a score with the probability P(S)=\frac{2}{3}, what is the probability that we at least take one score in all 5 attempts. What does it mean? It means that we need to find all possible variants of the scoring except one – when we miss every time in all five attempts. In other words, we find P(E)=1 - P(MMMMM), and it will be the answer.
To calculate P(MMMMM) let us find the probability of missing in an attempt, it is P(M)=1-P(S)=1-\frac{2}{3}=\frac{1}{3}.
Hence the probability that we lose all attempts is P(MMMMM)=P(M)*P(M)*P(M)*P(M)*P(M)=\\ \frac{1}{3}*\frac{1}{3}*\frac{1}{3}*\frac{1}{3}*\frac{1}{3}=\frac{1}{243}.

Then the probability that we at least take one score in all 5 attempts is 1-\frac{1}{243}=\frac{242}{243}. And it is very high, so probably we take a score.

Basic Probability, part 1

August 22, 2009

diesIn this part we are going to discuss classical probability and it’s applications.

What does probability mean?

Consider an example. Let’s toss a die. There are only 6 possible outcomes for us: ultimately a die shows upper side with only one number and there are 6 numbers. All these possible outcomes are called sample space. So our sample space is S=\{1,2,3,4,5,6\}.

Now let us consider some events: the die shows 1, the die shows 2, the die shows 1 or 2, the dies shows an even number (2 or 4 or 6), and so on. Choose the event – the die shows 2.

The formula for determining probability for an event E is:

P(E)= \frac{number~ of~ outcomes~ in ~ the ~event}{number~ of~ outcomes~ in ~ the ~ sample~ space}.

The number of outcomes in the event “the dies shows 2” is 1, because it is only one case when we can get number 2. The number of outcomes in the sample space is the number of all possible cases and, as mentioned upper, is 6.
So, we can write our first probability: the probability of the event that the die shows 2 is P(E)= \frac{1}{6}.

The event “the die shows an odd number” has 3 outcomes: 1 or 3 or 5. Then probability for this event will be P(1 ~or ~3 or~ 5)= \frac{3}{6}=\frac{1}{2}.

Now let us consider a coin. The sample space is S=\{Heads, Tails \}.

The probability that tossed coin shows H(Heads) is \frac{1}{2}. The same is for T(Tails).

And there is more complicated case: let us toss two coins instantly. We have 4 outcomes: HH, HT, TH, TT.
What is the probability of the event that we get H on the first coin and H on the second, or in other words P(HH).

It is equal \frac{1}{4}, since we have 1 outcome for HH, and at all 4 outcomes.

As you can see the lowest number of outcomes in the event is 0, when it does not occur, and the highest is equal to the all numbers of outcomes (outcomes in the sample space). So the probability will be always from P(E)= \frac{0}{number~ of~ outcomes~ in ~ the ~ sample~ space} to P(E)= \frac{number~ of~ outcomes~ in ~ the ~ sample~ space}{number~ of~ outcomes~ in ~ the ~ sample~ space}, or, the same, from 0 to 1. So we can write constrained formula for every probability:

0<= P(E) <=1.

Moreover, the probability of the event concluded all cases is always equal 1. For example, we toss a coin and the probability of the event “H or T” is equal P(H~ or ~ T)= \frac{1}{2} + \frac{1}{2}=1. In the case of the two coins tossed instantly, we have P(HH~ or ~ HT ~or ~ TH~ or ~ TT)= \frac{1}{4} + \frac{1}{4}+\frac{1}{4} + \frac{1}{4}=1.


The Multiplication.

Now consider two events: we toss a coin and then toss a die. What is the probability for the outcome H on the coin and 5 on the die? To consider this task we need to multiply the probability of the first event by the probability of the second event. The probability of the event “H on the coin” is equal \frac{1}{2}, the probability of the event “5 on the die” is equal \frac{1}{6}. So the asked probability is P(E)=\frac{1}{2}*\frac{1}{6}= \frac{1}{12}.

What with “T” on the coin and “2 or 3” on the die? P(E)=\frac{number ~ that ~ Tails ~ occurs}{number~of ~ all ~ posible~ cases~for~ the ~ coin}* \\ * \frac{number ~ that ~ 2 or 3 ~ occurs}{number~of ~ all ~ posible~ cases~for ~ the ~ die} = \frac{1}{2}*\frac{2}{6}= \frac{2}{3}.

Exclusive probability.

The probability for all cases is equal 1. If we know that there are a class of the 20 boys and the 10 girls, we choose randomly a person, what is the probability that it is a boy?
There are 30 persons at all and 20 boys, then asked probability is P(B)=\frac{20}{30}=\frac{2}{3}. For a girl is P(G)=\frac{10}{30}=\frac{1}{3}. As your can see for all possible cases, if we chose a boy or a girl P(B~ or ~G)=\frac{2}{3}+\frac{1}{3}=1. So as we said total probability is always equal 1.

If we know that there are women and men in the city and we go to the street, the probability that we firstly meet a man is \frac{2}{5}. What is the probability that we meet a woman firstly? We can use the rule of exclusive: the probability that it is a woman or a man is equal 1, the probability tat it is a man is \frac{2}{5}, and P(M~ or ~W)= P(M)+P(W)=1. Then P(W)= P(M)+P(M~or~W)=1 - \frac{2}{5} = \frac{3}{5}.
So, the asked probability for a woman is equal \frac{2}{5}.

The same, if we know that there are in the parking either blue or green cars and no other colours and there will be a robbery. The probability that a hijacker get a blue car is \frac{1}{20}. Then we can immediately say that probability that a green car will be stolen is P(G)= P(G or B) - P(B)=  1  - \frac{1}{20} =  \frac{19}{20}.

Thus, if you see a confuse task like: “there are 254 tickets for a lottery, which were sold for $2.5 each, while Jimmy bought 3 tickets and you bought 15. What is your chance to win (in the form of probability) if there are only five winning tickets”, now you should know the answer. At first, look at the question, then look at the information. We asked about the probability to win and have 5 winning tickets of 254, while we bought 15 of them. We do not care about Jimmy and the cost.

We know all we need: the number of outcomes in the sample space is 254 and the number of outcomes in the event if we bought one lottery is 5 (winning). So the probability for one bought ticket is P(1 ~ ticket) is equal \frac{5}{254}, however we bought 15 of them, so we multiply by 15 and have \frac{75}{254}.

If you do not get some stuff, do not be upset because in the next post there will be the graphical explains and it will be easer to understand.