Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Discrete Maths Lecture Note (Chapter 1-3)

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

cc B Casic cAounting principle

AMBO UNIVERSITY WOLISO CAMPUS


Course Title: Discrete Mathematics and Combinatory
Course Code: Math 2051
Credit Hours : 3 contact hrs
Course Category: Compulsory

Chapter One
1. Elementary Counting Principles
1.1 Basic counting principles
1. The sum rule
If the first task can be done in n1 ways the second task in n2 ways and if the tasks can not be
done in the same time, then there are n1 + n2 ways to do either task.

Example: - A student can choose a mathematics project from a set theory (23 topics) and a
number theory (29 topics)how many possible projects are there to choose from?

Solution: The student can choose a project by selecting a project from the first list, the second
list, or the third list. Because no project is on more than one list, by the sum rule there are
23 + 15 + 19 = 57 ways to choose a project

Generalized sum rule:- Assume that there are n1 ways to perform T1


n2 ways to perform T2
......
nk ways to perform Tk
if the tasks are pair wise disjoint, then the number of ways for at least one of the tasks to occur is

= n1 + n2 +… + nk

An equivalent form of sum rule using set theory terminology is given let A1, A2, …., Ak be any
finite pair wise disjoint sets, then
| | =

Example:-one can reach city B from city A by bus, train, air or by road(feet) suppose that there
are 2 ways by bus, 3 ways by train,4 ways by air and 5 ways by road(feet) then, How many ways
are there to reach from city A to B?
2. The product rule
Suppose that a procedure can be broken down into two tasks if there are n1 ways to do the first
task n2 ways to do the second task after the first task can be done then there are n1 x n2 ways to
do the procedure.

1
Example: The chair of a library is to be labeled with a capital letter and a positive integer not
exceeding 100. What is the largest number of chair that can be labeled differently?
Solution: The procedure of labeling a chair consists of two tasks, namely, assigning to the seat
one of the 26 uppercase English letters, and then assigning to it one of the 100 possible integers.
The product rule shows that there are 26 · 100 = 2600 different ways that a chair can be labeled.
Therefore, the largest number of chairs that can be labeled differently is 2600

Exercise: There are 32 microcomputers in a computer center each micro computer has 24 ports.
How many different ports to a microcomputer in the center are there?

Generalized product rule: Assume that a task can be decomposed in to r say T 1, T2, ….Tr and
there are n1 ways for T1 to occur, n2 ways for T2 to occur.... nr ways for Tr to occur the total
number of ways for the task to occur is given by n1 x n2 x …….x nr =

Example: How many bit string are there of length 7?


Example: How many different license plates are available if each plate contains a sequence of
three letters followed by three digits?
NOTE: An equivalent product rule using set theory terminology
= A1 x A2 x ….x Ar = (a1, a2, …. ar ) / ai Ai , i = 1, 2, ….., r

Exercise: There are 2 ways to travel from city A to city B, 5 ways from city B to C and 3 ways
from city C to D. what is the number of ways to go from city A to D via B and C?

Problems which uses both rules:

Example: In version of the computer language BASIC the name of the variable is a string of one
or two alpha numeric character more over the variable name must begin with a letter and must be
different from the 5 strings of two characters that are reserved for programming use. how many
variable name are there in the version of BASIC?
Example: Each users in a computer system has a password which is 6 to 8 characters long where
each character is an upper case letter or a digit. Each password must contain at least one digit.
how many possible passwords are there?
Example:- How many integers are there between 0 and 1000 that have one or more 6's as
digits?
Exercise:- How many odd integers are there between 100 and 1000.

2
1.2 The inclusion -Exclusion principle
when two tasks A and B can be done at the same time we cannot use sum rule to count the
number of ways to do one of the tasks, so the number of ways to do one of the two tasks obtained
by adding the number of ways to do each tasks and then subtract the number of ways to do both
tasks.

i.e | A B| = |A| + |B| - |A B|

Example: How many bit string of length 8 either starts with the 1's or ends with the two zeros?
Example: A discrete mathematics class contains 25 students majoring in CS, 13 in maths and 8
in both. How many students are in this class if every student is majoring in maths, CS or both?

