cs 23022 discrete mathematical structures
DESCRIPTION
CS 23022 Discrete Mathematical Structures. Mehdi Ghayoumi MSB rm 132 [email protected] Ofc hr: Thur, 9:30-11:30a. Announcements. Homework , Hwk 5 is available now Midterm 1: 06/30/14, location rm121. Today section 2.4 and 2.5 Rossen and some articles - PowerPoint PPT PresentationTRANSCRIPT
CS 23022Discrete Mathematical Structures
Mehdi GhayoumiMSB rm [email protected] Ofc hr: Thur, 9:30-11:30a
Announcements
Homework , Hwk 5 is available now
Midterm 1: 06/30/14, location rm121.
Today section 2.4 and 2.5 Rossen and some articles
Next Sections will be exam review.
SequencesDefinition:
A sequence {ai} is a function
f: N {0} R,
where we write ai to indicate f(i).
A Sequence is a list of things (usually numbers) that are in order.
SequencesExamples:
{1, 2, 3, 4, ...} is a very simple sequence (and it is an infinite sequence)
{20, 25, 30, 35, ...} is also an infinite sequence{1, 3, 5, 7} is the sequence of the first 4 odd numbers
(and is a finite sequence){1, 2, 4, 8, 16, 32, ...} is an infinite sequence where every
term doubles{a, b, c, d, e} is the sequence of the first 5 letters
alphabetically
SequencesExamples:
{f, r, e, d} is the sequence of letters in the name "fred"
{0, 1, 0, 1, 0, 1, ...} is the sequence of alternating 0s and 1s
(yes they are in order, it is an alternating order in this case)
Sequence {ai}, where ai = i is just a0 = 0, a1 = 1, a2 = 2, …
Sequence {ai}, where ai = i2 is just a0 = 0, a1 = 1, a2 = 4, …
SummationThe symbol:
The limit:
aii1
k
a1 a2 ak
aii1
limn
aii1
n
Summations you should know…
What is S = 1 + 3 + 5 + … + (2n - 1)?
Sum of first n odds.
(2k 1)k1
n
2 kk1
n
1k1
n
2 n(n 1)2
n
n2
Summations you should know…
What is S = 1 + 3 + 5 + … + (2n - 1)?
Sum of first n odds.
n2
Summations you should know…Arithmetic Sequencesthe difference between one term and the next is a constant.
Example:
1, 4, 7, 10, 13, 16, 19, 22, 25, ...
{a, a+d, a+2d, a+3d, ... }
a is the first term, and
d is the difference between the terms
xn = a + d(n-1)
Summations you should know…Geometric Sequenceseach term is found by multiplying the previous term by a constant
Example:
2, 4, 8, 16, 32, 64, 128, 256, ...
This sequence has a factor of 2 between each number.
{a, ar, ar2, ar3, ... }
•a is the first term, and
•r is the factor between the terms (called the "common ratio")
xn = ar(n-1)
Summations you should know…Triangular Numbers
1, 3, 6, 10, 15, 21, 28, 36, 45, ...
xn = n(n+1)/2
the 5th Triangular Number is x5 = 5(5+1)/2 = 15,
and the sixth is x6 = 6(6+1)/2 = 21
Summations you should know…Square Numbers
1, 4, 9, 16, 25, 36, 49, 64, 81, ...
The next number is made by squaring where it is in the pattern.
Rule is xn = n2
Cube Numbers1, 8, 27, 64, 125, 216, 343, 512, 729, ...
The next number is made by cubing where it is in the pattern.
Rule is xn = n3
Summations you should know…Fibonacci Sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
Rule is xn = xn-1 + xn-2
Summations you should know…What is S = 1 + r + r2 + … + rnGeometric Series
rkk0
n
1 r rn
r rkk0
n
r r2 rn1Multiply by r
Subtract 2nd from 1st
rkk0
n
r rkk0
n
1 rn1factor
(1 r) rkk0
n
1 rn1 divide
rkk0
n
1 rn1
(1 r)DONE!
Summations you should know…What about:
rkk0
1 r rn
nlim1 r
n1
(1 r)
If r 1 this blows up.
If r < 1 we can say something.
rkk0
nlim rk
k0
n
1
(1 r)
Infinite CardinalityTwo sets A and B have the same cardinality if and
only if there exists a bijection between them, A ~ B.
In your own example, we can create bijections between the various descriptions of the sets of A and the set of B.
An infinite set is “countably infinite” if it
can be put into one-to-one
correspondence with the set
of natural numbers.
A set is “countable” if it is either finite or countably infinite.
Infinite CardinalityAre there more evens than odds?
Are there more natural numbers than evens?
Are there more evens than multiples of 3?
{0,2,4,6,8,…} ~ {1,3,5,7,9,…}, f(x) = x-1
N ~ {0,2,4,6,8,…}, f(x) = 2x
{0,2,4,6,8,…} ~ {0,3,6,9,12,…}, f(x) = 3x/2
{0,2,4,6,8,…} ~ {2,4,6,8,…}, f(x) = x-2
Perfect squares ~ N, f(x) = x
Infinite CardinalityHow many rational numbers are there?
1/1, 1/2, 1/3, 1/4, …2/1, 2/2, 2/3, 2/4, …3/1, 3/2, 3/3, 3/4, …
…1/1, 1/2, 2/1, 1/3, 2/2, 3/1, 1/4, 2/3, 3/2, 4/1, …
Infinite CardinalityHow many real numbers are in interval [0, 1]?
0.4 3 2 9 0 1 3 2 9 8 4 2 0 3 9 …0.8 2 5 9 9 1 3 2 7 2 5 8 9 2 5 …0.9 2 5 3 9 1 5 9 7 4 5 0 6 2 1 …
… “Countably many! There’s the list!”
“Are you sure they’re all there?”
Counterexample:0.5 3 6 …
So we say the reals are “uncountable.”
Can we write programs for all functions?How many different programs can we write?
Countably many, we can list them by length.
Depends on the size of the alphabet we use. Let’s say our alphabet is size 100.
How many 1 character programs are there?How many 2 character programs are there?How many n character programs are there?How many programs are there?
Can we write programs for all functions?
How many different functions are there?Suppose domain is N, and codomain is {0,1,…9}, so
we’re really only asking “how many functions f:N{0,1,2,…9} are there?”
0.1415926…
x 0 1 2 3 4 5 6 7 …
f(x) 0 1 4 1 5 9 2 6 …
Real, irrational.
MatrixA Matrix is an array of numbers:
A Matrix(This one has 2 Rows and 3 Columns)
AddingTo add two matrices: add the numbers in the matching positions:
The two matrices must be the same size, i.e. the rows must match in size, and the columns must match in size.
MatrixNegative
The negative of a matrix is also simple:
Subtracting
To subtract two matrices: subtract the numbers in the matching positions:
MatrixMultiply by a Constant
We can multiply a matrix by some value:
Multiplying by Another Matrix
But to multiply a matrix by another matrix you need to do the "
dot product" of rows and columns ... what does that mean?
To work out the answer for the 1st row and 1st column:
MatrixDividing
A/B = A × (1/B) = A × B-1
where B-1 means the "inverse" of B.
When you multiply a number by its reciprocal you get 1
8 × (1/8) = 1
When you multiply a Matrix by its Inverse you get the Identity Matrix (which is like "1" for Matrices):
A × A-1 = I
MatrixDividing
2x2 Matrix
OK, how do we calculate the Inverse? Well, for a 2x2 Matrix the Inverse is:
In other words: swap the positions of a and d, put negatives in front of b and c, and divide everything by the determinant (ad-bc).
MatrixDividing
Let us try an example:
So, let us check to see what happens when we multiply a matrix by its inverse:
MatrixDividingA Real Life ExampleA group took a trip on a bus, at $3 per child and $3.20 per adult for a total of $118.40. They took the train back at $3.50 per child and $3.60 per adult for a total of $135.20.How many children, and how many adults?
First, let us set up the matrices (be careful to get the rows and columns correct!):
MatrixDividing
This is just like the example above:
XA = B
So to solve it we need the inverse of "A":
MatrixNow we have the inverse we can solve using:
X = BA-1
Same answer: 16 children and 22 adults.
MatrixTransposing
To "transpose" a matrix, swap the rows and columns. We put a "T" in the top right-hand corner to mean transpose:
NotationA matrix is usually shown by a capital letter (such as A, or B)Each entry (or "element") is shown by a lower case letter with a "subscript" of row, column: