cse20: discrete mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/hw/seq.pdf · summary today:...
TRANSCRIPT
CSE20: Discrete Mathematics
Daniele Micciancio
Spring 2018
Daniele Micciancio CSE20: Discrete Mathematics
Summary
Today: Sequences, Summations
Reading: Chap. 2.4 (Optional reading: Chap. 2.5, 2.6)
Next time: Chap. 5 (Induction)
Daniele Micciancio CSE20: Discrete Mathematics
Sequences
A sequence in a set A is a series of values a0, a1, a2, a3, . . . all in A.
Equivalentely, a sequence is a function a : N→ A whereN = {0, 1, 2, 3, . . .} are the natural numbers,
Sometimes sequences are indexed starting from 0 or some otherinteger
More generally, one can consider sequences indexed by anarbitrary subset of Z
Examples:
Even numbers: E = 0, 2, 4, 6, 8, . . .. (ai = 2 ∗ i : i ≥ 0)Prime numbers: P = 2, 3, 5, 7, 11, 13, 17, . . .Powers of 2: 1, 2, 4, 8, 16, 32, . . .. (ai = 2i : i ≥ 0)Arithmetic progression: (ai = i ∗ b + c : i ≥ 0), e.g.,1, 4, 7, 10, 13, . . .Geometric progression: (ai = bi · c : i ≥ 0)
Daniele Micciancio CSE20: Discrete Mathematics
Sequences
A sequence in a set A is a series of values a0, a1, a2, a3, . . . all in A.
Equivalentely, a sequence is a function a : N→ A whereN = {0, 1, 2, 3, . . .} are the natural numbers,
Sometimes sequences are indexed starting from 0 or some otherinteger
More generally, one can consider sequences indexed by anarbitrary subset of Z
Examples:
Even numbers: E = 0, 2, 4, 6, 8, . . .. (ai = 2 ∗ i : i ≥ 0)Prime numbers: P = 2, 3, 5, 7, 11, 13, 17, . . .Powers of 2: 1, 2, 4, 8, 16, 32, . . .. (ai = 2i : i ≥ 0)Arithmetic progression: (ai = i ∗ b + c : i ≥ 0), e.g.,1, 4, 7, 10, 13, . . .Geometric progression: (ai = bi · c : i ≥ 0)
Daniele Micciancio CSE20: Discrete Mathematics
Summations
Sum of the numbers from 1 to n:
an =n∑
i=1i = 1 + 2 + · · ·+ n
Sum of the first n odd numbers:
an =n∑
i=1i = 1 + 3 + 5 + · · ·+ (2n + 1)
Sum of the first n squares:
an =n∑
i=1(2i + 1) = 1 + 4 + 9 + 16 + · · ·+ n2
Daniele Micciancio CSE20: Discrete Mathematics
Summing over a sequence
Sum of the first n terms of a sequence (ai)i≥1 over R:
bn =n∑
i=1ai
This operation defines a function from sequences to sequences:
f ((an)n≥1) = (bn)n≥1
.
Is this function f injective (one-to-one)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) What?;
Is this function f surjective (onto)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) Don’t know;
Daniele Micciancio CSE20: Discrete Mathematics
Summing over a sequence
Sum of the first n terms of a sequence (ai)i≥1 over R:
bn =n∑
i=1ai
This operation defines a function from sequences to sequences:
f ((an)n≥1) = (bn)n≥1
.
Is this function f injective (one-to-one)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) What?;
Is this function f surjective (onto)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) Don’t know;
Daniele Micciancio CSE20: Discrete Mathematics
Summing over a sequence
Sum of the first n terms of a sequence (ai)i≥1 over R:
bn =n∑
i=1ai
This operation defines a function from sequences to sequences:
f ((an)n≥1) = (bn)n≥1
.
Is this function f injective (one-to-one)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) What?;
Is this function f surjective (onto)?
(A) Yes; (B) No; (C) It depends on (an)n; (D) Don’t know;Daniele Micciancio CSE20: Discrete Mathematics
Example (prefix sums)
sums : (an)n≥1 7→ (n∑
i=1ai)n≥1
If A = (1, 2, 3, 4, 5, 6, . . .), then sums(A) equals
(A) (1, 2, 3, 4, 5, 6, . . .)
(B) (1, 3, 6, 10, 15, 21, . . .)
(C) (0, 1, 3, 6, 10, 15, 21, . . .)
(D) (1, 3, 6, 10, 16, 22, . . .)
Daniele Micciancio CSE20: Discrete Mathematics
Example (consecutive differences)
diffs : (bn)n≥1 7→ (bn − bn−1)n≥1 where b0 = 0
If B = (0, 1, 2, 3, 4, 5, 6, . . .), then diffs(A) equals
(A) (0, 1, 2, 3, 4, 5, 6, . . .)
(B) (1, 1, 1, 1, 1, 1, . . .)
(C) (0, 1, 1, 1, 1, 1, . . .)
(D) (1, 2, 3, 4, 5, 6, . . .)
Daniele Micciancio CSE20: Discrete Mathematics
Sums and Diffs
sums, diffs : S → S where S = ZN = [N→ Z]
sums((an)n≥1) =( n∑
i=1ai
)n≥1
diffs((bn)n≥1) = (bn−bn−1)n≥1
diffs ◦ sums = id
sums ◦ diffs = id
diffs = sums−1 and sums, diffs are bijection from S to S.
sums and diffs are both injective and surjective.
Daniele Micciancio CSE20: Discrete Mathematics
Sums and Diffs
sums, diffs : S → S where S = ZN = [N→ Z]
sums((an)n≥1) =( n∑
i=1ai
)n≥1
diffs((bn)n≥1) = (bn−bn−1)n≥1
diffs ◦ sums = id
sums ◦ diffs = id
diffs = sums−1 and sums, diffs are bijection from S to S.
sums and diffs are both injective and surjective.
Daniele Micciancio CSE20: Discrete Mathematics
Sums and Diffs
sums, diffs : S → S where S = ZN = [N→ Z]
sums((an)n≥1) =( n∑
i=1ai
)n≥1
diffs((bn)n≥1) = (bn−bn−1)n≥1
diffs ◦ sums = id
sums ◦ diffs = id
diffs = sums−1 and sums, diffs are bijection from S to S.
sums and diffs are both injective and surjective.
Daniele Micciancio CSE20: Discrete Mathematics
Challenge problem
S = {(a1, a2, a3, . . .) : ∀i .ai ∈ Z}: set of integer sequencesZ = {(a1, . . . , an, 0, 0, 0, . . .) : a1, . . . , an ∈ Z} ⊆ S: subset ofsequences ending in 0sP = {(p(1), p(2), p(3), . . .) : p(x) =
∑ni=1 ai · · · x i} ⊆ S:
sequences obtained evaluating a polynomial with integercoefficients.f k(x) = f (f (. . . f (x))): function f : S → S applied k times
Claim: if A ∈ P, then ∃k ≥ 0 such that diffsk(A) ∈ Z
Claim: if A ∈ Z , then ∃k ≥ 0 such that sumsk(A) ∈ P
True? False? Can you prove it?
Daniele Micciancio CSE20: Discrete Mathematics
Challenge problem
S = {(a1, a2, a3, . . .) : ∀i .ai ∈ Z}: set of integer sequencesZ = {(a1, . . . , an, 0, 0, 0, . . .) : a1, . . . , an ∈ Z} ⊆ S: subset ofsequences ending in 0sP = {(p(1), p(2), p(3), . . .) : p(x) =
∑ni=1 ai · · · x i} ⊆ S:
sequences obtained evaluating a polynomial with integercoefficients.f k(x) = f (f (. . . f (x))): function f : S → S applied k times
Claim: if A ∈ P, then ∃k ≥ 0 such that diffsk(A) ∈ Z
Claim: if A ∈ Z , then ∃k ≥ 0 such that sumsk(A) ∈ P
True? False? Can you prove it?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n
2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)
2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)
2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)
X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s start with something simpler
Claim:∑n
i=1 i = 1 + 2 + 3 + . . . + n = n(n+1)2
X = 1 + 2 + 3 + . . . + n2X = (1 + 2 + 3 + . . . + n) + (n + . . . + 3 + 2 + 1)2X = (n + 1) + (n + 1) + . . . + (n + 1)2X = n · (n + 1)X = n(n + 1)/2
What’s the mathematical definition of “. . . ” ?
Daniele Micciancio CSE20: Discrete Mathematics
Let’s try a different one
Claim:∑n
i=1(2i − 1) = 1 + 3 + 5 + 7 + . . . + (2n − 1) = n2
∑ni=1(2i − 1) = 2(
∑ni=1)− n = 2n(n+1)
2 − n = n2
What about
n∑i=1
i2 = 1 + 4 + 9 + 16 + . . . + n2 =???
Daniele Micciancio CSE20: Discrete Mathematics
Let’s try a different one
Claim:∑n
i=1(2i − 1) = 1 + 3 + 5 + 7 + . . . + (2n − 1) = n2∑ni=1(2i − 1) = 2(
∑ni=1)− n = 2n(n+1)
2 − n = n2
What about
n∑i=1
i2 = 1 + 4 + 9 + 16 + . . . + n2 =???
Daniele Micciancio CSE20: Discrete Mathematics
Let’s try a different one
Claim:∑n
i=1(2i − 1) = 1 + 3 + 5 + 7 + . . . + (2n − 1) = n2∑ni=1(2i − 1) = 2(
∑ni=1)− n = 2n(n+1)
2 − n = n2
What about
n∑i=1
i2 = 1 + 4 + 9 + 16 + . . . + n2 =???
Daniele Micciancio CSE20: Discrete Mathematics
Linear RecurrencesPositive Integers: (1,2,3,4,5,. . . )
a1 = 1an+1 = an + 1
Odd Positive Integers: (1,3,5,7,. . . )
b1 = 1bn+1 = bn + 2
Fibonacci numbers: (1,1,2,3,5,8,13,. . . )
f1 = 1, f2 = 1fn+2 = fn + fn+1
fn = 1√5·((
1 +√5
2
)n
−(1−√5
2
)n)
True? False? Can you prove it?
Daniele Micciancio CSE20: Discrete Mathematics
Linear RecurrencesPositive Integers: (1,2,3,4,5,. . . )
a1 = 1an+1 = an + 1
Odd Positive Integers: (1,3,5,7,. . . )
b1 = 1bn+1 = bn + 2
Fibonacci numbers: (1,1,2,3,5,8,13,. . . )
f1 = 1, f2 = 1fn+2 = fn + fn+1
fn = 1√5·((
1 +√5
2
)n
−(1−√5
2
)n)
True? False? Can you prove it?Daniele Micciancio CSE20: Discrete Mathematics