1 csc-2259 discrete structures konstantin busch louisiana state university k. busch - lsu
TRANSCRIPT
1
CSC-2259 Discrete Structures
Konstantin Busch
Louisiana State University
K. Busch - LSU
Topics to be covered
• Logic and Proofs• Sets, Functions, Sequences, Sums• Integers, Matrices• Induction, Recursion• Counting• Discrete Probability• Graphs
K. Busch - LSU 2
Binary Arithmetic
3
Decimal Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary Digits: 0, 1
Numbers: 9, 28, 211, etc
Numbers: 1001, 11100, 11010011, etc
(also known as bits)
K. Busch - LSU
4
Binary
1001
91821202021 0123
Decimal
9
K. Busch - LSU
5
Binary Addition Binary Multiplication
1001 (9)+ 1 1 (3)------1100 (12)
1001 (9) x 1 1 (3) ------ 1001+ 1001--------- 11011 (27)
K. Busch - LSU
6
x
yz
xy
z x zGates
AND OR NOT
x y z
0 0 0
0 1 0
1 0 0
1 1 1
AND
Binary Logic
x y z
0 0 0
0 1 1
1 0 1
1 1 1
OR
x z
0 1
1 0
NOT
K. Busch - LSU
7
An arbitrary binary function is implementedwith NOT, AND, and OR gates yxxxf n ),,,( 21
y
1x
2x
2x
nx…
NOT AND
OR
K. Busch - LSU
8
Propositional Logic
Proposition: a declarative sentence which is either True or False
Examples:Today is Wednesday (False)Today it Snows (False)1+1 = 2 (True)1+1 = 1 (False)H20 = water (True)
K. Busch - LSU
9
Propositions can be combined usingthe binary operators AND, OR, NOT
We can map to binary values:True = 1False = 0
))(()( cbaqp Example:
K. Busch - LSU
10
True True True
True False False
False True True
False False True
x y yxImplication
x implies y
“You get a computer science degree only if you are a computer science major”
You get a computer science degree:x:y You are a computer science major
yx
K. Busch - LSU
11
True True True
True False False
False True False
False False True
x y yxBi-conditional
x if and only if y
“There is a received phone call if and only if there is a phone ring”
:x:yThere is a received phone call
There is a phone ring
yx
K. Busch - LSU
12
Sets
Set is a collection of elements:
Real numbers R
Integers Z
Empty Set
Students in this room
K. Busch - LSU
13
Subset }5,4,3,2,1{}4,2{
Basic Set Operations
2
4
1
3
5
Union }5,4,3,2,1{}5,4,2{}3,2,1{
241
3
5
K. Busch - LSU
14
Intersection }2{}5,4,2{}3,2,1{
241
3
5
Complement }5,3,2{}4,1{
}5,4,3,2,1{universeK. Busch - LSU
15
DeMorgan’s Laws
BABA
BABA
K. Busch - LSU
16
Inclusion-Exclusion
A B
C
|CBA|
||||||
|||||| ||
CBCABA
CBACBA
K. Busch - LSU
17
Powersets
Contains all subsets of a set
}}3,2,1{},3,1{},3,2{},2,1{},3{},2{},1{,{Q
}3,2,1{A
||2|| AQ
Powerset of A
K. Busch - LSU
18
Counting
Suppose we are given four objects: a, b, c, d
How many ways are there to order the objects? 4321!4
a,b,c,db,a,c,da,b,d,cb,a,d,c … and so on
K. Busch - LSU
19
CombinationsGiven a set S with n elementshow many subsets exist with m elements?
)!(!
!
mnm
n
m
n
Example: 3)!23(!2
!3
2
3
}3,1{},3,2{},2,1{ }3,2,1{SK. Busch - LSU
20
Sterling’s Approximation
n
e
nnn
2!
K. Busch - LSU
21
Probabilities
What is the probability the a dice gives 5?
Sample space = {1,2,3,4,5,6}
Event set = {5}
K. Busch - LSU
6
1
space sample of Size
setevent of Size{5})obability(Pr
22
What is the probability that two dice give the same number?
22
Sample Space = {{1,1},{1,2},{1,3}, …., {6,5}, {6,6}}
Event set = {{1,1},{2,2},{3,3},{4,4},{5,5},{6,6}}
K. Busch - LSU
36
6
space sample of Size
setevent of Sizenumber}) {sameobability(Pr
23
Randomized Algorithms
Quicksort(A):If ( |A| == 1)
return the one item in AElse p = RandomElement(A) L = elements less than p H = elements higher than p B = Quicksort(L) C = Quicksort(H) return(BC)
K. Busch - LSU
24
Graph Theory
K. Busch - LSU
Miami
Atlanta
New York
BostonChicago
Baton Rouge
Las Vegas
San Francisco
Los Angeles
2000 miles1500 miles
1500
15001000
2000
700
1500
300
800
700
1500
1000
1000
800
25
Shortest Path from Los Angeles to Boston
K. Busch - LSU
Boston
Los Angeles
20001500
1500
15001000
2000
700
1500
300
800
700
1500
1000
1000
800
26
Maximum number of edges in a graphwith nodes:
22
)1(
)!2(!2
!
2
2 nnnn
n
nn
Clique with five nodes
5n10edges
n
K. Busch - LSU
27
Other interesting graphs
Bipartite Graph
Trees
K. Busch - LSU
28
Recursion
)1()( nfnnf
1)1(2)( nfnf
Basis1)1( f
1)1( f
Basis
nnnf )1(4321)( Sum of arithmetic sequence
Sum of geometric sequence)1(3210 22222)( nnf
K. Busch - LSU
29
nn
fnf
2
2)(
)2(1)( nfnfnf
1)1( f
1)1(,0)0( ff
Fibonacci numbers
Basis
Divide and conquer algorithms (Quicksort)
K. Busch - LSU
30
Induction
Contradiction
Pigeonhole principle
Proof Techniques
K. Busch - LSU
31
2)1(
)(
nn
nf
Proof by Induction
Induction Basis:2
)11(11)1(
f
Induction Hypothesis:2
)1()1(
nnnf
2)1(
22)1(
)1()(2
nnnnnn
nnfnnf
Induction Step:
)1()( nfnnf Prove:
K. Busch - LSU
32
Proof by Contradiction
2 is irrational
Supposen
m2 ( and have no common
divisor greater than 1 )
m n
2
2
2n
m m2 is even m is even
2 n2 = 4k2 n2 = 2k2 n is even
m=2k
ContradictionK. Busch - LSU