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 2023 (A)
1a
…
1b
Let
n
≥
4
be an even number
Prove by induction:
∃
tree
T
=
(
V
,
E
)
:
|
V
|
=
n
:
∀
v
∈
V
:
d
e
g
(
v
)
∈
{
1
,
3
}
Proof:
Base case. Let
n
=
4
graph TD 1---2 1---3 1---4
Induction step. Let the statement hold for
n
Let
G
=
(
V
,
E
)
be a tree with
n
vertices
Let
∀
v
∈
V
:
d
e
g
(
v
)
∈
{
1
,
3
}
G
is a tree
⟹
∃
v
∈
V
:
d
e
g
(
v
)
=
1
Let
u
,
w
∉
V
Let
G
′
=
(
V
∪
{
u
,
w
}
,
E
∪
{
{
v
,
u
}
,
{
v
,
w
}
}
)
d
e
g
(
v
)
=
3
in
G
′
d
e
g
(
u
)
=
d
e
g
(
w
)
=
1
in
G
′
⟹
∀
v
∈
V
∪
{
u
,
w
}
:
d
e
g
(
v
)
∈
{
1
,
3
}
G
′
has
n
+
2
vertices
⟹
Proved by Induction
2a
Prove or disprove:
R
,
S
are equivalence relations on
A
⟹
R
△
S
is an equivalence relation on
A
Disproof:
∀
a
∈
A
:
(
a
,
a
)
∈
R
,
(
a
,
a
)
∈
S
⟹
(
a
,
a
)
∉
R
△
S
⟹
R
△
S
is not reflexive
⟹
R
△
S
is not an equivalence relation
2b
Let
f
:
X
→
Y
Let
D
,
C
⊆
Y
Prove or disprove:
f
−
1
[
C
∩
D
]
=
f
−
1
[
C
]
∩
f
−
1
[
D
]
Proof:
x
∈
f
−
1
[
C
∩
D
]
⟺
∃
y
∈
C
∩
D
:
f
(
x
)
=
y
⟺
y
∈
C
∧
y
∈
D
⟺
x
∈
f
−
1
[
C
]
∧
x
∈
f
−
1
[
D
]
⟺
x
∈
f
−
1
[
C
]
∩
f
−
1
[
D
]
⟹
f
−
1
[
C
∩
D
]
=
f
−
1
[
C
]
∩
f
−
1
[
D
]
3
Let
A
be a set such that
|
A
|
≥
2
Let
f
:
A
×
P
(
A
)
→
P
(
P
(
A
)
)
,
f
(
x
,
B
)
=
{
D
⊆
B
|
x
∈
D
}
3a
Prove:
f
is not injective
Proof:
|
A
|
≥
2
⟹
∃
a
≠
b
∈
A
Let
a
≠
b
∈
A
a
≠
b
⟹
(
a
,
∅
)
≠
(
b
,
∅
)
f
(
a
,
∅
)
=
f
(
b
,
∅
)
=
∅
⟹
f
is not injective
3b
Prove:
∀
x
∈
A
:
∀
B
1
,
B
2
∈
P
(
A
)
:
f
(
x
,
B
1
∩
B
2
)
=
f
(
x
,
B
1
)
∩
f
(
x
,
B
2
)
Proof:
Let
x
∈
A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
}
)
=
{
{
a
}
,
{
a
,
b
}
}
f
(
x
,
B
1
)
∪
f
(
x
,
B
2
)
=
{
{
a
}
}
∪
∅
=
{
{
a
}
}
⟹
f
(
x
,
B
1
∪
B
2
)
≠
f
(
x
,
B
1
)
∪
f
(
x
,
B
2
)
4a
There are 30 students and two buses (red, green) with 15 places
How many ways are there to split 30 students into two groups of 15?
Solution:
No order, no repetition, buses are distinct
⟹
(
30
15
)
4b
How many ways are there to seat 30 students in a 50-place bus with numbered seats?
Solution:
Let us first choose 30 places
And then arrange children in them, as places are distinct
⟹
(
50
30
)
⋅
30
!
=
50
!
30
!
20
!
⋅
30
!
=
50
!
20
!
4c
Teacher wants to assign one of the two tasks to some students
No student can do two tasks. How many ways to assign tasks are there?
Solution:
Let
i
∈
[
0
,
30
]
Let
i
students be assigned with first task
Which is
(
30
i
)
Let some of
30
−
i
students be assigned with second task
Which is
2
30
−
i
⟹
∑
i
=
0
30
(
30
i
)
⋅
(
2
30
−
i
)
⋅
1
i
=
3
30
4d
30 students stand in a queue
How many ways are there to rearrange them such that
no student stands after the student he was before
Solution:
Let us choose
1
≤
i
≤
29
Let
A
i
=
{
orders where
(
i
,
i
+
1
)
stand as they were
}
There are
|
A
i
|
=
(
29
1
)
⋅
(
30
−
1
)
!
such orders
Let us now choose
k
such indices
|
A
i
1
∩
A
i
2
∩
⋯
∩
A
i
k
|
=
(
29
k
)
⋅
(
30
−
k
)
!
⟹
By Inclusion-Exclusion principle:
|
⋃
i
=
1
29
A
i
|
=
∑
k
=
1
29
(
−
1
)
k
−
1
(
29
k
)
(
30
−
k
)
!
The total number of orders is
30
!
The number of "bad" orders is
|
⋃
i
=
1
29
A
i
|
⟹
The answer is:
30
!
−
∑
k
=
1
29
(
−
1
)
k
−
1
(
29
k
)
(
30
−
k
)
!
=
30
!
+
∑
k
=
1
29
(
−
1
)
k
(
29
k
)
(
30
−
k
)
!
=
=
∑
k
=
0
29
(
−
1
)
k
(
29
k
)
(
30
−
k
)
!
5
R
is a relation on
A
R
is called
"well-established" if
∀
X
≠
∅
⊆
A
:
∃
z
∈
X
:
∀
x
∈
X
:
(
x
,
z
)
∈
R
⟹
x
=
z
z
is then called minimal element of
X
5a
Is
R
an order relation on
A
?
Solution:
Let
A
=
{
a
}
Let
R
=
∅
R
is well-established, as for all other
X
subsets of
A
the implication is vacuously-true
(
a
,
a
)
∉
R
⟹
R
is not reflexive
⟹
R
is not an order relation
5b
Let
A
,
B
sets
Let
R
be a well-established relation on
A
Let
S
be a well-established relation on
B
Let
T
be a lexicographic order of
R
,
S
Meaning
T
is a relation on
A
×
B
(
a
1
,
b
1
)
T
(
a
2
,
b
2
)
⟺
[
(
a
1
≠
a
2
)
∧
(
a
1
R
a
2
)
]
∨
[
(
a
1
=
a
2
)
∧
(
b
1
S
b
2
)
]
Prove:
T
is well-established on
A
×
B
Proof:
Let
X
≠
∅
⊆
A
×
B
Let
X
1
=
{
a
|
∃
b
∈
B
:
(
a
,
b
)
∈
X
}
X
≠
∅
⟹
X
1
≠
∅
⟹
∃
z
1
∈
X
1
:
∀
a
∈
X
1
:
(
a
,
z
1
)
∈
R
⟹
a
=
z
1
Let
X
2
=
{
b
|
(
z
1
,
b
)
∈
X
}
X
1
≠
∅
⟹
X
2
≠
∅
⟹
∃
z
2
∈
X
2
:
∀
b
∈
X
2
:
(
b
,
z
2
)
∈
S
⟹
b
=
z
2
z
1
∈
X
1
,
z
2
∈
X
2
⟹
(
z
1
,
z
2
)
∈
X
Let
(
a
,
b
)
∈
X
(
a
,
b
)
T
(
z
1
,
z
2
)
⟹
[
(
a
≠
z
1
)
∧
(
a
R
z
1
)
]
∨
[
(
a
=
z
1
)
∧
(
b
S
z
2
)
]
Let
a
≠
z
1
⟹
a
R
z
1
⟹
a
=
z
1
−
Contradiction!
⟹
a
=
z
1
⟹
b
S
z
2
⟹
b
=
z
2
⟹
(
a
,
b
)
=
(
z
1
,
z
2
)
⟹
∀
(
a
,
b
)
∈
X
:
(
a
,
b
)
T
(
z
1
,
z
2
)
⟹
(
a
,
b
)
=
(
z
1
,
z
2
)
5c
Let
A
be a set
Let
⊆
be a relation on
P
(
A
)
Prove:
⊆
is well-established on
P
(
A
)
⟹
A
is finite
Proof:
Let
X
=
{
B
⊆
A
|
B
is infinite
}
X
⊆
P
(
A
)
Let
X
≠
∅
⊆
is well-established on
P
(
A
)
⟹
∃
Y
∈
X
:
∀
B
∈
X
:
B
⊆
Y
⟹
B
=
Y
Y
is infinite
⟹
Y
≠
∅
⟹
∃
y
∈
Y
Y
is infinite
⟹
Y
∖
{
y
}
is also infinite
⟹
Y
∖
{
y
}
∈
X
Y
∖
{
y
}
⊆
Y
∧
Y
∖
{
y
}
≠
Y
−
Contradiction!
⟹
X
=
∅
⟹
A
is finite