Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Discrete Mathematics

2. There must be at least two people in a big city with the same number of hairs on
their heads.

The Inclusion-Exclusion principle


The Inclusion-exclusion principle computes the cardinal number of the union of
multiple non-disjoint sets. For two sets A and B, the principle states:
|A ∪B| = |A| + |B| – |A∩B|

For three sets A, B and C, the principle states:


|A∪B∪C | = |A| + |B| + |C| – |A∩B| – |A∩C| – |B∩C| + |A∩B∩C |

The generalized formula:

|⋃ |= ∑ | ∩ |+ ∑ | ∩ ∩ | − … … + (−1) −1| ∩…∩ |


1 2

=1 1≤ < ≤ 1≤ < < ≤

Problem 1
How many integers from 1 to 50 are only multiples of 2 or 3?

Solution

From 1 to 100, there are 50/2=25 numbers which are multiples of


2. There are 50/3=16 numbers which are multiples of 3.
There are 50/6=8 numbers which are multiples of both 2 and 3.
So, |A|=25, |B|=16 and |A∩B|= 8.
|A ∪ B| = |A| + |B| – |A∩B| =25 + 16 – 8 = 33

Problem 2
In a group of 50 students 24 like cold drinks and 36 like hot drinks and each student
likes at least one of the two drinks. How many like both coffee and tea?

Solution

Let X be the set of students who like cold drinks and Y be the set of people who like hot
drinks.
So,

|X∩Y| = |X| +
|
|Y| – |X∪Y| =
X ∪ Y | = 50, |X| = 24, |Y| = 36
24 + 36 – 50 =
60 – 50 = 10
Hence, there are 10 students who like both tea and
coffee.

41
11. PROBABILITY Discrete Mathematics

Closely related to the concepts of counting is Probability. We often try to guess the
results of games of chance, like card games, slot machines, and lotteries; i.e. we try to
find the likelihood or probability that a particular result with be obtained.

Probability can be conceptualized as finding the chance of occurrence of an event.


Mathematically, it is the study of random processes and their outcomes. The laws of
probability have a wide applicability in a variety of fields like genetics, weather
forecasting, opinion polls, stock markets etc.

Basic Concepts
Probability theory was invented in the 17th century by two French mathematicians,
Blaise Pascal and Pierre de Fermat, who were dealing with mathematical problems
regarding of chance.

Before proceeding to details of probability, let us get the concept of some definitions.

Random Experiment: An experiment in which all possible outcomes are known and the
exact output cannot be predicted in advance is called a random experiment. Tossing a
fair coin is an example of random experiment.

Sample Space: When we perform an experiment, then the set S of all possible
outcomes is called the sample space. If we toss a coin, the sample space S = {H, T}

Event: Any subset of a sample space is called an event. After tossing a coin, getting
Head on the top is an event.

The word "probability" means the chance of occurrence of a particular event. The best
we can say is how likely they are to happen, using the idea of probability.
Total number of favourable outcome
Probability of occurence of an event =
Total number of Outcomes

As the occurrence of any event varies between 0% and 100%, the probability varies
between 0 and 1.

Steps to find the probability:


Step 1: Calculate all possible outcomes of the experiment.
Step 2: Calculate the number of favorable outcomes of the
experiment. Step 3: Apply the corresponding probability formula.

42
Discrete Mathematics

Tossing a Coin

If a coin is tossed, there are two possible outcomes: Heads (H) or Tails

(T) So, Total number of outcomes = 2

Hence, the probability of getting a Head (H) on top is ½ and the probability of getting a
Tails (T) on top is ½

Throwing a Dice

When a dice is thrown, six possible outcomes can be on the top: 1, 2, 3, 4, 5,

6. The probability of any one of the numbers is 1/6

The probability of getting even numbers is 3/6=1/3

The probability of getting odd numbers is 3/6=1/3

Taking Cards From a Deck

From a deck of 52 cards, if one card is picked find the probability of an ace being drawn
and also find the probability of a diamond being drawn.

Total number of possible outcomes:

52 Outcomes of being an ace: 4

Probability of being an ace = 4/52 =1/13

Probability of being a diamond = 13/52 =1/4