Generalized Inclusion-Exclusion Principle


Let A1, A2, . . . An be finite sets, then
|A1 A2 |=
| |

Ayele B E
Example: A total of 1232 students have taken a course in Spanish 879 have taken a course in
French and 114 have taken a course in Russian. Further 103 have taken course both in Spanish
and French 23 have taken course both in Spanish and Russian and 14 have taken course both in
Russian and French. if 2093 have taken at least one of Spanish, French and Russian, how many
students have taken a course in all the languages?

Example: Let u be the set of positive integers not exceeding 1000 then | U| = 1000 find |S| where
S is the set of such integers which are not divisible by 3,5 or 7?
The Three diagram
we use a branch to represent each possible choice. we represent the possible outcomes by leaves
(which are the end point of branches not having other branches starting on them.)
Example: how many bit strings of length four which doesn't have two consecutive 1's?

1.3 pigeon hole principle

If n pigeonholes are occupied by n + 1 or more pigeons then atleast one pigeonhole is occupied
by more than one pigeon.
Example: Suppose a department contains 14 professors then two of the professors (pigeon)
where born in the same month(pigeonholes).
Example: Find the minimum number of elements that one need to take from the set
S = {1, 2, 3,…9 } to be sure that two of the number add up to 10?

Theorem (The generalized pigeonholes principle):

If N objects are placed in to k boxes, then there is at least one box containing at least [N / K]
Objects.

3
Note: Generalized pigeonhole principle:-if n pigeonholes are Occupied by k + 1 or more
pigeons, where k at least one pigeonhole is occupies by k + 1 or more pigeons.

Example: Find the minimum number of students in a class to be sure that three of them are born
in the same month?

Example:
1. Find the least number of cables required to connect eight computers to four printers to
guarantee that for every choice of four of the eight computers, these four computers can directly
access four different printers.

2. Find the minimum number of students needed to guarantee that 5 of them belong to the same
class (freshman, sophomore, junior, senior)?
Exercise:
1. Find the minimum number of elements that one need to take from the set S = {1, 2, 3, ….. 8}
to be sure that two of the number add up to 9?

2.Find the least number of cables required to connect 100 computers to 20 printers to guarantee
that for every choice of 20 of the 100 computers, these 20 computers can directly access 20
different printers.
A
1.4 Permutations and Combinations

1.4.1 Permutation
Permutation of a set of distinct objects is an ordered arrangement of these objects. An ordered
arrangement of r-objects of a set is called an r-permutation
Example: Let S = {1, 2, 3}. The arrangement {3, 1, 2 } is a 3-permutation of S. The arrangement
{3, 2} is a 2-permutation of S.

Theorem: The number of r-permutations of a set with n-distinct element is


n x (n -1) x . . . x (n - r +1) =

Proof:
There are n , ways to choose the first element
There are (n -1), ways to choose the second element
...
There are (n - r + 1), ways to choose the element.
so by PR there are n x(n – 1) x …x (n - r + 1) r-permutation.

4
Example:
1. Suppose there are 8 runners in a race. how many different ways are there to award the gold,
silver and bronze medal if all possible outcomes of the race can occur?
2. How many ways can a president, vice-president and secretary be selected from a committee of
seven people?
3. Suppose that a sales women has to visit eight different cities. she must begin her trip in a
specific city, but she can visit the other in any order she wishes. How many possible orders can
the sales women use when visiting these cities?

Permutations with repetitions:


P(n; n1; n2, . . ., nr = ) the number of permutations of n-objects of which n1 are
alike, n2 are alike, . . . nr are alike(indistinguishable).

Example: Find the number of seven letter word that can be formed using the letter of the word
"BENZENE"
Ordered sample:
Choose one element after another r-times we call the choice an ordered sample of size r.
1. Sample with replacement:
n x n x …. x n = , choose r objects from n objects. When repetition allowed.
2. Sample without replacement:
= choose r objects from n objects when repetition allowed.

Example: Three cards are chosen one after the other from 52-card deck. Find the number m of
ways this can be done.
a) With replacement
b) Without replacement

