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 8
1
A
≠
∅
≠
B
Prove:
f
:
A
→
B
is surjective
⟹
π
f
=
{
f
−
1
[
{
b
}
]
|
b
∈
B
}
is a partition of
A
Proof:
Let
f
be surjective
Let
R
=
{
(
a
,
b
)
|
f
(
a
)
=
f
(
b
)
}
,
R
⊆
A
×
A
∀
a
∈
A
:
f
(
a
)
=
f
(
a
)
⟹
a
R
a
⟹
R
is reflexive
a
R
b
⟹
f
(
a
)
=
f
(
b
)
⟹
f
(
b
)
=
f
(
a
)
⟹
b
R
a
⟹
R
is symmetric
a
R
b
∧
b
R
c
⟹
f
(
a
)
=
f
(
b
)
=
f
(
c
)
⟹
f
(
a
)
=
f
(
c
)
⟹
a
R
c
⟹
R
is transitive
⟹
R
is an equivalence relation
f
is surjective
⟹
∀
b
∈
B
:
∃
c
∈
A
:
f
(
c
)
=
b
Let
c
∈
A
,
b
∈
B
:
f
(
c
)
=
b
[
c
]
R
=
{
a
∈
A
|
f
(
a
)
=
f
(
c
)
=
b
}
f
−
1
[
{
b
}
]
=
{
a
∈
A
|
f
(
a
)
=
b
}
⟹
∀
c
∈
A
:
[
c
]
R
=
f
−
1
[
{
b
}
]
⟹
π
f
=
A
/
R
2a
f
:
N
→
N
Prove or disprove:
∀
A
≠
B
⊆
N
:
f
−
1
[
A
]
≠
f
−
1
[
B
]
⟹
f
is injective
Disproof:
Let
f
(
n
)
=
⌈
n
2
⌉
Meaning:
f
(
2
n
−
1
)
=
f
(
2
n
)
=
n
f
(
1
)
=
f
(
2
)
⟹
f
is not injective
Let
A
≠
B
⊆
N
⟹
∃
n
∈
N
:
n
∈
A
∖
B
∀
n
∈
N
:
f
−
1
[
{
n
}
]
=
{
2
n
,
2
n
−
1
}
∀
n
≠
m
∈
N
:
|
n
−
m
|
≥
1
⟹
|
2
n
−
2
m
|
=
2
|
n
−
m
|
≥
2
⟹
2
m
≠
2
n
≠
2
m
−
1
⟹
∀
n
≠
m
∈
N
:
2
n
∉
f
−
1
[
{
m
}
]
⟹
{
n
∈
A
⟹
2
n
∈
f
−
1
[
A
]
n
∉
B
⟹
2
n
∉
f
−
1
[
B
]
⟹
f
−
1
[
A
]
≠
f
−
1
[
B
]
∀
A
≠
B
:
f
−
1
[
A
]
≠
f
−
1
[
B
]
and
f
is not injective
2b
f
:
N
→
N
Prove or disprove:
∀
A
≠
B
⊆
N
:
f
−
1
[
A
]
≠
f
−
1
[
B
]
⟹
f
is surjective
Proof:
Let
∀
A
≠
B
⊆
N
:
f
−
1
[
A
]
≠
f
−
1
[
B
]
Let
f
be not surjective
⟹
∃
m
∈
N
:
m
∉
I
m
(
f
)
Let
A
=
{
m
}
,
B
=
∅
A
≠
B
f
−
1
[
B
]
=
∅
f
−
1
[
A
]
=
{
n
∈
N
|
f
(
n
)
=
m
}
=
∅
⟹
f
−
1
[
A
]
=
f
−
1
[
B
]
−
Contradiction!
⟹
f
is surjective
3
Let
R
be a relation on
A
Let
f
:
A
→
A
f
respects
R
if:
∀
a
,
b
∈
A
:
a
R
b
⟹
f
(
a
)
=
f
(
b
)
Given
f
,
define
f
^
:
A
/
R
→
A
∀
[
a
]
R
∈
A
/
R
:
f
^
(
[
a
]
R
)
=
f
(
a
)
3a
f
respects
R
Prove:
f
^
is well-defined (it is unique and complete)
it actually should be called to-one, because unique means that there is only one function,
not only one image for each source
Proof:
∀
a
∈
A
:
[
a
]
R
=
{
b
∈
A
|
b
R
a
}
=
{
b
∈
A
|
f
(
b
)
=
f
(
a
)
}
∀
[
a
]
R
∈
A
/
R
:
a
∈
A
⟹
∃
f
(
a
)
⟹
∃
f
^
(
[
a
]
R
)
=
f
(
a
)
⟹
f
^
is complete
Let
[
a
]
R
,
[
b
]
R
∈
A
/
R
:
[
a
]
R
=
[
b
]
R
f
^
(
[
a
]
R
)
=
f
(
a
)
f
^
(
[
b
]
R
)
=
f
(
b
)
[
a
]
R
=
[
b
]
R
⟹
a
R
b
⟹
f
(
a
)
=
f
(
b
)
⟹
f
^
(
[
a
]
R
)
=
f
(
a
)
=
f
(
b
)
=
f
^
(
[
b
]
R
)
⟹
f
^
is "unique" (to-one)
f
^
is "unique" (to-one) and complete
⟹
f
^
is well-defined
3b
f
respects
R
Let
f
be injective
∀
a
,
b
∈
A
:
a
R
b
⟹
f
(
a
)
=
f
(
b
)
⟹
a
=
b
∀
a
,
b
∈
A
:
a
R
b
⟹
a
=
b
⟹
R
=
I
d
a
Let
C
,
D
⊆
A
/
R
,
prove
f
^
[
C
∪
D
]
=
f
^
[
C
]
∪
f
^
[
D
]
Proof:
Let
a
∈
A
f
(
a
)
∈
f
^
[
C
∪
D
]
⟺
[
a
]
R
∈
C
∪
D
⟺
[
a
]
R
∈
C
∨
[
a
]
R
∈
D
⟺
f
(
a
)
∈
f
^
[
C
]
∨
f
(
a
)
∈
f
^
[
D
]
⟺
f
(
a
)
∈
f
^
[
C
]
∪
f
^
[
D
]
⟹
f
^
[
C
∪
D
]
=
f
^
[
C
]
∪
f
^
[
D
]
Let
C
,
D
⊆
A
/
R
,
show that it’s not necessarily true that
f
^
[
C
∩
D
]
=
f
^
[
C
]
∩
f
^
[
D
]
Solution:
Let
A
=
{
1
,
2
,
3
}
Let
f
(
1
)
=
f
(
2
)
=
f
(
3
)
=
1
Let
R
=
I
d
A
∪
{
(
1
,
2
)
,
(
2
,
1
)
}
⟹
[
1
]
R
=
{
1
}
,
[
2
]
R
=
{
2
}
Let
C
=
{
[
1
]
R
}
,
D
=
{
[
2
]
R
}
f
^
[
C
∩
D
]
=
f
^
[
∅
]
=
∅
f
^
[
C
]
=
{
f
^
(
[
1
]
R
)
}
=
{
f
(
1
)
}
=
{
1
}
f
^
[
D
]
=
{
f
^
(
[
3
]
R
)
}
=
{
f
(
2
)
}
=
{
1
}
f
^
[
C
]
∩
f
^
[
D
]
=
{
1
}
≠
∅
⟹
f
^
[
C
∩
D
]
≠
f
^
[
C
]
∩
f
^
[
D
]
3c
Let
f
,
g
:
A
→
A
Prove or disprove:
(
g
∘
f
)
respects
R
⟹
f
respects
R
Disproof:
Let
A
=
{
1
,
2
,
3
}
Let
∀
a
∈
A
:
g
(
a
)
=
1
Let
f
=
I
d
A
Let
R
=
I
d
A
∪
{
(
1
,
2
)
,
(
2
,
1
)
}
g
(
f
(
1
)
)
=
g
(
f
(
2
)
)
⟹
(
g
∘
f
)
respects
R
f
(
1
)
≠
f
(
2
)
⟹
f
doesn’t respect
R
Prove or disprove:
f
respects
R
⟹
(
g
∘
f
)
respects
R
Proof:
Let
a
,
b
∈
A
Let
f
respects
R
a
R
b
⟹
f
(
a
)
=
f
(
b
)
⟹
g
(
f
(
a
)
)
=
g
(
f
(
b
)
)
as
g
is to-one
⟹
(
g
∘
f
)
respects
R
4
X
,
Y
,
Z
are sets
f
:
X
→
Y
g
:
Y
→
Z
h
=
(
g
∘
f
)
4a
Prove or disprove:
C
⊆
X
,
h
is injective
⟹
f
−
1
[
f
[
C
]
]
=
C
Proof:
h
is injective
⟹
f
is injective
Let
c
∈
C
c
∈
C
⟹
f
(
c
)
∈
f
[
C
]
⟹
c
∈
f
−
1
[
f
[
C
]
]
⟹
C
⊆
f
−
1
[
f
[
C
]
]
Let
c
∈
f
−
1
[
f
[
C
]
]
c
∈
f
−
1
[
f
[
C
]
]
⟹
f
(
c
)
∈
f
[
C
]
⟹
⏟
f
is injective
c
∈
C
⟹
C
=
f
−
1
[
f
[
C
]
]
4b
Prove or disprove:
C
⊆
Y
,
h
is surjective
⟹
f
[
f
−
1
[
C
]
]
=
C
Disproof:
Let
X
=
{
1
,
2
}
,
Y
=
{
3
,
4
}
,
Z
=
{
5
}
f
(
1
)
=
f
(
2
)
=
3
g
(
3
)
=
g
(
4
)
=
5
⟹
h
(
1
)
=
5
,
h
(
2
)
=
5
,
h
is surjective
Let
C
=
{
3
,
4
}
f
−
1
[
3
,
4
]
=
{
1
,
2
}
f
[
f
−
1
[
C
]
]
=
f
[
{
1
,
2
}
]
=
{
3
}
≠
C
⟹
f
[
f
−
1
[
C
]
]
≠
C
4c
Prove or disprove:
C
,
D
⊆
Y
,
h
is surjective
⟹
g
[
C
∩
D
]
=
g
[
C
]
∩
g
[
D
]
Disproof:
Let
X
=
{
1
,
2
,
3
}
,
Y
=
{
4
,
5
,
6
}
,
Z
=
{
7
,
8
}
Let
f
(
x
)
=
x
+
3
,
g
(
4
)
=
g
(
6
)
=
7
,
g
(
5
)
=
8
h
(
1
)
=
h
(
3
)
=
7
,
h
(
2
)
=
8
,
h
is surjective
Let
C
=
{
4
,
5
}
,
D
=
{
5
,
6
}
g
[
C
∩
D
]
=
g
[
{
5
}
]
=
{
8
}
g
[
C
]
∩
g
[
D
]
=
g
[
{
4
,
5
}
]
∩
g
[
{
5
,
6
}
]
=
{
7
,
8
}
∩
{
7
,
8
}
=
{
7
,
8
}
⟹
g
[
C
∩
D
]
≠
g
[
C
]
∩
g
[
D
]
5
f
:
A
→
A
B
⊆
A
B
1
=
B
,
B
n
+
1
=
f
−
1
[
B
n
]
x
is called a fixed point of
f
if
f
(
x
)
=
x
5a
Prove or disprove:
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
⟹
f
has no fixed points
Proof:
Let
∃
x
0
∈
A
:
f
(
x
0
)
=
x
0
Let
B
=
{
x
0
}
Base case.
B
1
=
B
=
{
x
0
}
⟹
x
0
∈
B
1
Induction step. Let
x
0
∈
B
n
x
0
∈
B
n
⟹
x
0
∈
f
−
1
[
B
n
]
⟹
x
0
∈
B
n
+
1
⟹
By induction:
x
0
∈
⋂
n
∈
N
B
n
⟹
⋂
n
∈
N
B
n
≠
∅
⟹
∃
B
⊆
A
:
⋂
n
∈
N
B
n
≠
∅
⟹
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
⟹
f
has no fixed points
5b
Prove or disprove:
f
has no fixed points
⟹
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
Disproof:
Let
A
=
{
1
,
2
}
f
(
1
)
=
2
,
f
(
2
)
=
1
f
has no fixed points
Let
B
=
{
1
,
2
}
∀
n
∈
N
:
B
n
=
{
1
,
2
}
⟹
⋂
n
∈
N
B
n
=
{
1
,
2
}
≠
∅
⟹
∃
B
⊆
A
:
⋂
n
∈
N
B
n
≠
∅
⟹
f
has no fixed points
⟹
⧸
⟹
∀
B
⊆
A
:
⋂
n
∈
N
B
n
=
∅
6
f
:
N
→
N
is called periodic if
∃
p
>
1
∈
N
:
∀
n
∈
N
:
f
(
n
)
=
f
(
n
+
p
)
6a
Prove or disprove:
f
is periodic
⟹
f
is not surjective
Proof:
Let
f
be periodic
⟹
∃
p
>
1
∈
N
:
∀
n
∈
N
:
f
(
n
)
=
f
(
n
+
p
)
Let
p
>
1
∈
N
Let
P
=
f
[
[
p
∥
p
]
]
=
{
f
(
1
)
,
f
(
2
)
,
…
,
f
(
p
)
}
|
P
|
≤
p
⟹
P
is finite
Let
n
∈
N
If
n
∈
[
p
]
,
then
f
(
n
)
∈
P
If
n
>
p
,
then
∃
n
1
,
n
2
∈
N
:
n
1
<
p
,
n
=
n
1
+
n
2
p
⟹
f
(
n
)
=
f
(
n
1
+
n
2
p
)
=
f
(
n
1
)
∈
P
⟹
∀
n
∈
N
:
f
(
n
)
∈
P
⟹
I
m
(
f
)
=
P
⟹
I
m
(
f
)
is finite
⟹
I
m
(
f
)
≠
N
⟹
f
is not surjective
6b
Prove or disprove:
∀
f
:
f
2
is periodic
⟹
f
is periodic
Disproof:
f
=
{
1
n
is odd
n
+
1
n
is even
Let
n
∈
N
If
n
is odd
,
then
f
(
n
)
=
1
⟹
f
(
f
(
n
)
)
=
1
If
n
is even
,
then
f
(
n
)
=
n
+
1
⏟
odd
⟹
f
(
f
(
n
)
)
=
1
⟹
∀
n
∈
N
:
f
(
f
(
n
)
)
=
1
⟹
f
2
is periodic
Let
p
>
1
∈
N
Let
n
∈
N
be even
If
p
is even
,
then
f
(
n
+
p
)
=
n
+
p
+
1
≠
n
+
1
⟹
f
(
n
)
≠
f
(
n
+
p
)
If
p
is odd
,
then
f
(
n
+
p
)
=
1
≠
n
+
1
⟹
f
(
n
)
≠
f
(
n
+
p
)
⟹
∀
p
>
1
∈
N
:
∃
n
∈
N
:
f
(
n
)
≠
f
(
n
+
p
)
⟹
f
is not periodic
⟹
∃
f
:
f
2
is periodic and
f
is not periodic