Probability Axioms
1. The probability of an event always varies from 0 to 1. [0 ≤ P(x) ≤ 1]
2. For an impossible event the probability is 0 and for a certain event the probability
is 1.
3. If the occurrence of one event is not influenced by another event, they are called
mutually exclusive or disjoint.

If A1, A2....An are mutually exclusive/disjoint events, then


P(Ai ∩ Aj) = ϕ for i≠j and P(A1 ∪ A2 ∪.... An) = P(A1) + P(A2)+..... P(An)

Properties of Probability
1. If there are two events x and which are complementary, then the probability of
the complementary event is:
P( ) = 1– P(x)
43
Discrete Mathematics

2. For two non-disjoint events A and B, the probability of the union of two events: P(A∪ B)
= P(A) + P(B)

3. If an event A is a subset of another event B (i.e. A ⊂ B), then the probability of A is less
than or equal to the probability of B. Hence, A ⊂ B implies P(A) ≤ p(B)

Conditional Probability
The conditional probability of an event B is the probability that the event will occur given
an event A has already occurred. This is written as P(B|A). If event A and B are mutually
exclusive, then the conditional probability of event B after the event A will be the
probability of event B that is P(B).

Mathematically: P(B|A) = P(A ∩ B) / P(A)

Problem 1
In a country 50% of all teenagers own a cycle and 30% of all teenagers own a bike and
cycle. What is the probability that a teenager owns bike given that the teenager owns a
cycle?

Solution
Let us assume A is the event of teenagers owning only a cycle and B is the event of
teenagers owning only a bike.

So, P(A) = 50/100 = 0.5 and P(A ∩ B) = 30/100= 0.3 from the given
problem. P(B|A) = P(A ∩ B) / P(A) = 0.3/0.5 = 0.6
Hence, the probability that a teenager owns bike given that the teenager owns a cycle is
60%.

Problem 2
In a class, 50% of all students play cricket and 25% of all students play cricket and
volleyball. What is the probability that a student plays volleyball given that the student
plays cricket?

Solution
Let us assume A is the event of students playing only cricket and B is the event of
students playing only volleyball.

So, P(A) = 50/100=0.5 and P(A ∩ B) = 25/100=0.25 from the given


problem. P(B|A) = P(A ∩ B) / P(A) =0.25/0.5 =0.5
Hence, the probability that a student plays volleyball given that the student plays cricket
is 50%.

44
Discrete Mathematics

Problem 3
Six good laptops and three defective laptops are mixed up. To find the defective laptops
all of them are tested one-by-one at random. What is the probability to find both of the
defective laptops in the first two pick?

Solution
Let A be the event that we find a defective laptop in the first test and B be the event
that we find a defective laptop in the second test.

Hence, P(A ∩ B) = P(A)P(B|A) =3/9 × 2/8 = 1/21

Bayes' Theorem
Theorem: If A and B are two mutually exclusive events, where P(A) is the probability of
A and P(B) is the probability of B, P(A | B) is the probability of A given that B is true. P(B
| A) is the probability of B given that A is true, then Bayes’ Theorem states:
P(B | A) P(A)
P(A | B) = ∑ni=1 P(B | Ai)P(Ai)

Application of Bayes’ Theorem


 
 In situations where all the events of sample space are mutually exclusive events.


In situations
 where either P( Ai ∩ B ) for each Ai or P( Ai ) and P(B|Ai ) for each Ai is
known.

Problem
Consider three pen-stands. The first pen-stand contains 2 red pens and 3 blue pens; the
second one has 3 red pens and 2 blue pens; and the third one has 4 red pens and 1 blue
pen. There is equal probability of each pen-stand to be selected. If one pen is drawn at
random, what is the probability that it is a red pen?

Solution
th
Let Ai be the event that i pen-stand is selected.
Here, i = 1,2,3.
Since probability for choosing a pen-stand is equal, P(Ai) = 1/3

Let B be the event that a red pen is drawn.

The probability that a red pen is chosen among the five pens of the first pen-stand,

P(B|A1) = 2/5

The probability that a red pen is chosen among the five pens of the second pen-stand,

P(B|A2) = 3/5

The probability that a red pen is chosen among the five pens of the third pen-stand,

