cse20: discrete mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/hw/seq.pdf · summary today:...

28
CSE20: Discrete Mathematics Daniele Micciancio Spring 2018 Daniele Micciancio CSE20: Discrete Mathematics

Upload: others

Post on 24-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

CSE20: Discrete Mathematics

Daniele Micciancio

Spring 2018

Daniele Micciancio CSE20: Discrete Mathematics

Page 2: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 3: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 4: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 5: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 6: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 7: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 8: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 9: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 10: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 11: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 12: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 13: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 14: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 15: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 16: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 17: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 18: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 19: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 20: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 21: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 22: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 23: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 24: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 25: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 26: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 27: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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

Page 28: CSE20: Discrete Mathematicscseweb.ucsd.edu/classes/sp18/cse20-a/HW/Seq.pdf · Summary Today: Sequences,Summations Reading: Chap. 2.4(Optionalreading: Chap. 2.5,2.6) Nexttime: Chap

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