1.4.2 Combination:
An r-combination of elements of a set is an unordered collection of r-elements from a set.
Example: C(4; 2) = 6 since 2-combination of {a, b, c, d } are the six subsets {a, b } , {a, c} ,
{a, d }, {b , c}, {b, d}, {c, d}

Theorem: The number of r-combination of a set with n - elements, where n ,r and


0 equals C ( n, r ) . Sometimes called binomial coefficient

Proof : ( Exercise)

5
Corollary: let n, r with r n , then C(n, r ) = C(n, n - r ).

Proof: C (n, r ) = = = C(n, n - r )


Example:
1. Find the number of different subsets of size 3 in the set {m, a, t, h, r , o, c, k, s}
2. How many ways are there to select a committee to develop a discrete mathematics course if
the committee is to consists of three members of math’s department and four members of CS. If
there are nine members in MD and eleven in CSD?

Combinations with repetitions:

Theorem: There are C(n+r-1, r) r-combinations from a set with n-elements when repetitions of
elements is allowed.

Example:
1.Suppose that a cookie shop has four different kinds of cookies. How many different ways can
six cookies be chosen? Assume that only the type of cookies and not the individual cookies or
the order in which they are chosen matters.

2. How many solutions does the equation x1 + x2 + x3 = 11 have where x1, x2 and x3 are non-
negative integers?
3. How many ways can you solve k1 + k2 + k3 + k4 = 18 provided that k1, k2, k3, k4 are integers
and k1, k2 0, k3 3k4 2?

Type Repetition allowed Formula


r - permutation no

r - combination no

r - permutation yes

r - combination yes C( n +r -1, r)

6
Note:
1. Distributing n identical objects in to k distinct sets is
C(n + k – 1, k - 1)
2. The number of ways n-distinct elements can be assigned to n cells so that exactly one cell is
empty is n! C(n, 2)
Example: A data set contains 500 observations. Analysis of the data is carried out by three
programs that together process the 500 observations such that each program processes at least
100 observations. If the partition of the 500 observations for use by the three programs is done
by arbitrarily choosing the observation for each program. In how many ways can the data be
processed?

Example: The number of ways 5 elements a, b, c, d, e can be assigned to three cells so that
exactly 1 cell is empty.

1.5 The binomial Theorem


A
Binomial coefficients
Theorem (Pascal’s identity)
let n and k be positive integers with n k then C(n + 1, k) = C(n, k - 1) + C(n, k) the in
the Pascal’s triangle consists of the binomial coefficients

1 1
1 2 1
1 3 3 1
1 4 6 4 1
….. …..

This figure here above is called Pascal’s Triangle.

Theorem:
Let n be a positive integer, then =
Proof:
A set with n elements has a total of subsets each subsets have either 0,1,2,...,n elements in it
there are C(n,0) subsets with zero element
C (n,1) subsets with zero element
C (n, 2) subsets with zero element
...
C (n, n) subsets with zero element
Since the elements are disjoint by sum rule =
7
Theorem: Vandermonde’s identity: let m, n and r be non negative integers with r
not exceeding either m or n. Then

Corollary: If n is positive integer, then

Proof: we use vandermonde’s identity.

= since ,

Note:
The binomial theorem gives the coefficients of the expansion of power of binomial expression i.e
x+y

The Binomial Theorem

Theorem: Let x and y be variables, and let n be a nonnegative integer. Then

= .
Where k = 0,1,...,n

Example1: What is the expansion of ?

Solution : From the Binomial theorem

= .

2. What is the coefficient of in the expansion of ?

8
Chapter two
2: Elementary probability Theory
2.1 sample space and events
Some basic terminologies
 An experiment :- is any process or an activity that generates a set of
possible outcomes.
 A sample space(S):- is a set that contains all possible outcomes of an
experiment .
 An Event(E) :- is any subset of a sample space.

2.2 Probability of an event


Definition:- If S is a finite nonempty sample space of equally likely outcomes, and
E is an event, that is, a subset of S, then the probability of E is p(E) = .
Example1 : What is the probability that when two dice are rolled, the sum of the
numbers on the two dice is 7?
Solution: There are a total of 36 equally likely possible outcomes when two dice
are rolled. And there are six successful outcomes namely,
(1,6),(2,5),(3,4),(4,3),(5,2) and (6,1).