P(B|A3) = 4/5

45
Discrete Mathematics

According to Bayes’ Theorem,

P(B) = P(A1).P(B|A1) + P(A2).P(B|A2) + P(A3).P(B|A3)

= 1/3 ∙ 2/5 + 1/3 ∙ 3/5 + 1/3 ∙ 4/5

= 3/5

46
Discrete Mathematics

Part 5: Mathematical Induction & Recurrence


Relations

47
12. MATHEMATICAL INDUCTIONDiscrete Mathematics

Mathematical induction, is a technique for proving results or establishing statements


for natural numbers. This part illustrates the method through a variety of examples.

Definition
Mathematical Induction is a mathematical technique which is used to prove a
statement, a formula or a theorem is true for every natural number.

The technique involves two steps to prove a statement, as stated below:

Step 1(Base step): It proves that a statement is true for the initial value.
th
Step 2(Inductive step): It proves that if the statement is true for the n iteration (or
th
number n), then it is also true for (n+1) iteration ( or number n+1).

How to Do It
Step 1: Consider an initial value for which the statement is true. It is to be shown that
the statement is true for n=initial value.

Step 2: Assume the statement is true for any value of n=k. Then prove the statement is
true for n=k+1. We actually break n=k+1 into two parts, one part is n=k (which is
already proved) and try to prove the other part.

Problem 1
n
3 -1 is a multiple of 2 for n=1, 2, ...

Solution
1
Step 1: For n=1, 3 -1 = 3-1 = 2 which is a multiple of 2
n k
Step 2: Let us assume 3 -1 is true for n=k, Hence, 3 -1 is true (It is an
k+1
assumption) We have to prove that 3 -1 is also a multiple of 2
k+1 k k k
3 – 1 = 3 × 3 – 1 = (2 × 3 ) + (3 –1)
k k
The first part (2×3 ) is certain to be a multiple of 2 and the second part (3 -1) is also
true as our previous assumption.
k+1
Hence, 3 – 1 is a multiple of 2.
n
So, it is proved that 3 – 1 is a multiple of 2.

Problem 2
2
1 + 3 + 5 + ... + (2n-1) = n for n=1, 2, ...

48
Discrete Mathematics

Solution
2
Step 1: For n=1, 1 = 1 , Hence, step 1 is satisfied.
Step 2: Let us assume the statement is true for n=k.
2
Hence, 1 + 3 + 5 + ... + (2k-1) = k is true (It is an assumption)
2
We have to prove that 1 + 3 + 5 + ... + (2(k+1)-1) = (k+1) also
holds 1 + 3 + 5 + ... + (2(k+1) – 1)
= 1 + 3 + 5 + ... + (2k+2 – 1)
= 1 + 3 + 5 + ... + (2k + 1)
= 1 + 3 + 5 + ... + (2k – 1) + (2k + 1)
2
= k + (2k + 1)
2
= (k + 1)
2
So, 1 + 3 + 5 + ... + (2(k+1) – 1) = (k+1) hold which satisfies the step
2
2. Hence, 1 + 3 + 5 + ... + (2n – 1) = n is proved.

Problem 3
n n n
Prove that (ab) = a b is true for every natural number n

Solution
1 1 1
Step 1: For n=1, (ab) = a b = ab, Hence, step 1 is satisfied.
k k k
Step 2: Let us assume the statement is true for n=k, Hence, (ab) = a b is true (It is
an assumption).
k+1 k+1 k+1
We have to prove that (ab) =a b also hold
k k k
Given, (ab) = a b
k k k
Or, (ab) (ab)= (a b ) (ab) [Multiplying both side by ‘ab’]
k+1 k k
Or, (ab) = (aa ) ( bb )
k+1
Or, (ab) = (ak+1bk+1)
Hence, step 2 is proved.
n n n
So, (ab) = a b is true for every natural number n.

Strong Induction
Strong Induction is another form of mathematical induction. Through this induction
technique, we can prove that a propositional function, P(n) is true for all positive
integers, n, using the following steps:

  Step 1(Base step): It proves that the initial proposition P(1) true.

  
Step 2(Inductive step): It proves that the conditional statement
[ (1) ⋀ (2) ⋀ (3) ⋀ … … … … ⋀ ( )] → ( + 1) is true for positive integers k.

49
13. RECURRENCE RELATIONDiscrete Mathematics

In this chapter, we will discuss how recursive techniques can derive sequences and be
used for solving counting problems. The procedure for finding the terms of a sequence in
a recursive manner is called recurrence relation. We study the theory of linear
recurrence relations and their solutions. Finally, we introduce generating functions for
solving recurrence relations.

Definition
A recurrence relation is an equation that recursively defines a sequence where the next
term is a function of the previous terms (Expressing F n as some combination of Fi with
i<n).

Example: Fibonacci series: Fn = Fn-1 + Fn-2, Tower of Hanoi: Fn = 2Fn-1 + 1

Linear Recurrence Relations


A linear recurrence equation of degree k is a recurrence equation which is in the format
xn= A1 xn-1+ A2 xn-1+ A3 xn-1+... Ak xn-k (An is a constant and Ak≠0) on a sequence of
numbers as a first-degree polynomial.

These are some examples of linear recurrence equations:

Recurrence Initial values Solutions


relations
Fn = Fn-1 + Fn-2 a1=a2=1 Fibonacci number
Fn = Fn-1 + Fn-2 a1=1, a2=3 Lucas number
Fn = Fn-2 + Fn-3 a1=a2=a3=1 Padovan sequence
Fn = 2Fn-1 + Fn-2 a1=0, a2=1 Pell number

How to solve linear recurrence relation


Suppose, a two ordered linear recurrence relation is: F n = AFn-1 +BFn-2 where A and B are
real numbers.

The characteristic equation for the above recurrence relation is:


2
x − Ax − B = 0
Three cases may occur while finding the roots:
Case 1: If this equation factors as (x- x1)(x- x1) = 0 and it produces two distinct real
n n
roots x1 and x2, then Fn = ax1 + bx2 is the solution. [Here, a and b are constants]
2
Case 2: If this equation factors as (x- x1) = 0 and it produces single real root x1, then
n n
Fn = a x1 + bn x1 is the solution.
Case 3: If the equation produces two distinct real roots x1 and x2 in polar form x1 = r ∠ θ and x2 = r ∠(- θ), then Fn = rn (a cos(nθ)+ b sin(nθ)) is
the solution.
50
Discrete Mathematics

Problem 1
Solve the recurrence relation Fn = 5Fn-1 - 6Fn-2 where F0 = 1 and F1 = 4

Solution
The characteristic equation of the recurrence relation is:
2
x – 5x + 6=0,
So, (x-3) (x-2) = 0

Hence, the roots are:


x1 = 3 and x2= 2

The roots are real and distinct. So, this is in the form of case 1
Hence, the solution is:
n n
Fn = ax1 + bx2

n n
Here, Fn = a3 + b2 (As x1 = 3 and x2=
2) Therefore,
0 0
1=F0 = a3 + b2 = a+b
1 1
4=F1 = a3 + b2 = 3a+2b
Solving these two equations, we get a = 2 and b = -1
Hence, the final solution is:
n n n n
Fn = 2.3 + (-1) . 2 = 2.3 - 2

Problem 2
Solve the recurrence relation Fn = 10Fn-1 - 25Fn-2 where F0 = 3 and F1 = 17

Solution
The characteristic equation of the recurrence relation is:
2
x –10x -25 =0,
2
So, (x – 5) = 0
Hence, there is single real root x1 = 5
As there is single real valued root, this is in the form of case
2 Hence, the solution is:
n n
Fn = ax1 + bnx1
0 0
3 = F0= a.5 + b.0.5 = a
1 1
17 = F1= a.5 + b.1.5 = 5a+5b
Solving these two equations, we get a = 3 and b = 2/5

51
Discrete Mathematics

Hence, the final solution is:


n n
Fn = 3.5 + (2/5) .n.2

Problem 3
Solve the recurrence relation Fn = 2Fn-1 - 2Fn-2 where F0 = 1 and F1 = 3

Solution
The characteristic equation of the recurrence relation is:
2
x –2x -2 =0
Hence, the roots are:
x1 = 1+ i and x2= 1- i
In polar form,
x1 =r∠θ and x2 = r ∠(- θ), where r= √2 and θ= π / 4

