0% found this document useful (0 votes)
65 views60 pages

Discrete Math

There are 3 ways to choose the top bread, 7 ways to choose the meat, 4 ways to choose the vegetable, and 3 ways to choose the bottom bread. By the rule of product, there are 3 × 7 × 4 × 3 = 252 ways to make the sandwich.

Uploaded by

Marco Yvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views60 pages

Discrete Math

There are 3 ways to choose the top bread, 7 ways to choose the meat, 4 ways to choose the vegetable, and 3 ways to choose the bottom bread. By the rule of product, there are 3 × 7 × 4 × 3 = 252 ways to make the sandwich.

Uploaded by

Marco Yvan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Matrices

• A rectangular array of numbers. A matrix with m rows and n columns


is called mxn matrix
𝑚11 𝑚12
0 1 0
𝑀3𝑥2 = [𝑚21 𝑚22] 𝑁 =[ ]
2 4 3
𝑚31 𝑚32
Dimension 2x3
Row

Element
Column
Matrix Addition (and Subtraction)
• Matrices of the same size can be added by finding the sum of
elements of the same address.
1 2 4 5 7 8 9
A2x2 = [ ] B2x2= [ ] C2x3 = [ ]
3 4 6 7 10 11 12

1 2 4 5 5 7
A+B= [ ] + [ ]= [ ]
3 4 6 7 9 11

1 2 4 5 −3 −3
A-B= [ ] - [ ]= [ ]
3 4 6 7 −3 −3
Matrix Multiplication
• Matrices M and N can be multiplied if M is mxk matrix and N is a kxn
matrix. The resulting product matrix will be an mxn matrix
−1 3 4 3 −2
A2x2 = [ ] B2x3 = [ ]
4 −2 5 −1 0
−1 3 4 3 −2
AB = A2x2 ∙ B2x3 = [ ]∙[ ]=
4 −2 5 −1 0
1 2
−1 3 1 4 3 −2 −4 + 15 −3 + −3 2 + 0
=[ ]∙ [ ]=[ ]
4 −2 2 5 −1 0 16 + −10 12 + 2 −8 + 0
Matrix Multiplication
−1 3 4 3 −2
AB = A2x2 ∙ B2x3 = [ ]∙[ ]=
1 2
4 −2 5 −1 0

−1 3 1 4 3 −2 −4 + 15 −3 + −3 2 + 0
=[ ]∙ [ ]=[ ]
4 −2 2 5 −1 0 16 + −10 12 + 2 −8 + 0

11 −6 2
=[ ]
6 14 −8
Matrix Multiplication
−1 3 4 3 −2
A2x2 = [ ] B2x3 = [ ]
4 −2 5 −1 0

−1 3 4 3 −2
AB = A2x2 ∙ B2x3 = [ ]∙[ ]=
4 −2 5 −1 0
1 2 3

4 3 −2 1 −1 3
BA = B2x3 ∙ A2x2 = [ ]∙ [ ] = not possible
5 −1 0 2 4 −2
Example
0 1 −1 −2 8
Let A2x3 = [ ]and B2x2 = [ ]
4 −7 3 7 6

1. A - B 4. AB

2. BA 5. A2

3. B 2 6. B+B
Example
0 1 −1 −2 8
Let A = [ ] and B2x3 = [ ]
4 −7 3 7 6

1. A - B = not possible 4. AB = not possible

32 −58 −26
2. BA = 5. A2 = (AxA)= not possible
24 −35 11

2 60 32 −4 16
3. B = [ ] 6. 2B = [ ]
28 92 14 12
Identity Matrix A ∙ I = A
The identity matrix is a square matrix In = Symmetric ij where
Symmetric ij = 1 if i=j and Symmetric ij = 0 if i≠j. First diagonal is 1’s and
all other elements are 0.
2 1 3
Example: Find AI where A = [4 −2 7 ]
0 1 −1

2 1 3 1 0 0
Let A = [4 −2 7 ] ∙ [0 1 0] =
0 1 −1 0 0 1
Identity Matrix A ∙ I = A

2 1 3 1 0 0 2+0+0 0+1+0 0+0+3


Let A = [4 −2 7 ] ∙ [0 1 0] = [4 + 0 + 0 0−2+0 0 + 0 + 7]
0 1 −1 0 0 1 0+0+0 0+1+0 0+0−1