p(E) = = =
Example2: A bag contains four blue balls and five red balls. What is the
probability that a ball chosen at random from the bag is blue?

Solution: There are nine possible outcomes, and four of these possible outcomes
produce a blue ball. That is p(E) = = . Hence, the probability that a blue

ball is chosen is .

2.2.1 probabilities of complements and union of events.

We can use counting techniques to find the probability of events derived from
other events.
Theorem : Let E be an event in a sample space S. The probability of the event
= S − E, the complementary event of E, is given by p( ) = 1 − p(E).

Proof: To find the probability of the event = S – E , note that | | = |S| − |E|.
Hence p( ) = = = 1 − p(E)

9
Example: A fair die is rolled. What is the probability that a face comes up is odd?
Solution: let S be the set of all possible outcomes. That is S = { 1, 2, 3, 4, 5, 6}
And let E be the set of the event that the number comes up is odd .That is
E = {1,3,5}. Then is the event that the number comes up is Even.

Thus, p( ) = = = 1 − p(E) = =
Hence, the probability that the face comes up odd is 0.5.

probability of the union of two events

Theorem: Let E1 and E2 be events in the sample space S. Then


P(E1 or E2) = P(E1 = P(E1) +P(E2) – P(E1 .

Proof : Using inclusion –exclusion principle


|E1 E2| = |E1| + |E2| − |E1 ∩ E2|.

Hence P(E1 = =

P(E1 = P(E1) +P(E2) - P(E1 .

Example: What is the probability that a positive integer selected at random from
the set of positive integers not exceeding 100 is divisible by either 2 or 5?
(exercise)

Remark: According to the definition of probability, the probability of an event can


never be negative or more than one. That is , 0
Assigning probabilities
when there are n possible outcomes, x1, x2, x3, x4, … xn, then the following two
conditions be met.

i. 0 for i = 1,2,..,n
ii.

10
Theorem: If E1,E2,E3,….is a sequence of pairwise disjoint events in a sample
space S, then

P i = 1, 2, ……

2.3 Conditional probability

Definition: Let E and F be two events with P(F) > 0 . The conditional probability
of E given F is denoted by P(E F), is defined as

P(E F) = .
Example: What is the conditional probability that a family with two children has
two boys, given they have at least one boy?

Solution: Let E be the event that a family with two children has two boys, and let
F be the event that a family with two children has at least one boy. It follows that
E = {BB}, F = {BB, BG, GB}, and E ∩ F = {BB}. Because the four possibilities
are equally likely, it follows that p(F) = 3/4 and p(E ∩ F) = 1/4.We conclude that

P(E F) = =

Exercise: A bit string of length four is generated at random so that each of the 16
bit strings of length four is equally likely. What is the probability that it contains at
least two consecutive 0s, given that its first bit is a 0?

2.4 Independent Events

Definition: The events E and F are independent if and only if p(E ∩ F) = p(E)p(F).

Example: Are the events E, that a family with three children has children of both
sexes, and F, that this family has at most one boy, independent? Assume that the
eight ways a family can have three children are equally likely.

Solution: By assumption, each of the eight ways a family can have three children,
BBB, BBG, BGB, BGG, GBB, GBG, GGB, and GGG, has a probability of 1/8.
Because E = {BBG, BGB, BGG, GBB, GBG, GGB}, F = {BGG, GBG, GGB,
GGG}, and E ∩ F = {BGG, GBG, GGB}, it follows that p(E) = 6/8 = 3/4,

11
p(F) = 4/8 = 1/2, and
p(E ∩ F) = . Because P(E) P(F) = . = . It follows that
p(E ∩ F) = p(E)p(F), so E and F are independent.

We can also define the independence of more than two events.

Definition: The events E1, E2, . . . , En are pairwise independent if and only if
p(Ei ∩ Ej ) = p(Ei) p(Ej ) for all pairs of integers i and j with 1 ≤ i < j ≤ n. These
events are mutually independent if p(Ei1 ∩ Ei2 ∩ ・・ ∩ Eim) = p(Ei1)p(Ei2 ) ・
・ p(Eim) whenever ij, j = 1, 2, . . . , m, are integers with 1 ≤ i1 < i2 < ・ ・ ・ <
im ≤ n and m ≥ 2.

2.5 Random variables and expectation

2.5.1 Random variables

Definition : A random variable is a function from the sample space of an


experiment to the set of real numbers. That is, a random variable assigns a real
number to each possible outcome.

Example1 : Suppose that a coin is thrown three times. Let X(t) be the random
variable that equals the number of heads that appear when t is the outcome. Then
X(t) takes on the following values:

X(HHH) = 3,
X(HHT ) = X(HTH ) = X(THH ) = 2,
X(TTH ) = X(THT ) = X(HTT ) = 1,
X(TTT ) = 0.

Definition: The distribution of a random variable X on a sample space S is the set


of pairs (r, p(X = r)) for all r X(S), where p(X = r) is the probability that X takes
the value r. (The set of pairs in this distribution is determined by the probabilities
p(X = r) for r X(S).

Example2 : Each of the eight possible outcomes when a fair coin is thrown three
times has probability 1/8. So, the distribution of the random variable X(t) in
Example 1 is determined by the probabilities P(X = 3) = 1/8, P(X = 2) = 3/8,

12
P(X = 1) = 3/8, and P(X = 0) = 1/8. Consequently, the distribution of X(t) in
Example 1 is the set of pairs (3, 1/8), (2, 3/8), (1, 3/8), and ( 0, 1/8).

2.5.2 Expected Value

Definition: The expected value, also called the expectation or mean, of the random
variable X on the sample space S is equal to

Mean = E(X) =

Expected Value of a Die : Let X be the number that comes up when a fair die is
rolled. What is the expected value of X?
Solution: The random variable X takes the values 1, 2, 3, 4, 5, or 6, each with
probability 1/6. It follows that

E(X) = = 1.1/6 + 2.1/6 + 3.1/6 + 4.1/6 + 5.1/6 +6.1/6


= 21/6
= 7/2

2. A fair coin is thrown three times. Let S be the sample space of the eight possible
outcomes, and let X be the random variable that assigns to an outcome the number
of heads in this outcome. What is the expected value of X?
.Solution : when a coin is thrown three times. Because the coin is fair and the flips
are independent, the probability of each outcome is 1/8. Consequently,

E(X) = [X(HHH) + X(HHT) + X(HTH) + X(THH) + X(TTH)+X(THT) + X(HTT) + X(TTT)]


= (3+2+2+2+1+1+1+0)
=
=
.
Consequently, the expected number of heads that come up when a fair coin is
flipped three times is .

13
Chapter three
3. Recurrence Relations
3.1 Definition and examples

Definition: A recurrence relation for the sequence {an} is an equation that expresses an in-terms
of one or more of the previous terms of the sequence a0, a1, a2, … an-1 for all n Z with
n n0 where n0 .
A sequence is the solution of the recurrence relation if its terms satisfy the recurrence relation.

Example: Let {an} be a sequence that satisfy the recurrence relation = for
n = 2, 3, 4, … and suppose that a0 = 3 and a1 = 5. what are the values of a2 and a3?

Modeling with recurrence relations


Example: Suppose a person deposits 10; 000 birr in a saving account at a bank yielding 7
present per year with interest compounded annually how much will be in the account after 10
years?
Example: A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does
not bread until they are 2 months old. After they are 2 months old each pair of rabbits produces
another pair each month. Find the recurrence relation for the number of pair of rabbits on the
island after n-months. Assuming that no rabbits ever die.

Example: A computer system considers a string of decimal digits a valid codeword if it contains
an even number of 0 as digits. Find the formula for a valid n-digit cod words?

Definition: A linear k-order recurrence relation with constant Coefficients is a recurrence


relation of the form c1, c2, c3……..ck are
constants where Ck 0 and f (n) is a function of n.

Note:
 Linear:-there are no power or product of
 Constant coefficient:- C1, C2, C3, …..Ck doesn't depends on n.
 if f (n) = 0 the recurrence relation is homogeneous otherwise non-homogeneous.

14
Example:

recurrence relation order homoginity linearity coefficient

3.2 Elementary solution techniques

A sequence: is the solution of the recurrence relation if its terms satisfy the recurrence relation
Example: Determine whether the sequence {a n} is a solution of the recurrence relation
for n = 2, 3, 4, …. For all n

a. 3n
b. =
c. =5R

3.3 Solutions of Homogeneous and non-homogeneous Recurrence Relation

A. Solutions of Linear homogeneous recurrence relation with constant coefficient

we are looking solution of the form


Linear homogeneous recurrence relation with constant coefficient is given by

………(1)

= ( dividing both sides by

……..(2)

equation (2) is called the Characteristics equation of the recurrence relation in equation (1).
the solution of the characteristics equation is called Characteristics root of the recurrence
relation.

Theorem : Let C1 ,C2, ..., Ck be real numbers, suppose that the characteristics equation
has t-distinct roots r1, r2,...,rt with multiplicity
m1 + m2 +… + mt = k. Then the sequence {an} is a solution of the recurrence relation
if and only if

15
for n = 0,1,2, … where are constants for 1
and 0

Example: suppose the characteristics roots of the recurrence relation are 2, 2, 2, 5, 5, 9. what
is the form of the general solution?

Example: What is the solution of the recurrence relation


a. = -2 with initial condition a0 = 3
b. = with Initial Condition a0 = 2 a1 = 7
c. = with the initial condition a0 = 1 and a1 = 6
d +2 +2 = 0

Example: Find the closed form of with the initial condition


a0 = 1, a1 = -2 and a2 = 1

Exercise: Find the closed form of


a. = with initial conditions a0 = 1, a1 = 3
b. = with initial conditions a0 = 1, a1 = 3, a2 = 5
c. with initial conditions a0 = 1 , a1 = 4

B. Solutions of non-homogeneous recurrence relation

Definition: A linear non-homogeneous recurrence relation with constant coefficients is of the


form

where …..(1) with c1, c2, c3, …, ck


be real numbers is the associated homogeneous
recurrence relation of equation (1).

Example :

Non homogeneous RR Associated homogeneous RR


= + =
= =
= =

16
Theorem 5: Suppose that {an} satisfies the linear non-homogeneous recurrence relation
+ f (n) and
f(n) = ) where

 when s is not the root of the characteristics equation of the associated homogeneous
recurrence relation then the particular solution is (
)

 when s is the root of the characteristics equation of the associated homogeneous


recurrence relation with multiplicity m, then the particular solution is

AyExample : What is the particular solution form for

a. f(n) =
b. f(n) =
c. f(n) =
d. f(n) =

Theorem : If { } is a particular solution of the non homogeneous linear recurrence relation


with constant coefficients + f (n) then the solution of the
form { where is the particular solution and is the solution of the
associated homogeneous recurrence relation .

Example: Find the solutions of the recurrence relation


a = with initial condition a1 = 3

b =

Example: Let be the sum of the first n-positive integers, so that which is the
same as

Exercise: Find the solution of

a = with initial condition a0 = 2

b. =

17
3.4 Solution of Recurrence Relation Using Generation function
Definition: Let S = { a0, a1, a2 , ….} be an infinite sequence of real numbers, then the
generating function G(x) of S is the power series G(x) = .

Example:
 S = { 1, 1, 1, … } =

 S = { 0, 1, 2, …. }

 S = { 1, 1, 1, … } = 1+x+x2

For two generating function F(x) = and G(x) = . Then

The sum is F(x) + G(x) =

The product is F(x) . G(x) = = )

For solving Recurrence relation: We use the following generating function if G(x) =

then x G(x) = = = and

G(x) = =

Example: Solve the following recurrence relation using Generating function


1. = with initial condition a0 = 0

2. with initial condition and =9

Exercise: Solve the following recurrence relation using Generating function

1. = with initial condition = =1


2. with initial condition =
3. = with initial condition = and =

18
19

You might also like