The roots are imaginary. So, this is in the form of case 3.


Hence, the solution is:
n
Fn = (√2 ) (a cos(n. π / 4) + b sin(n. π / 4))
0
1 = F0 = (√2 ) (a cos(0. π / 4) + b sin(0. π / 4) ) = a
1
3 = F1 = (√2 ) (a cos(1. π / 4) + b sin(1. π / 4) ) = √2 ( a/√2 +
b/√2) Solving these two equations we get a = 1 and b = 2
Hence, the final solution is:
n
Fn = (√2 ) (cos(n. π / 4)+ 2 sin(n. π / 4))

Particular Solutions
A recurrence relation is called non-homogeneous if it is in the form
Fn = AFn–1 + BFn-2 + F(n) where F(n) ≠ 0
The solution (an) of a non-homogeneous recurrence relation has two parts. First part is
the solution (ah) of the associated homogeneous recurrence relation and the second part
is the particular solution (at). So, an= ah + at
n
Let F(n) = cx and x1 and x2 are the roots of the characteristic equation:
2
x = Ax+ B which is the characteristic equation of the associated homogeneous
recurrence relation:
  If x ≠ x1 and x ≠ x2, then at = Ax
n

  If x = x1, x ≠ x2, then at = Anx


n
 2 n
If x= x1 = x2, then at = An x

52
Discrete Mathematics

Problem
n
Solve the recurrence relation Fn = 3Fn-1 +10Fn-2 +7.5 where F0 = 4 and F1 = 3

Solution
The characteristic equation is:
2
x –3x -10 =0
Or, (x - 5)(x + 2) = 0
Or, x1= 5 and x2= -2
Since, x= x1 and x ≠ x2, the solution is:
n n
at = Anx = An5
After putting the solution into the non-homogeneous relation, we get:
n n-1 n-2 n
An5 = 3A(n – 1)5 + 10A(n – 2)5 + 7.5
n-2
Dividing both sides by 5 , we get:
2 0 2
An5 = 3A(n – 1)5 + 10A(n – 2)5 + 7.5
Or, 25An = 15An – 15A + 10An – 20A + 175
Or, 35A = 175
Or, A=5
n+1
So, Fn = n5
Hence, the solution is:
n+1 n n
Fn = n5 + 6.(-2) -2.5

Generating Functions
Generating Functions represents sequences where each term of a sequence is
expressed as a coefficient of a variable x in a formal power series.
Mathematically, for an infinite sequence, say 0, 1, 2, … … … … , , … … …, the generating function will be:

= 0+ 1 + 2 2 +………+ + ………= ∑
=0

Some Areas of Application:


Generating functions can be used for the following purposes:

For solving a variety of counting problems. For example, the number of ways to
make change for a Rs. 100  note with the notes of denominations Rs.1, Rs.2,
Rs.5, Rs.10, Rs.20 and Rs.50
  
For solving recurrence relations
  
For proving some of the combinatorial identities
 
For finding asymptotic formulae for terms of sequences

53
Discrete Mathematics

Problem 1
What are the generating functions for the sequences { } with = 2 and =3 ?

Solution
When = 2, generating function, G(x) = ∑∞ =0 2 = 2 + 2 + 2 2 + 2 3 + … … …
When = 3 , G( ) = ∑∞ =0 3 = 0 + 3 + 6 2 + 9 3 + … … …

Problem 2
What is the generating function of the infinite series; 1, 1, 1, 1, ……….?

Solution
Here, = 1, 0≤ ≤ ∞.
1
Hence, G(x) = 1 + + 2 + 3 + … … … = (1−
)

Some Useful Generating Functions


 For = , G( ) = ∑ =0∞ = 1 + + 2 2 + … … … = 1⁄
(1 − )

1
 For = ( + 1), G( ) = ∑∞ ( + 1) = 1 + 2 + 3 2 + … … … =
=
0 2
(1− )
 For = , G( ) = ∑∞ = 1 ++ 2 + … … … + 2 = (1 + )
=0 1 2
1 2 3
 For = , G( ) = ∑∞ =1+ + + ………=
3
! =0 ! 2! !

You might also like