2 1 3
= [4 −2 7]
0 1 −1
Transpose Matrices
• The transpose of 𝐴𝑚𝑥𝑛 denoted At is the nxm matrix obtained by
interchanging rows and columns of A. If A = At the A is symmetric
4 0
A1= [5 1 ] Not Symmetric

7 −1

2 1 3 2 4 0
A = [4 −2 7 ] Symmetric At = [1 −2 1 ]
0 1 −1 3 7 −1
Determinant
Determinant of Matrix 1x1
A = [2] |A| = |2| = 2 (Determinant A)
B = [-1] |B| = |-1| = -1 (Determinant of B

Determinant of Matrix 2x2


𝑎 𝑏
X=[ ] |X| = ad - bc
𝑐 𝑑
1 2
C=[ ] |C| = (1 ∙ 3) - (2 ∙ -1) = 3 - (-2) = 5
−1 3
−1 3
• D=[ ] |D| = -1 ∙ -2) - (3 ∙ 4) = 2 - 12 = -10
4 −2
Determinant of Matrix 3x3
a b c
A = [d e f ]
g h i
e f d f d e
|A| = a| | - b| | + 𝐜| |
h i g i g h
|A| = a(ei - fh) - b(di - fg) + c(dh - eg)

Example #1:
1 1 −1
A=[ 2 4 3 ]
−2 1 0
= 1[(4 ∙ 0) - (3 ∙ 1)] - 1[(2 ∙ 0) - (3 ∙ -2)] + -1[(2 ∙ 1) - (4 ∙ -2)]
= -3 - 6 - 10 = -19
Exmple #2
1 2 3
A = [7 8 9]
2 6 9
=6
Decimal Expansions from Binary, Octal and
Hexadecimal
Let b∈Z and b>1. Then if n∈Z + it can be expresed uniquely in the form
n = ak bk + ak−1 bk−1 + ... + a1 b + a0
where k is a non-negative Integer, 𝑎0 , 𝑎1 . . . 𝑎𝑘 are non-negative
integers less than 𝑏1 and 𝑎𝑘 ≠ 0
Decimal, b = 10
Binary, b = 2
Octal, b = 8
Hexadecimal, b = 16
Example
Write the decimal expansion of 10, 456
10, 456 = 1 ∙ 104 + 0 ∙ 103 + 4∙ 102 + 5 ∙ 101 + 6 ∙ 100

Binary to Decimal Expansion


What is the decimal expansion that has 1011 11012 as its binary expansion?
1011 11012 = 1∙ 27 + 0∙ 26 + 1 ∙ 25 + 1∙ 24 + 1 ∙ 23 + 1 ∙ 22 + 0 ∙ 21 + 1 ∙ 20
= 1 ∙ 128 + 1 ∙ 32 + 1 ∙ 16 + 1 ∙ 8 + 1 ∙ 4 + 1 ∙ 1
= 18910
Octal to Decimal Expansion
• That is the decimal expansion of the number with an octal expansion
of 40728
40728 = 4 ∙ 83 + 0 ∙ 82 + 7 ∙ 81 + 2 ∙ 80
= 4 ∙ 512 + 0 ∙ 64 + 7 ∙ 8 + 2
= 2048 + 0 + 56 +2
= 210610
Hexadecimal to Decimal Expansion
What is the decimal expansion of the number with a hexadecimal
expansion of 2AE0B16
A = 10 B = 11 C = 12 D = 13 E = 14 F = 15

2AE0B16 = 2 ∙ 164 + 10 ∙ 163 + 14 ∙ 162 + 0 ∙ 161 + 11 ∙ 160


= 131072 + 40960 + 3584 + 0 + 11
= 175, 62710
Activity #1
1 3 5 10 20 5 10
• Let A = [ ], B=[ ], and C=[ ]
2 4 6 30 40 15 20

1. B - A 4. BA

2. CB 5. A2

3. B2 6. 2C
Activity #2
• Determinant of Matrix 3x3
1 3 5
•A=[7 9 11]
13 15 17
Activity #3
• Binary to Decimal
• 1010 0110 11112 =

• Octal to Decimal
• 14728

