Summations (portions from Concrete Mathematics by Graham...

Preview:

Citation preview

Summations (portions fromConcrete Mathematicsby Graham,

Knuth, Patashnik)CSE 20— Nov. 1, 2005, Day 12

Neil Rhodes

UC San Diego

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.1

FunctionsGiven f : A → B:

Inverse Image of f

f−1(b) = {a : a ∈ A and f (a) = b}

Coimage is the partition ofA where all elements in ablock map to the same element ofB.

Coimage(f ) = { f−1(b) : b ∈ Image(f )}

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.2

Number of PartitionsGivenS = {a1,a2, . . . ,an}:

• How many partitions ofS are there?• How many partitions of sizek are there?

• If an is in a new block:• If an is in an existing block:

• S(n,k) or {nk} is theStirling number of the second

kind

S(n,k) =

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.3

Calculating S(n,k)1 2 3 4 5

12345

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.4

Number of FunctionsGiven setsA andB, how many functions are there ofthe form f : A → B where|Image(f )| = k?

• How many partitions ofA are there of sizek?• How many images are there of sizek?• How many ways to map the blocks of

Coimage(f ) to Image(f )?

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.5

Summing a Sequence• Specific sum

1+2+3+ · · ·+n−1+n

• General summation of a sequence ofterms:

a1+a2+ · · ·+an

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.6

Sigma Notation• Three-dots notation is vague and wordy.• Sigma notation is more compact:

n

∑k=1

k

• Parts of the notation• Summand• Index variable• Lower limit• Upper limit

• Sigma notation inline:∑nk=1k

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.7

Generalized Sigma Notation• Specify a condition that the index variable must

satisfy

∑1≤k≤n

k

• Compare:

∑1≤k≤100

k odd

k2

to:

49

∑k=0

(2k +1)2

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.8

Changing the Index Variable• Can always change from one variable to another

∑1≤k≤n

ak =

• What if we want to switch fromk to k +1?Compare:

∑1≤k≤n

ak =

to:

n

∑k=1

ak =

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.9

Zero Terms are OKWhich is better?

n−1

∑i=2

k(k−1)(n− k)

or

n

∑i=0

k(k−1)(n− k)

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.10

Using Iverson Notation• Iverson notation. True-or-false statement

enclosed in brackets. Value is 0 or 1

[p odd] =

• Example

∑1≤k≤100

k odd

k2 = ∑k

k2[1≤ k ≤ 100][k odd]

• 0 in Iverson notation isvery strongly zero

∑k

1k[k > 0]

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.11

Products• Pi notation is similar to Sigma notation

n

∏k=1

k = 1×2×3×·· ·× (n−1)×n

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.12

Working with SummationsDistributive law

∑k∈K

cak = c ∑k∈K

ak

Associative law

∑k∈K

ak +bk = ∑k∈K

ak + ∑k∈K

bk

Commutative law

∑k∈K

ak = ∑p(k)∈K

ak

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.13

Closed Forms for SummationsClosed form is a formula for a summation, with thesummation removed.

∑0≤k≤n

k =n(n+1)

2

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.14

Example

∑0≤k≤n

(a+bk) =

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.15

Perturbation MethodGivenSn = ∑0≤k≤n ak, rewriteSn+1 by splitting offfirst and last term:

Sn +an+1 = a0+ ∑1≤k≤n+1

ak

= a0+ ∑1≤k+1≤n+1

ak+1

= a0+ ∑0≤k≤n

ak+1

Then, work on last sum and express in terms ofSn.

Finally, solve forSn.

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.16

Perturbation Method Example

Sn = ∑0≤k≤n

xk

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.17

Standard Closed FormsArithmetic series

n

∑k=0

k =12

n(n+1)

Sum of squares and cubes

n

∑k=0

k2 =n(n+1)(2n+1)

6n

∑k=0

k3 =n2(n+1)2

4

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.18

Standard Closed FormsGeometric series (x 6= 1)

n

∑k=0

xk =xn+1−1

x−1

Infinite Geometric series (|x| < 1)

∑k=0

xk =1

1− x

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.19

Standard Closed FormsHarmonic series

Hn =n

∑k=0

1k≈ lnn

n 0 1 2 3 4 5 6Hn 0 1 3

2116

2512

13760

4920

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.20

Application of Harmonic SeriesGiven a set of 52 playing cards (of length 2 units). Can

you stack them overlapping so the top card completely

overhangs the table?

Summations (portions from Concrete Mathematics by Graham, Knuth, Patashnik) – p.21

Recommended