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
Exam 2024 (A)
1a
Let
G
=
(
V
,
E
)
be a simple graph
1.
Define tree
2.
Define distance between
u
,
v
∈
V
3.
Define path
4.
Define cycle
5.
Define connected component
Solution:
3.
Path is a sequence of vertices:
(
v
1
,
v
1
,
…
,
v
k
+
1
)
such that:
∀
i
∈
[
1
,
k
]
:
{
v
i
,
v
i
+
1
}
∈
E
,
∀
i
≠
j
∈
[
1
,
k
]
:
{
v
i
,
v
i
+
1
}
≠
{
v
j
,
v
j
+
1
}
Length of the path is the number of edges in it, which is
k
4.
Cycle is a path such that:
v
1
=
v
k
+
1
2.
Distance between vertices
u
,
v
∈
V
d
(
u
,
v
)
is the length of the shortest path between them
If there is no path between vertices, then
d
(
u
,
v
)
=
∞
5.
Let
∼
be a relation on
V
such that:
∀
u
,
v
∈
V
:
u
∼
v
⟺
d
(
u
,
v
)
<
∞
In other words:
u
∼
v
⟺
There is a path between
u
,
v
∼
is an equivalence relation and
its equivalence classes are called connected components
Connected components induce subgraphs:
G
u
=
{
[
u
]
∼
,
E
u
}
where
E
u
=
{
{
v
,
w
}
|
v
,
w
∈
[
u
]
∼
}
1.
Connected graph is a graph with exactly one connected component
Acyclic graph is a graph with no cycles
Tree is a connected acyclic graph
1b
Let
G
=
(
V
,
E
)
be a simple graph
Define the complement
G
―
of graph
G
To be
G
―
=
(
V
,
E
―
)
:
E
―
=
{
{
u
,
v
}
|
u
,
v
∈
V
,
{
u
,
v
}
∉
E
}
Prove: for any simple graph with
n
≥
5
vertices either
G
or
G
―
has a cycle
Proof:
|
E
―
|
=
n
(
n
−
1
)
2
−
|
E
|
Let
|
E
|
≥
n
⟹
G
has a cycle
Let
|
E
|
<
n
⟹
|
E
―
|
>
n
(
n
−
1
)
2
−
n
=
n
2
−
n
−
2
n
2
=
n
(
n
−
3
)
2
n
≥
5
⟹
n
−
3
2
≥
2
2
=
1
⟹
n
(
n
−
3
)
2
≥
n
⟹
|
E
―
|
>
n
⟹
G
―
has a cycle
2
A
is a set
,
|
A
|
≥
1
Let
f
:
P
(
A
)
×
P
(
A
)
→
P
(
P
(
A
)
)
∀
B
,
C
⊆
A
:
f
(
B
,
C
)
=
{
D
|
D
⊆
B
∩
C
}
Prove or disprove:
1.
It is possible that
f
is injective
2.
It is possible that
f
is surjective
Disproof for 1:
Let
A
A
≠
∅
⟹
∃
a
∈
A
f
(
∅
,
{
a
}
)
=
f
(
{
a
}
,
∅
)
=
P
(
∅
)
=
{
∅
}
⟹
∀
A
:
f
is not injective
Disproof for 2:
Let
A
A
≠
∅
⟹
∃
a
∈
A
⟹
{
a
}
∈
P
(
A
)
⟹
{
{
a
}
}
∈
P
(
P
(
A
)
)
∀
X
:
∅
∈
P
(
X
)
∀
B
,
C
⊆
A
:
f
(
B
,
C
)
=
P
(
B
∩
C
)
⟹
∅
∈
f
(
B
,
C
)
⟹
f
(
B
,
C
)
≠
{
{
a
}
}
⟹
∀
A
:
f
is nor surjective
Let
A
be a set,
|
A
|
≥
1
f
:
P
(
A
)
×
P
(
A
)
→
P
(
P
(
A
)
)
,
f
(
B
,
C
)
=
{
D
|
D
⊆
B
∩
C
}
In other words
f
(
B
,
C
)
=
P
(
B
∩
C
)
D
o
m
(
f
)
=
P
(
A
)
×
P
(
A
)
R
a
n
g
e
(
f
)
=
P
(
P
(
A
)
)
Prove or disprove: It is possible for
f
to be injective
In other words
∃
A
:
f
is injective
Disproof:
Let
A
,
|
A
|
≥
1
Let
a
∈
A
f
(
{
a
}
,
∅
)
=
f
(
∅
,
{
a
}
)
=
{
∅
}
⟹
∀
A
:
f
is not injective
Prove or disprove: It is possible for
f
to be surjective
In other words
∃
A
:
f
is surjective
Disproof:
∅
∈
P
(
P
(
A
)
)
f
(
B
,
C
)
=
P
(
B
∩
C
)
⟹
∅
∈
f
(
B
,
C
)
⟹
f
(
B
,
C
)
≠
∅
∅
∈
R
a
n
g
e
(
f
)
,
∅
∉
I
m
(
f
)
⟹
I
m
(
f
)
≠
R
a
n
g
e
(
f
)
⟹
∀
A
:
f
is not surjective
3
Let
A
be a set
Let
f
:
A
→
A
Let
B
⊆
A
Let
B
1
=
B
,
∀
n
∈
N
:
B
n
+
1
=
f
−
1
[
B
n
]
1.
Prove: if for any
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
then
f
has no fixed points
2.
Prove or disprove:
f
has no fixed points
⟹
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
Proof for 1:
If
A
is an empty set, then
f
is an empty function which has no fixed points
Let
A
≠
∅
Let
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
Let
f
has a fixed point
x
Let
B
=
{
x
}
⟹
x
∈
f
[
B
]
Base case. Let
n
=
1
x
∈
B
⟹
x
∈
B
1
Induction step. Let
x
∈
B
n
B
n
+
1
=
f
−
1
[
B
n
]
x
∈
B
n
,
f
(
x
)
=
x
⟹
x
∈
f
−
1
[
B
n
]
=
B
n
+
1
⟹
By induction:
x
∈
⋂
n
∈
N
B
n
⟹
⋂
n
∈
N
B
n
≠
∅
−
Contradiction!
⟹
f
has no fixed points
Disproof for 2:
Let
A
=
N
Let
f
(
n
)
=
2
n
Let
B
=
N
Base case. Let
n
=
1
B
1
=
B
=
N
Induction step. Let
B
n
=
N
B
n
+
1
=
f
−
1
[
B
n
]
=
f
−
1
[
N
]
Let
x
∈
f
−
1
[
N
]
⟹
x
∈
N
⟹
f
−
1
[
N
]
⊆
N
Let
x
∈
N
⟹
2
x
∈
N
⟹
f
(
x
)
=
2
x
⟹
x
∈
f
−
1
[
{
2
x
}
]
⊆
f
−
1
[
N
]
⟹
N
⊆
f
−
1
[
N
]
⟹
B
n
+
1
=
f
−
1
[
N
]
=
N
⟹
By Induction
∀
n
∈
N
:
B
n
=
N
⟹
⋂
n
∈
N
B
n
=
N
4
…
5
Let
A
be a set
A
is called transitive if
∀
x
∈
A
:
∀
y
∈
x
:
y
∈
A
5a
Find an example of a transitive and a non-transitive sets
Solution:
Let
A
1
=
∅
A
1
is vacuously transitive
Let
A
=
{
{
1
}
}
1
∉
A
⟹
∃
x
=
{
1
}
∈
A
:
∃
y
=
1
∈
x
:
y
∉
A
⟹
A
is not transitive
5b
Let
{
A
i
}
i
∈
I
be family of transitive sets
Prove:
⋂
i
∈
I
A
i
is transitive
Proof:
Let
x
∈
⋂
i
∈
I
A
i
⟹
∀
i
∈
I
:
x
∈
A
i
⟹
∀
i
∈
I
:
∀
y
∈
x
:
y
∈
A
i
⟹
∀
y
∈
x
:
y
∈
⋂
i
∈
I
A
i
⟹
⋂
i
∈
I
A
i
is transitive
5c
Let
A
be a set
Let
A
1
=
A
Let
∀
n
∈
N
:
A
n
+
1
=
A
n
∪
{
y
|
∃
x
∈
A
n
:
y
∈
x
}
5c.1
Prove:
⋃
n
∈
N
A
n
is transitive
Proof:
Let
x
∈
⋃
n
∈
N
A
n
⟹
∃
n
∈
N
:
x
∈
A
n
x
∈
A
n
⟹
∀
y
∈
x
:
y
∈
A
n
+
1
⟹
y
∈
⋃
n
∈
N
A
n
⟹
⋃
n
∈
N
A
n
is transitive
5c.2
Let
B
be transitive and
A
⊆
B
Prove:
⋃
n
∈
N
A
n
⊆
B
Proof:
Base case. Let
n
=
1
A
1
=
A
⟹
A
1
⊆
B
Induction step. Let
A
n
⊆
B
A
n
+
1
=
A
n
∪
{
y
|
∃
x
∈
A
n
:
y
∈
x
}
B
is transitive
⟹
∀
x
∈
B
:
∀
y
∈
x
:
y
∈
B
A
n
⊆
B
⟹
∀
x
∈
A
n
:
∀
y
∈
x
:
y
∈
B
⟹
{
y
|
∃
x
∈
A
n
:
y
∈
x
}
⊆
B
⟹
A
n
+
1
=
A
n
∪
{
y
|
∃
x
∈
A
n
:
y
∈
x
}
⊆
B
⟹
By Induction:
∀
n
∈
N
:
A
n
⊆
B
⟹
⋃
n
∈
N
A
n
⊆
B