Discrete Math
Discrete Math
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
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
= [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
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
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,
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,
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 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
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).
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. 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
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?