• Hexadecimal to Decimal
• A0B1C2D316
Decimal to Binary, Octal and Hexadecimal
• Decimal to Binary conversion
• To convert decimal to Binary, divide integer part by 2 and multiply
fractional part by 2.
Divisor Dividend Remainder

2 13 1
2 6 0
2 3 1
2 1 1
Bottom to Top
2 0 11012

Quotient
Examples
• 2510 = 11012 • 3410 =
2 25 1 2 34 0

2 12 0 2 17 1

2 6 0 2 8 0

2 3 1 2 4 0

2 1 1 2 2 0

0 2 1 1

0
Try to solve the following
1. 5710 = 1110012
2. 6310 = 1111112
3. 7110 = 10001112
4. 8510 = 10101012
5. 9210 = 10111002
Decimal to Binary, Octal and Hexadecimal
• Decimal to Octal conversion
• To convert decimal to Octal, divide integer part by 8 and multiply
fractional part by 8.
Divisor Dividend Remainder 11210 = 1608
8 112 0
8 14 6
8 1 1
0
Bottom to Top

1608
Quotient
Try to solve the following
1. 11210 =
2. 25410 =
3. 9810 =
4. 7810 =
5. 58710 =
Decimal to Binary, Octal and Hexadecimal
• Decimal to Hexadecimal conversion
• To convert decimal to Hexadecimal, divide integer part by 16 and
multiply fractional part by 16.
Divisor Dividend Remainder 25410 = 𝐸𝐹16
16 254 14
16 15 15
16 0 Bottom to Top

𝐸𝐹16
Quotient
Try to solve the following
1. 11210 = 7016
2. 25410 = 𝐹𝐸16
3. 9810 = 6216
4. 7810 = 4𝐸16
5. 58710 = 24𝐵16
Counting
• How many ways can you roll an even number on a die?
Answer: 3 (2, 4, 6)

• How many ways can you draw a face card in a standard 52-card deck?
Answer: 12 - (J, Q, K)
Addition Rule
• For two separate tasks A and B
If A can be done in m ways, and
B can be done in n ways,

Then A and B can be done in m+n ways.


• How many ways can you roll an even number on a die or draw a face
card?
A B
Die Card
2 ♣JQK
4 ♠JQK
6 ♥JQK
♦JQK

3 + 12 = 15
Rule of Product
• In subsequent task, A and B,
If there are m ways to do task A, and
n ways to do task B,

Then there are mn ways to do A and B.


Example
I want to make a sandwich with one thing from each category.
Top bread : White, whole wheat, sourdough - 3
Meat : Ham, bologna, pork, steak, salami, rabbit, human - 7
Vegetable : Lettuce, tomato, cucumbers, turnip - 4
Bottom bread : white, whole wheat, sourdough - 3

How many ways can I do that?


3x7x4x3 = 252 ways
• How many ways can we make a license plate with...
a) 3 even numbers and 3 letters?
02468
5x5x5x26x26x26 = 125 x 17,576 = 2,197,000 license plate

b) 2 numbers, 2 letters, 1 odd number, 1 even number and 2 vowels?


10x10x26x26x5x5x5x5 = 42,250,000 license plate
c) 6 letters that are not the same.
abcd
2 letters license plate
43

26x25x24x23x22x21 = 165,765,600 license plate


8 women and 5 men are elected for president.
a) How many ways to choose a winner?
8 + 5 = 13 ways

b) How many man vs woman pairs can we make?


5 x 8 = 40 ways

c) How many ways can we choose a president and a female vice


president?
(Male President x Female Vice) (Female President x Female Vice)
(5 x 8) + (8 x 7)
= 96 ways
Want to buy a sandwich.
3 types of bread
5 types of meat
6 types of cheese

a) How many ways to make 2 meat, 2 cheese sandwich?


3x5x5x6x6 = 2,700 combinations

b) How many ways to make a 3 meat, 2 cheese sandwich? (No repeat)


3 x (5x4x3) x(6x5) = 5,400 combination
Factorial
• if n ∈Z, then “n factorial” is denoted
n! = n x (n-1)x(n-2)x.....321

