Counting Principles and Probability: Textbook Readings
Counting Principles and Probability: Textbook Readings
Counting Principles and Probability: Textbook Readings
Introduction
Uncertainty is a common aspect of life and is usually present in the decisions we make. In everyday life we use
the term chance to quantify the uncertainty of an event occurring. Probability (which is identical to chance) is
the measure used to quantify uncertainty in statistics and is fundamental in building the statistical framework for
the remainder of STAT11048. In this chapter we begin our study of probability. We begin by studying the
principles of counting as counting the number of ways an event can occur is important when considering
probability from a relative frequency point of view.
Objectives
Students should be able to:
use the basic counting principle to count outcomes in given situations
count using formulae for permutations and combinations
use counting principles to assign probabilities to various events
determine the sample space for a given experiment and identify outcomes for various events
identify events that are mutually exclusive or overlapping
represent graphically one or more events by means of a Venn diagram
identify outcomes in, and discuss the meaning of, the following events:
A and B, A or B, A given B
determine whether events are dependent or independent
calculate an unknown probability using either the probability rules or a contingency table.
Chapter 4 – Page 43
Counting principles
Basic counting principle
If action 1 can happen in n1 ways and action 2 can happen in n2 ways, then “action 1 and action 2” can happen
in n1 n 2 ways. Note that we are using and.
For example, three towns (A, B and C) are connected by a number of different roads. There are 4 roads from A
to B, and 5 roads from B to C. How many different trips are possible from A to C? A trip consists of ‘a road
from A to B’ and ‘a road from B to C’ ie. action 1 and action 2.
Figure 4–1
It is easy to see that the rule can be extended for three or more actions. For example, a dinner menu offers 4
entrees, 6 mains and 5 desserts. A meal consists of one of each ie. a meal = 1 entrée and 1 main and 1 dessert.
The total number of possible meals is 120 ( 4 6 5 ).
Permutations
Consider the following situation. The Transport Department is investigating whether or not to use three letters
and three digits on number plates or four letters and three digits on number plates. How many different number
plates are possible under each system?
The order of letters and digits is important on a number plate. Because the letters and digits can be repeated,
the total number of different plates for three letters and three numbers is:
For four letters and three numbers the total number of different plates is:
26 26 26 26 10 10 10 456,976,000
Now let’s examine the case where no letter or digit is repeated. The different possibilities, when the order is
important and the selections are made without replacement, are called permutations.
This time the number of different plates with three letters and three numbers will be
26 25 24 10 9 8 11,232,000
For four letters and three numbers the number of different plates is
26 25 24 23 10 9 8 258,336,000
Chapter 4 – Page 44
The factorial notation
n ! n (n 1) (n 2) 3 2 1
Most calculators have a factorial button which is often represented by n! or x! Note that 0! = 1 is a special case.
Find and try the factorial key on your calculator!
The permutation notation n Pr
n Pr is the number of ways r distinct items can be chosen from n items when order is important.
n!
Pr
(n r )!
n
For example, for number plates with three letters and three numbers (with no repeated letter or number)
26!
letters 26 P3 26 25 24
23!
10!
numbers 10 P3 10 9 8
7!
So the total number of different plates consisting of 3 letters and 3 numbers (without repeats) is then
no. groups of letters no. groups of numbers 26 3 10 3 15, 600 720 11, 232, 000
For four letters and three numbers, the total number of plates (without repeated letters or numbers) is
26! 10!
no. groups of letters no. groups of numbers 26 P4 10 P3 258,336,000
22! 7!
Combinations n C r
The different possibilities when order is not important are called combinations.
For example, the one combination ABC has the six permutations ABC, ACB, BAC, BCA, CAB and CBA.
P
The number of permutations of 3 letters is 3 2 1 3! 6 . So the no. combinations 3 C3 3 3 1
3!
Similarly the one combination WXYZ has the following 24 permutations (as order is important)
WXYZ, WXZY, WYXZ, WYZX, WZXY, WZYX, XWYZ, XWZY
XYWZ, XYZW, XZWY, XZYW, YWXZ, YWZX, YXWZ, YXZW
YZWX, YZXW, ZWXY, ZWYX, XZWY, ZXYW, ZYWX, ZYXW
P4
The number of permutations of 4 letters is 4 3 2 1 4! 24 . So no. combinations 4 C4 4
1
4!
Chapter 4 – Page 45
n
The combination notation n Cr or
r
n C r is the number of ways r distinct items can be chosen from n items when order is not important.
P n! n
Cr n r
r !(n r )! r
n
r!
Basically as shown earlier the number of permutations of r distinct items is r ! Hence the number of
permutations of r items from n items n Pr has to be divided by r ! to give the number of combinations.
For example, a bus company has 35 buses. On any day 24 buses are used to service the bus routes of the city. It
doesn’t matter which bus travels which route so the number of ways the buses could be chosen is (as order is
not important):
35!
35 C24
24! 11!
417,225,900
If eight buses were being serviced then the number of bus route allocations is:
27!
27 C24 2925
24!3!
Consider the chance of winning ‘Gold Lotto’. There are 45 numbers and the winning combination involves 6
numbers in any order. Hence the number of possible combinations (because the order in which the numbers
are selected is not important) is
45!
45 C6 8,145,060
6!39!
If you also had to pick the order in which the numbers were selected then the number of permutations is
45!
45 6 P 5,864,443,200
39!
Some calculators have buttons for n Pr and n C r . Check to see if your calculator does! If not, then it should
have a factorial button (either n! or x!). Try the examples above with your calculator.
Chapter 4 – Page 46
Probability
We need some definitions and concepts before we can start our study of probability.
The sample space (S) is the collection of all possible outcomes for some process.
(a) Each individual outcome is called an elementary event.
(b) An event (E) is a collection of outcomes, that is, any subset of the sample space (S).
(c) Two events are mutually exclusive if there is no outcome common to both events.
(d) Probability is a number between 0 and 1 which expresses the chance that an event will occur.
Example 4–1
Two coins are tossed.
The event A = {at least one head is tossed} consists of three of the outcomes, namely,
The elementary events are mutually exclusive since if, say, HH is tossed it is not possible to obtain any other
result at the same time.
Events which are not mutually exclusive include:
The probability that something will happen can be calculated or assigned in three ways:
1. Relative frequency
We use the results of similar situations to predict the probability i.e. we count the frequency.
2. Classical methods
We use simple rules and formulae to calculate the expected probability.
3. Subjective assessment
We use our own belief or commonsense to assign a value.
Chapter 4 – Page 47
Assigning probabilities
In the coin example, if the two coins were tossed 500 times and the outcome {HH} came up 150 times then the
150
relative frequency is 0.3 . This figure might be used in the future to predict how often this result might
500
occur.
Alternatively classical methods dictate that there are four possible outcomes. {HH} is one of them. As each
possible outcome is equally likely, we have that
1
P(HH) 0.25
4
For example
3
P ( E1 ) 0.75
4
2
P ( E3 ) 0.5
4
In many business situations the classical definition is not applicable. So relative frequency or subjective
assessment is used as a measure of probability.
1
P(profit)
3
This model is much too simple and ignores almost all the contributing factors to the result.
Chapter 4 – Page 48
Venn diagrams
Venn diagrams are graphical displays which are useful for understanding and explaining probability. The
sample space (S) is displayed as a large rectangle and events (E) are displayed as either circles or rectangles
within S.
If E1 and E 2 are mutually exclusive (ie. no outcomes in common), then graphically we have
Chapter 4 – Page 49
Basic rules of probability
To calculate the probability of an event occurring P(E), we need a few basic rules.
Rule 1
If something is impossible then the probability that it will happen is 0 i.e. P( E ) 0 .
If it is certain to happen then the probability is 1 i.e. P( E) 1 .
All other probabilities lie between 0 and 1.
P E 1
E is called the complement of the event E. We can visually display the complement of an event using a Venn
diagram as follows:
If E ( e1 , e2 , e3 ) , then
Chapter 4 – Page 50
Example 4–2
Two coins are tossed. The complete sample space is:
1
The probability of each of the elementary events is .
4
1
P (HH) P (HT) P (TH) P (TT)
4
Probability 1 (Rule 2)
1 1
4 4
1
2
1 1 1
4 4 4
3
4
1
1
4
1 P (TT)
1 P ( E1)
Chapter 4 – Page 51
Union and Intersection of events
When calculating probabilities, we will often be interested in the union or intersection of events.
Intersection of events (e.g. A and B) — when 2 or more events occur at the same time. We use the notation ‘A
and B’ to indicate that both events A and B have to occur.
Using a Venn diagram we can visualise the event A and B as follows:
Union of events (e.g. A or B) — at least one of the events has to occur. We use the notation ‘A or B’ to
indicate that either A only occurs, B only occurs or ‘both A and B’ have to occur.
Using a Venn diagram we can visualise the event A or B as follows:
The next example shows how we can calculate the probability of the union of two events i.e. P ( E1 or E 2 ) .
Chapter 4 – Page 52
Example 4–3
Let S = all first year university students (2000 students)
E1 first year students enrolled in Course A (600 students)
Graphically, we have
Now E1 or E 2 students enrolled in Course A only, Course B only, or both Course A and Course B
Hence
E1 or E 2 550 250 50
600 300 50
E1 E2 E1 and E2
So
850
P( E1 or E2 )
2000
600 300 50
2000
600 300 50
2000 2000 2000
P( E1 ) P( E2 ) P( E1 and E2 )
This result P ( E1 or E 2 ) P ( E1 ) P ( E 2 ) P ( E1 and E 2 ) is called the Addition Rule for probability. There is
also a multiplication rule for probability. These rules can be used to calculate probabilities for any problem.
However students usually find it easier to calculate probabilities using a contingency table.
Chapter 4 – Page 53
Calculating probabilities using a contingency table
Calculating probabilities is much easier if the data is in a contingency table. A contingency table presents
frequency counts for two or more variables.
Example 4–4
A survey of 1000 students (1st, 2nd, 3rd year and postgraduates PG) at a university was used to construct the
following contingency table to show their opinions regarding child care facilities.
PG 127 71 66 264
Frequencies in the middle part of the contingency table represent the ‘intersection of events’. For example,
122 students are ‘1st year and answered Needed’, while 66 students are ‘PG and have No opinion’. These
joint frequencies are used to calculate joint probabilities like P(A and B).
What is the probability that a randomly selected student will be both a ‘2nd year and answer Not needed’?
39
P(2nd year and not needed) 0.039 That is, of the 1000 students who could be selected, 39
1000
students were ‘2nd year and answered Not needed’.
122
Another example is P(1st year and needed) 0.122
1000
Frequencies in the Total row or column refer to only one event and are referred to as marginal frequencies.
They are used to calculate marginal probabilities like P(A) or P(B).
What is the probability that a randomly selected student is a 3rd year?
342
P(3rd year) 0.342 , as of the 1000 students surveyed, 342 were 3rd year.
1000
191
Another example is P(Not needed) 0.191 , as 191 of the 1000 students answered Not needed.
1000
The probability of the union of two events P(A or B) is calculated as follows:
Chapter 4 – Page 54
as there are 163 1st year students and 652 students who answered ‘Needed’. However there are 122 students
who have been counted twice; once in the 163 1st year students and again in the 652 ‘Needed’. Hence we
have to subtract 122 from the sum of 163 and 652.
This result can be generalised to give what is commonly called the Addition Rule for probabilities.
Addition Rule:
Another example:
342 157 46
P (3rd year or No opinion)
1000
453
0.453
1000
as 46 students have been counted twice and need to be subtracted from the 342 ‘3rd year students’ and 157
student responses of ‘No opinion’.
Conditional probability
Another type of probability is called conditional probability—given that event A has occurred, what is the
probability that event B will now occur.
We use P(B A) to denote the probability of B, given that A has occurred. Conditional probabilities are easy
to calculate using a contingency table.
What is the probability that a 1st year answers Needed? That is, what is P(Needed 1st year) ?
122
P(Needed 1st year)
163
as given we are only interested in 1st year students (163), then the probability of randomly selecting someone
122
who answers ‘Needed’ is , as 122 of the 163 1st year students answered ‘Needed’. We have simply
163
changed the denominator — we are now only interested in 1st year students.
Another example,
71
P(PG | Not Needed)
191
as of the 191 students who answered ‘Not Needed’, 71 were postgraduates (PG). We are only interested in the
191 students who answered ‘Not Needed’ and 71 of them were PG.
Another example,
27
P(2nd year | No opinion)
157
as we are only interested in students answering ‘No opinion’ (157) of which 27 were 2nd year.
Chapter 4 – Page 55
Note that we can show that
27
P(2nd year | No opinion)
157
27
1000 dividing top and bottom by 1000
157
1000
27 157
as P(2nd year and No opinion) and P(No opinion)
1000 1000
In general, this gives us the conditional probability rule that
P (B and A)
P (B | A)
P(A)
which can be rearranged to give the Multiplication Rule for probabilities as P(A and B) P(B and A)
Multiplication Rule:
In words, the multiplication rule for probability says that ‘the probability of two events occurring is the
product of the probability of the 1st event times the probability of the 2nd event given the 1st has occurred’.
Two events (A, B) are said to be INDEPENDENT if P(B A) P(B) . That is, event A does not affect the
probability of event B occurring.
For example, consider tossing a coin twice. If A is ‘getting a head on the 1st toss’ and B is ‘getting a tail on
1
the 2nd toss’, then P( B) P(B A) as the tossing of coins is independent. However
2
231 27
P(2nd year) P(2nd year No opinion)
1000 157
so the events ‘ being a 2nd year’ and ‘having No opinion’ are NOT independent. For independent events, the
multiplication rule is
If a contingency table is available, it is relatively straightforward to calculate a probability like P(A), P(A or B),
P(A and B) or P(B A) . Hence in general I would recommend that you construct a contingency table to
calculate probabilities if possible. However you need to practice constructing contingency tables as it is not
always simple. I will now illustrate how to construct a contingency table when the events are NOT
INDEPENDENT.
Chapter 4 – Page 56
Constructing a contingency table when the events are NOT INDEPENDENT
Example 4–5 Constructing a contingency table (Tutorial Question 4–18)
The first step in constructing a contingency table is to identify the qualitative variables (usually 2) and the
categories of each qualitative variable.
For this example, the two qualitative variables are ‘Customer Location’ and ‘Customer Rating’. The
categories of each variable are:
Customer Location — Suburban or Urban
Customer Rating — Good, Borderline, or Poor.
Next we need to choose a total customer population size (e.g. choose 100). It doesn’t matter what total
number we choose. Next we use the given percentages (or proportions) to get the frequencies for each cell in
the contingency table. ‘30% of its customers are urban’ means 30 (= 30% of 100) are urban customers. ‘70%
are suburban’ means 70 are suburban customers. Putting these marginal frequencies into the contingency
table gives:
Urban ? ? ? 30
Suburban ? ? ? 70
Total ? ? ? 100
Next we use the percentages in each rating category to give the marginal frequencies of:
60 ‘good’ (= 60% of 100), 30 ‘borderline’ (= 30% of 100) and 10 ‘poor’ customers (= 10% of 100).
Updating the contingency table with these marginal frequencies gives:
Urban ? ? ? 30
Suburban ? ? ? 70
Total 60 30 10 100
Next we use the information regarding the percentage of each rating category in each location category, to
calculate the joint frequencies.
‘20% of good customers are urban’ gives 12 (= 20% of 60) customers who are both good and urban.
‘80% of good customers are suburban’ gives 48 (= 80% of 60) customers who are both good and suburban.
‘40% of borderline customers are urban’ gives 12 (= 40% of 30) customers who are both borderline and
urban.
‘60% of borderline customers are suburban’ gives 18 (60% of 30) customers who are both borderline and
suburban.
Chapter 4 – Page 57
Updating the contingency table with these joint frequencies gives:
Urban 12 12 6 30
Suburban 48 18 4 70
Total 60 30 10 100
Note that we calculated the frequency of ‘poor and urban’ customers (6) and ‘poor and suburban’ customers
(4) using the conditions 12 12 6 30 and 48 18 4 70 respectively. Having constructed the
contingency table it is relatively easy to calculate the probabilities required.
48
(a) P(Good and Suburban) 0.48
100
6
(b) P(Poor and Urban) 0.06
100
70 60 48
(c) P(Suburban or Good) 0.82
100
30
(d) P(Borderline) 0.3
100
4
(e) P(Suburban|Poor) 0.4 since of the 10 Poor customers, 4 are Suburban.
10
As shown in this Example 4-5 it is reasonably straightforward (or not too difficult) to construct a contingency
table when the events (or variables) are NOT INDEPENDENT. Once a contingency table is constructed then it
is reasonably straightforward to calculate any probability using the table. Determining the two variables for the
contingency table and the categories of each variable does need some practice. Also when constructing a
contingency table you have to carefully determine whether you are calculating a marginal or a joint
frequency.
However when the events (or variables) are INDEPENDENT, constructing a contingency table is not as
straightforward. So it is often easier to use the Addition and Multiplication probability rules when the events (or
variables) are INDEPENDENT. The next example illustrates how to calculate probabilities when the events (or
variables) are INDEPENDENT.
Chapter 4 – Page 58
Calculating probabilities when the events are INDEPENDENT
When the events are independent, it is easier to use the probabilities rules to calculate the probabilities rather
than to construct a contingency table. The following example shows
(a) We are asked to calculate the probability that both “the well in Alaska and the well in Texas” find oil.
P(oil in Alaska and oil in Texas)
P(oil in Alaska) P(oil in Texas) as the events are independent
0.6 0.8
0.48
(b) We are now asked to calculate the probability that both wells don’t find oil.
P(no oil in Alaska and no oil in Texas)
P(no oil in Alaska) P(no oil in Texas) as the events are independent
0.4 0.2
0.08
(c) Now we are asked to find the probability that exactly one well finds oil. We proceed by noting that one
of the following must occur. Either “exactly one well finds oil”, “both wells find oil” or “neither well
finds oil”. Hence the sum of the probabilities of these three events must be 1. So
P(exactly one well finds oil) 1 P(both find oil) P(neither finds oil)
1 0.48 0.08
0.44
So you can see that is very quick to calculate probabilities using the probability rules when the events or
variables are INDEPENDENT.
Conclusions
1. Using a counting argument with a contingency table is equivalent to using the probability rules.
2. Any question concerning probability can be converted into a contingency table by assuming an arbitrary
number of individuals/trials in the population.
3. However it is sometimes difficult to construct a contingency table from the given probabilities or
percentages especially when the variables are stated as INDEPENDENT.
4. In general, use either the probability rules or the contingency table method to answer the question.
5. Draw a Venn diagram to assist you visually and conceptually when using the probability rules.
Chapter 4 – Page 59
Tutorial exercises
Chapter 4 tutorial exercises are available on the STAT11048 Moodle website along with a complete set of
solutions to the tutorial exercises. There are also a number of past exam papers and solutions available on the
STAT11048 Moodle website. Two typical past exam questions for this chapter are given next.
(b) The payments for hospital bills at the Midstate Valley Hospital are either Private payments
(made by patients) or Third-Party payments (made by insurance companies or government
agencies). The payments made at Midstate Valley are divided between Private and Third–Party
in such a way that the probability of a Third-Party payment is 0.75. Two-thirds of those Third-
Party payments are for Surgical bills, and one-third are for Non-Surgical bills. However the
Private payments are split equally between payments for Surgical and Non-Surgical bills.
i. Use the above information to complete the contingency table below. (2 marks)
Private
Third-Party
Total 1000
If a payment is randomly selected from the historical database, what is the probability that the
payment is:
ii. both Private and Surgical ie. P(Private AND Surgical) (1 mark)
iii. either Third-party or Non-Surgical ie. P(Third-party OR Non-Surgical) (1 mark)
iv. Private given that it is for a Surgical item ie. P(PrivateSurgical) (1 mark)
Chapter 4 – Page 60
2016 Term 2 Exam Question 4
Question 4 7 Marks
(a) The game of Poker consists of dealing 5 cards to each player from a pack of 52 different cards
without replacement. In Poker the order in which cards are dealt is not important. For
example, one possible Poker hand is given below:
One possible Poker hand = 5 ♣, Ace ♥, 10 ♣, 3 ♦, Queen ♠
How many different Poker hands of five cards are possible from a pack of 52 cards? (2 marks)
(b) A social worker collects the following data at a soup kitchen. Of those visiting the kitchen, 59%
are male, 32% are alcoholics, and 21% are male and alcoholic.
i. Use this data to complete the contingency table below. Assume 100 visitors in total as
shown in the table. (2 marks)
Alcoholism status
Gender Alcoholic Non-alcoholic Total
Male
Female
Total 100
What is the probability that a random visitor to the soup kitchen is:
ii. both Female and Non-alcoholic ie. P(Female AND Non-alcoholic)? (1 mark)
iv. What is the probability that a random Male visitor is Alcoholic ie. P(Alcoholic | Male)?
(1 mark)
Chapter 4 – Page 61