Cub11k's BIU Notes
Cub11k's BIU Notes
Assignments
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 2
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 8
Infi-1 9
Linear-1
Linear-1 1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 2
Linear-1 3
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Lectures
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 13
Discrete-math 14
Discrete-math 15
Discrete-math 16
Discrete-math 18
Discrete-math 19
Discrete-math 20
Discrete-math 21
Discrete-math 22
Discrete-math 23
Discrete-math 24
Discrete-math 25
Discrete-math 26
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Exam 2023 (2A)
Exam 2023 (2B)
Exam 2023 (A)
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Midterm
Infi-1
Exam 2022B (A)
Exam 2022B (B)
Exam 2023B (A)
Exam 2023B (B)
Exam 2024 (A)
Exam 2024 (B)
Exam 2025 (A)
Infi-1 10
Infi-1 12
Infi-1 13
Infi-1 14
Infi-1 15
Infi-1 16
Infi-1 17
Infi-1 19
Infi-1 20
Infi-1 21
Infi-1 22
Infi-1 23
Infi-1 24
Infi-1 25
Infi-1 26
Infi-1 5
Infi-1 6
Infi-1 7
Infi-1 9
Midterm
Theorems and proofs
Infi-2
Infi-2 1
Infi-2 10
Infi-2 11
Infi-2 12
Infi-2 13
Infi-2 14
Infi-2 15
Infi-2 16
Infi-2 17
Infi-2 2-3
Infi-2 3-4
Infi-2 5
Infi-2 6
Infi-2 7
Infi-2 8
Infi-2 9
Linear-1
Exam 2023 (B)
Exam 2023 (C)
Exam 2024 (A)
Exam 2024 (B)
Exam 2024 (C)
Exam 2025 (A)
Linear-1 11
Linear-1 12
Linear-1 13
Linear-1 4
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Midterm
Random exams
Theorems and proofs
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Linear-2 8
Seminars
CSI
CSI 2
Data-structures
Data-structures 1
Data-structures 2
Data-structures 3
Discrete-math
Discrete-math 1
Discrete-math 10
Discrete-math 11
Discrete-math 12
Discrete-math 2
Discrete-math 3
Discrete-math 4
Discrete-math 5
Discrete-math 6
Discrete-math 7
Discrete-math 8
Discrete-math 9
Infi-1
Infi-1 10
Infi-1 11
Infi-1 12
Infi-1 13
Infi-1 3
Infi-1 4
Infi-1 5
Infi-1 6
Infi-1 8
Infi-2
Infi-2 1
Infi-2 2
Infi-2 3
Infi-2 4
Infi-2 6
Infi-2 7
Infi-2 8
Linear-1
Linear-1 10
Linear-1 11
Linear-1 12
Linear-1 3
Linear-1 5
Linear-1 6
Linear-1 7
Linear-1 8
Linear-1 9
Linear-2
Linear-2 1
Linear-2 2
Linear-2 3
Linear-2 4
Linear-2 5
Linear-2 6
Linear-2 7
Templates
Lecture Template
Seminar Template
Home
Discrete-math 21
Discrete-math 21
Graph
#definition
Graph is a set of points and lines
Graph is an ordered pair of set of vertices and set of edges
G
=
(
V
,
E
)
E
⊆
{
{
v
,
u
}
|
v
,
u
∈
V
,
v
≠
u
}
E
is a set of unordered pairs of distinct vertices
In this case,
G
is a simple undirected graph
Adjacency
#definition
Vertices
u
,
v
∈
V
are called adjacent if they have a common edge
(if they are connected by some edge
e
∈
E
)
e
is then called incident on
u
,
v
What is the max number of edges in a simple graph with
n
vertices
(
n
2
)
=
n
!
(
n
−
2
)
!
2
!
=
n
(
n
−
1
)
2
What is the number of simple graphs with
n
vectices?
2
(
n
2
)
=
2
n
(
n
−
1
)
/
2
Let
G
=
(
V
,
E
)
,
v
∈
V
Neighborhood of a vertex and of a set of vertices
#definition
Neighborhood of vertice
v
is a set of vertices which are adjacent to
v
Γ
(
v
)
=
{
u
∈
V
|
{
u
,
v
}
∈
E
}
Let
S
⊆
V
Neighborhood of set of vertices
S
is a set of vertices
which are adjacent to at least one of vertices in
S
Γ
(
S
)
=
{
u
∈
V
|
∃
v
∈
S
:
{
u
,
v
}
∈
E
}
Degree of vertex
#definition
Degree of vertice
v
is a size of neighborhood of
v
d
e
g
(
v
)
=
|
Γ
(
v
)
|
Hand-shaking lemma for graphs
#lemma
Let
G
=
(
V
,
E
)
be a simple graph
Then
∑
v
∈
V
d
e
g
(
v
)
=
2
⋅
|
E
|
Proof:
Each edge is counted twice in
∑
v
∈
V
d
e
g
(
v
)
Each edge is counted twice in
2
⋅
|
E
|
⟹
∑
v
∈
V
d
e
g
(
v
)
=
2
⋅
|
E
|
Corollary of this lemma
In any simple graph, number of vertices with odd degree is even
Proof:
Let
O
D
D
=
{
v
∈
V
|
d
e
g
(
v
)
is odd
}
Let
E
V
E
N
=
{
v
∈
V
|
d
e
g
(
v
)
is even
}
O
D
D
∪
E
V
E
N
=
V
,
O
D
D
∩
E
V
E
N
=
∅
Let
|
O
D
D
|
be odd
Then
2
⋅
|
E
|
=
∑
v
∈
V
d
e
g
(
v
)
=
∑
v
∈
O
D
D
d
e
g
(
v
)
+
∑
v
∈
E
V
E
N
d
e
g
(
v
)
Sum of odd number of odd numbers is odd
Sum of even numbers is even
⟹
∑
v
∈
O
D
D
d
e
g
(
v
)
is odd
∑
v
∈
E
V
E
N
d
e
g
(
v
)
is even
⟹
∑
v
∈
O
D
D
d
e
g
(
v
)
+
∑
v
∈
E
V
E
N
d
e
g
(
v
)
=
∑
v
∈
V
d
e
g
(
v
)
|
is odd
⟹
2
⋅
|
E
|
is odd
−
Contradiction!
⟹
|
O
D
D
|
is even
Equal degree vertices
#lemma
In each simple graph
G
=
(
V
,
E
)
with at least 2 vertices there are two vertices
u
≠
v
∈
V
:
d
e
g
(
u
)
=
d
e
g
(
v
)
Proof:
Case 1. There is a vertex
v
:
d
e
g
(
v
)
=
n
−
1
Then there is no vertex
u
:
d
e
g
(
u
)
=
0
⟹
Possible degrees are from
1
to
n
−
1
The number of vertices is
n
, the number of different degrees is
n
−
1
⟹
By the pigeonhole principle there is at least two vertices with the same degree
Case 2. There is no vertex
v
:
d
e
g
(
v
)
=
n
−
1
⟹
Possible degrees are from
0
to
n
−
2
The number of vertices is
n
, the number of different degrees is
n
−
1
⟹
By the pigeonhole principle there is at least two vertices with the same degree
Paths
#definition
Let
G
=
(
V
,
E
)
Path is a sequence of vertices
(
v
1
,
v
2
,
…
,
v
k
+
1
)
such that
∀
i
∈
[
1
,
k
]
:
{
v
i
,
v
i
+
1
}
∈
E
Path is called simple if no vertices appear in the path more than once
Length of the path
(
v
1
,
v
2
,
…
,
v
k
+
1
)
is the number of edges in this path, which is
k
Cycle
#definition
Path
(
v
1
,
v
2
,
…
,
v
k
+
1
)
is called a cycle if
v
1
=
v
k
+
1
Cycle is called simple if no vertices except
v
1
,
v
k
+
1
appear in the cycle more than once
Distance
#definition
Let
v
,
u
∈
V
Distance from
v
to
u
is the length of the shortest path from
v
to
u
d
(
v
,
u
)
If there is no path between vertices
v
,
u
∈
V
then
d
(
v
,
u
)
=
∞
Diameter of graph
#definition
Diameter of graph
G
=
(
V
,
E
)
is a minimal distance between two distinct vertices of the graph
d
i
a
m
(
G
)
=
m
a
x
u
,
v
∈
V
(
d
(
v
,
u
)
)
Diameter of "tight" graph
#lemma
Let
G
=
(
V
,
E
)
be a simple graph such that,
∀
v
∈
V
:
d
e
g
(
v
)
≥
n
−
1
2
Then
d
i
a
m
(
G
)
≤
2
Proof:
Let
v
,
u
∈
V
Case 1.
v
=
u
⟹
d
(
v
,
u
)
=
0
⟹
d
(
v
,
u
)
≤
2
Case 2.
{
v
,
u
}
∈
E
⟹
d
(
v
,
u
)
=
1
⟹
d
(
v
,
u
)
≤
2
Case 3.
Γ
(
v
)
∩
Γ
(
u
)
≠
∅
∃
w
∈
V
:
w
∈
Γ
(
v
)
∩
Γ
(
u
)
⟹
∃
{
w
,
v
}
,
{
w
,
u
}
∈
E
⟹
(
v
,
w
,
u
)
is a path
⟹
d
(
v
,
u
)
≤
2
Case 4.
Γ
(
v
)
∩
Γ
(
u
)
=
∅
u
∉
Γ
(
v
)
,
u
∉
Γ
(
u
)
v
∉
Γ
(
u
)
,
v
∉
Γ
(
v
)
n
=
|
V
|
≥
|
Γ
(
v
)
|
⏟
≥
n
−
1
2
+
|
{
v
}
|
+
|
Γ
(
u
)
|
⏟
≥
n
−
1
2
+
|
{
u
}
|
≥
(
n
−
1
)
+
2
=
n
+
1
n
≥
n
+
1
−
Contradiction!
⟹
∀
v
,
u
∈
V
:
d
(
v
,
u
)
≤
2
⟹
d
i
a
m
(
G
)
≤
2