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 18
Discrete-math 18
Even and Odd numbers amount
#lemma
Let
n
∈
N
E
=
{
X
⊆
[
n
]
|
|
X
|
is even
}
O
=
{
X
⊆
[
n
]
|
|
X
|
is odd
}
Then
|
E
|
=
|
O
|
Proof:
How to choose a subset of even size:
1.
Choose any subset of
[
n
−
1
]
.
Number of ways to do it is
2
n
−
1
2.
If the size of the chosen subset is even, we are done. If it’s odd, we add
n
to the subset
⟹
|
E
|
=
2
n
−
1
⋅
1
=
2
n
−
1
O
∩
E
=
∅
O
∪
E
=
P
(
[
n
]
)
|
O
∪
E
|
=
|
O
|
+
|
E
|
−
|
O
∩
E
|
⟹
|
O
|
=
|
P
(
[
n
]
)
|
−
|
E
|
=
2
n
−
2
n
−
1
=
2
n
−
1
⟹
|
E
|
=
|
O
|
Alternating binomial sum
#lemma
∀
n
∈
N
:
∑
k
=
0
n
(
−
1
)
k
(
n
k
)
=
0
Proof (combinatorial):
∑
k
=
0
n
(
−
1
)
k
(
n
k
)
=
∑
k
=
0
⌊
n
/
2
⌋
(
n
2
k
)
⏟
Number of subsets of even size
−
∑
k
=
1
⌈
n
/
2
⌉
(
n
2
k
−
1
)
⏟
Number of subsets of odd size
=
0
Proof (algebraic):
∀
x
,
y
∈
R
:
x
≠
0
≠
y
:
(
x
+
y
)
n
=
∑
k
=
0
n
(
n
k
)
x
k
y
n
−
k
Let
x
=
−
1
,
y
=
1
(
−
1
+
1
)
n
=
∑
k
=
0
n
(
n
k
)
(
−
1
)
k
1
n
−
k
=
∑
k
=
0
n
(
n
k
)
(
−
1
)
k
⟹
∑
k
=
0
n
(
−
1
)
k
(
n
k
)
=
0
Captain's identity
#lemma
∀
n
∈
N
:
∑
k
=
0
n
k
(
n
k
)
=
n
⋅
2
n
−
1
Proof (combinatorial):
X
ways how to choose a team:
1.
Choose a captain from
n
players
2.
Choose a subset of left players to join the captain
X
=
n
⋅
2
n
−
1
Y
ways to choose a team:
1.
Choose a subset of
k
players from
n
players
2.
Choose one of the players in the team to be captain
⟹
Y
=
∑
k
=
0
n
(
n
k
)
⋅
k
X
=
Y
⟹
∑
k
=
0
n
k
(
n
k
)
=
n
⋅
2
n
−
1
Proof (algebraic):
k
(
n
k
)
=
n
(
n
−
1
k
−
1
)
∑
k
=
0
n
k
(
n
k
)
=
∑
k
=
1
n
n
(
n
−
1
k
−
1
)
=
n
∑
k
=
1
n
(
n
−
1
k
−
1
)
=
⏟
t
=
k
−
1
n
∑
t
=
0
n
−
1
(
n
−
1
t
)
=
n
⋅
2
n
−
1
Proof (calculus):
∀
x
,
y
∈
R
:
x
≠
0
≠
y
:
(
x
+
y
)
n
=
∑
k
=
0
n
(
n
k
)
x
k
y
n
−
k
Let
y
=
1
(
x
+
1
)
n
=
∑
k
=
0
n
(
n
k
)
x
k
Let’s differentiate both sides:
n
⋅
(
x
+
1
)
n
−
1
=
∑
k
=
0
n
k
(
n
k
)
x
k
−
1
Let
x
=
1
n
⋅
2
n
−
1
=
∑
k
=
0
n
k
(
n
k
)
Catalan numbers
#definition
Lattice paths
Moves right or up, how many ways there are to get from
(
0
,
0
)
to
(
n
,
n
)
n
moves up
n
moves right
Total of
2
n
moves
⟹
Number of paths is the number of ways to choose
n
steps up from
2
n
steps total
⟹
Number of paths is
(
2
n
n
)
"Good" lattice paths
Each step in path satisfies
x
≥
y
Any "bad" path goes through the line
y
=
x
+
1
Every "bad" path can be represented as an "inversed" Lattice path from
(
−
1
,
1
)
⟹
Number of "bad" paths is
(
2
n
n
−
1
)
⟹
Number of "good" paths is
(
2
n
n
)
−
(
2
n
n
−
1
)
=
(
2
n
)
!
n
!
n
!
−
(
2
n
)
!
(
n
+
1
)
!
(
n
−
1
)
!
=
(
2
n
)
!
n
!
n
!
−
(
2
n
)
!
n
!
n
!
⋅
n
n
+
1
=
n
+
1
−
n
n
+
1
(
2
n
n
)
=
1
n
+
1
(
2
n
n
)
Catalan n-th number
∀
n
∈
N
:
C
n
=
1
n
+
1
(
2
n
n
)
Example
How many balanced sequences of
2
n
brackets are there?
Balanced sequence of brackets is:
1.
For any prefix
#
[
≥
#
]
2.
For the whole sequence
#
[
=
#
]
Let
[
be a step to the right
Let
]
be a step up
⟹
Number of balanced bracket sequences is a number of "good" Lattice paths
from
(
0
,
0
)
to
(
n
,
n
)
Which is equal to
n
-th
Catalan number
C
n
=
1
n
+
1
(
2
n
n
)