Examples
3! = 3x2x1 = 6
6! = 6x5x4x3x2x1 = 720
0! = 1
1! = 1
This still counts as a way of arranging it, so by definition, a zero factorial
is equal to one, just as 1! is equal to one because there is only a single
possible arrangement of this data set.
• How many ways can we write a list of 7 numbers (1,2,3,4,5,6,7)
without repeating any?
7 x 6 x 5 x 4 x 3 x 2 x 1 = 7! or 5040

• How many ways can we write a list of 7 numbers (1,2,3,4,5,6,7)


without repeating any? What if the first 3 numbers in the list must be
even?
246
3 x 2 x 1 x 4 x 3 x 2 x 1 = 3! x 4! or 144
Permutations
• The number of permutations of length k from a list of n elements
without repetition is
𝑛! 7! 7! 7x6x5x4x3x2x1
= = = = 840
(𝑛−𝑘)! (7−4)! 3! 3x2x1

• How many ways can we write a list of 4 numbers from (1,2,3,4,5,6,7)


without repeating any?
7 x 6 x 5 x 4 = 840
• How many ways can we order the letters in the word “BASKET”
6! = 720

• How many ways can we order the letters in the word “ERR”?
3! 6
= =3
1!𝑥2! 2

• How many ways can we order the letters in the word “MISSISSIPPI”?
11! 39,916,800
= = 34, 650 ways
1!2!4!4! 1152
Relation on Set
Let A and B be two sets. A binary relation R from A to B is a subset of
AxB
AxB = {(a,b) | a∈A and b∈B}
Usually we use the notation aRb to denote (a,b)∈R

Example: Let A = {1,2,3} and B = {0,1,2,4}


AXB = {(1,0), (1,1), (1,2), (1,4), (2,0), (2,1), (2,2), (2,4), (3,0), (3,1), (3,2),
(3,4)}
Types of Relations
1. Reflexive Relation:
A relation R on a set A is called reflexive if (a,a)∈R for every element
a∈A. In other words, ∀a((a, a)∈R).
Example: Let A = {1,2,3,4}
R1 = {(1,1), (1,2), (2,2), (2,3), (3,3), (4,4)}
Relation R1 is reflexive because it contains all ordered pairs of the form
(a,a) for every element a∈A ie., R1 has (1,1), (2,2), (3,3), (4,4)

R2 = {(1,1), (1,2), (2,1), (2,2), (3,1), (4,4)}


Relation R2 is not reflexive because the ordered pair (3,3) is not in R2
2. Irreflexive Relation:
A relation R on a set A is called irreflexive if ∀a∈A, (a,a)is not ∈ R.
Example: A = {1,2,3,4}
R3 = {(1,2), (2,1), (3,3), (4,4)} is not irreflexive because (3,3) and (4,4,) is
there in R3
R4 = {(1,2), (2,1)} is irreflexive because ∀a∈A, (a,a)is not ∈ R4.
3. Symmetric Relation:
A relation R on a set A is called symmetric if (b,a)∈R holds when
(a,b)∈R for all a,b∈A
In other words relation R on a set A is symmetric if
∀a∀b((a,b)∈R→(b,a)∈R)
Example: Relation R5 = {(1,1), (1,2), (2,1), (2,2)} is symmetric because
for every (a,b)∈R5 (b,a)∈R5
like (1,2) (2,1) is in R5

Relation R6 = {(1,1), (1,2), (1,3), (1,4) is not symmetric because for (1,2)
there is no (2,1) in R6. Same is true for (1,3) and (1,4).
4. Antisymmetric Relation:
A relation R on a set A is called antisymmetric if ∀a∀b((a,b)∈R ^ (b,a)∈R
→ (a=b))
Whenever we have (a,b) in R, we will never have (b,a) in R until or
unless (a = b)
Example: Relation R7 = {(1,1), (2,1), (2,1)} on a set A is antisymmetric
5. Transitive Relation
A relation R on a set A is called transitive if ∀a∀b∀c((a,b)∈R ^ (b,c)∈R
→ (a,c)∈R)
Example: A = {1,2,3,4}
R8 = {(2,1), (3,1), (3,2), (4,4)} is transitive because (3,2), (2,1), and (3,1)
are there in R8.

R9 = {(1,2), (1,3)} is not transitive as (1,2) and (1,3) are there in R9 but
there is no (2,3) in relation R9.
6. Asymmetric Relation
A relation R on a set A is called asymmetric if ∀a∀b((a,b)∈R → (b,a)is
not ∈R)
Example: A = {1,2,3,4}
R10 = {(1,1), (1,2), (1,3) is not an asymmetric relation because of (1,1).

R11 = {(1,2), (1,3), (2,3)} is an asymmetric relation.


Summary
1. Reflexive ∀a((a, a)∈R)
2. Irreflexive ∀a∈A, (a,a)is not ∈ R
3. Symmetric ∀a∀b((a,b)∈R→(b,a)∈R)
4. Antisymmetric ∀a∀b((a,b)∈R ^ (b,a)∈R → (a=b))
5. Transitive ∀a∀b∀c((a,b)∈R ^ (b,c)∈R → (a,c)∈R)
6. Asymmetric ∀a∀b((a,b)∈R → (b,a)is not ∈R)
Problem: Determine whether relation R on the set of all real numbers is
reflexive, symmetric, antisymmetric, and /or transitive, where (x,y)∈R if
and only if
a. x + y = 0
b. x - y is a rational number
c. xy = 0

Solution:
a. R = {(x,y) | x + y = 0}
1. Reflexive: ∀a∈R ((a,a)∈R), Not reflexive. Only true for (0,0).
for (1,1), (2,2), (3,3) not true.
2. Symmetric: ∀a∀b∈R ((a,b)∈R → (b,a)∈R ), if a+b=0 then b+a=0.
therefore, R is symmetric.

3. Antisymmetric: ∀a∀b∈R((a,b)∈R ^ (b,a)∈R → (a=b)). Not


antisymmetric.
1+(-1)=0 and -1+1=0 but 1 is not equal to -1.

4. Transitive: ∀a∀b∀c((a,b)∈R ^ (b,c)∈R → (a,c)∈R)


Not Transitive. 1+(-1)=0 and (-1)+1=0 but 1+1 is not = 0
b. x - y is a rational number
1. Reflexive: a-a= is a rational number
2. Symmetric: if a-b is a rational number then b-a = -(a-b) is also a
rational number
3. Antisymmetric: Not antisymmetric, 3-2 and 2-3 are both rational
numbers but 3 is not = 2.
4. Transitive: if a-b is a rational number and b-c is also a rational
number, then a-c = (a-b) + (b-c) is also a rational number
c. xy = 0
1. Reflexice: Not reflexive, a.a = 𝑎2 = 0 when a=0. for a=1 or 2 not true.
2. Symmetric: ab=0 then ba=0
3. Antisymmetric: Not antisymmetric, 1x0 = 0 and 0x1 = 0 but 1is not
=0.
4. Transitive: Not transitive, -1x0 = 0 and 0x2 = 0 but -1x2 is not =0.
Representation of Relations
Let say we have two sets A and B
A = {1,2,3}
B = {0,1,2,4}
Let say we want to represent a relation R which consists of all ordered pairs (x,y)
where x∈A and y∈B and x≤y
1. Listing Method: R={(1,1), (1,2), (1,4)

2. Set Builder Method:


R(A to B) = {(x,y | x≤y} or R = {(x,y) | x∈A ^ y∈B ^ x≤y}

3. Statement Representation:
∀x∈A ∀y∈B, xRy iff x≤y
4. Matrix Representation:
0124
1 0111
2 0011 |A| = m
3 0 0 0 1 mxn |B| = n

5. Arrow Diagram Representation:


R
0
1
1
A 2 B
2
3
4
Equivalence of Relation
A relation R on a set A is an equivalence relation iff R is reflexive,
symmetric, and transitive.
Example: A = {0,1,2,3}
R1 = {(0,0), (1,1), (1,2), (2,1), (2,2), (3,3)}
Is R1 an equivalence relation?
R1 reflexive?
R1 symmetric?
R1 transitive?
A = {0,1,2,3}
R2 = {(0,0) (0,2), (2,0), (2,2), (2,3), (3,2), (3,3)}
Is R2 an equivalence relation?
R2 reflexive?
R2 Symmetric?
R2 Transitive?

A = {0,1,2,3}
R3 = {(0,0), (0,1), (0,2), (1,0), (1,2), (2,0), (2,2), (3,3)}
Is R3 equivalence relation?
R3 reflexive?
R3 symmetric?
R3 transitive?

You might also like