Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
이산수학(Discrete Mathematics)
수열과 합
(Sequences and Summations)
강원대학교 컴퓨터과학전공 문양세
Introduction
3.2 Sequences and Summations
A sequence or series is just like an ordered n-tuple (a1, a2,
…, an), except:
• Each element in the sequences has an associated index number.
(각 element는 색인(index) 번호와 결합되는 특성을 가진다.)
• A sequence or series may be infinite. (무한할 수 있다.)
• Example: 1, 1/2, 1/3, 1/4, …
A summation is a compact notation for the sum of all
terms in a (possibly infinite) series. ()
Page 2
Discrete Mathematics
by Yang-Sae Moon
Sequences
3.2 Sequences and Summations
Formally: A sequence {an} is identified with a generating
function f:SA for some subset SN (S=N or S=N{0}) and
for some set A. (수열 {an}은 은 자연수 집합으로부터 A로의 함수…)
If f is a generating function for a sequence {an}, then for
nS, the symbol an denotes f(n).
The index of an is n. (Or, often i is used.)
S
f
A
a1 = f(1)
a2 = f(2)
a3 = f(3)
a4 = f(4)
1
2
3
4
Page 3
Discrete Mathematics
by Yang-Sae Moon
Sequence Examples
3.2 Sequences and Summations
Example of an infinite series
(무한 수열)
• Consider the series {an} = a1, a2, …, where (n1) an= f(n) = 1/n.
• Then, {an} = 1, 1/2, 1/3, 1/4, …
Example with repetitions
(반복 수열)
• Consider the sequence {bn} = b0, b1, … (note 0 is an index)
where bn = (1)n.
• {bn} = 1, 1, 1, 1, …
• Note repetitions! {bn} denotes an infinite sequence of 1’s and 1’s,
not the 2-element set {1, 1}.
Page 4
Discrete Mathematics
by Yang-Sae Moon
Recognizing Sequences (1/2)
3.2 Sequences and Summations
Sometimes, you’re given the first few terms of a sequence,
and you are asked to find the sequence’s generating
function, or a procedure to enumerate the sequence.
(순열의 몇몇 값들에 기반하여 f(n)을 발견하는 문제에 자주 직면하게 된다.)
Examples: What’s the next number and f(n)?
• 1, 2, 3, 4, … (the next number is 5. f(n) = n
• 1, 3, 5, 7, … (the next number is 9. f(n) = 2n − 1
Page 5
Discrete Mathematics
by Yang-Sae Moon
Recognizing Sequences (2/2)
3.2 Sequences and Summations
Trouble with recognition (of generating functions)
• The problem of finding “the” generating function given just an
initial subsequence is not well defined. (잘 정의된 방법이 없음)
• This is because there are infinitely many computable functions that
will generate any given initial subsequence.
(세상에는 시퀀스를 생성하는 셀 수 없이 많은 함수가 존재한다.)
Page 6
Discrete Mathematics
by Yang-Sae Moon
What are Strings? (1/2) - skip
3.2 Sequences and Summations
Strings are often restricted to sequences composed of
symbols drawn from a finite alphabet, and may be indexed
from 0 or 1.
(스트링은 유한한 알파벳으로 구성된 심볼의 시퀀스이고, 0(or 1)부터 색인될 수 있다.)
More formally,
• Let be a finite set of symbols, i.e. an alphabet.
• A string s over alphabet is any sequence {si} of symbols, si,
indexed by N or N{0}.
• If a, b, c, … are symbols, the string s = a, b, c, … can also be
written abc …(i.e., without commas).
• If s is a finite string and t is a string, the concatenation of s with t,
written st, is the string consisting of the symbols in s followed by
the symbols in t.
Page 7
Discrete Mathematics
by Yang-Sae Moon
What are Strings? (2/2) - skip
3.2 Sequences and Summations
More string notation
• The length |s| of a finite string s is its number of positions (i.e., its
number of index values i).
• If s is a finite string and nN, sn denotes the concatenation of n
copies of s. (스트링 s를 n번 concatenation하는 표현)
• denotes the empty string, the string of length 0.
• If is an alphabet and nN,
− n {s | s is a string over of length n}
(길이 n인 스트링)
− * {s | s is a finite string over } (상에서 구현 가능한 유한 스트링)
Page 8
Discrete Mathematics
by Yang-Sae Moon
Summation Notation
3.2 Sequences and Summations
Given a sequence {an}, an integer lower bound j0, and an
integer upper bound kj, then the summation of {an} from
j to k is written and defined as follows:
({an}의 i번째에서 j번째까지의 합, 즉, aj로부터 ak까지의 합)
k
a
k
i
i j
i j
ai : a j a j 1 ... ak
Here, i is called the index of summation.
Page 9
Discrete Mathematics
by Yang-Sae Moon
Generalized Summations
3.2 Sequences and Summations
For an infinite series, we may write:
a
i
i j
: a j a j 1 ...
To sum a function over all members of a set X={x1, x2, …}:
(집합 X의 모든 원소 x에 대해서)
f( x ) : f( x ) f( x
1
2
) ...
xX
Or, if X={x|P(x)}, we may just write:
(P(x)를 true로 하는 모든 x에 대해서)
f ( x ) : f ( x ) f ( x
1
2
) ...
P( x )
Page 10
Discrete Mathematics
by Yang-Sae Moon
Summation Examples
3.2 Sequences and Summations
A Simple example
4
i 2
i 2 1 (2 2 1) (32 1) (4 2 1)
(4 1) (9 1) (16 1)
5 10 17
32
An infinite sequence with a finite sum:
i
0
1
1
1
2
2
2
...
1
2
4 ... 2
i 0
Using a predicate to define a set of elements to sum over:
2
x
2 2 32 52 7 2 4 9 25 49 87
( x is pr ime x 10)
Page 11
Discrete Mathematics
by Yang-Sae Moon
Summation Manipulations (1/2)
3.2 Sequences and Summations
Some useful identities for summations:
(Distributive law)
cf (x ) c f (x )
x
x
f ( x ) g( x ) f ( x ) g ( x )
x
x
x
k
k n
i j
i j n
f (i ) f (i n)
(Application of
commutativity)
(Index shifting)
Page 12
Discrete Mathematics
by Yang-Sae Moon
Summation Manipulations (2/2)
3.2 Sequences and Summations
Some more useful identities for summations:
k
m
f (i ) f (i ) f (i )
i j
i j
i m 1
k
k
(Series splitting)
k j
f (i ) f ( k i )
i j
i 0
2k
k
(Order reversal)
f (i ) f ( 2i ) f ( 2i 1)
i 0
if j m k
(Grouping)
i 0
Page 13
Discrete Mathematics
by Yang-Sae Moon
An Interesting Example
3.2 Sequences and Summations
“I’m so smart; give me any 2-digit number n, and I’ll add
all the numbers from 1 to n in my head in just a few
seconds.”
(1에서 n까지의 합을 수초 내에 계산하겠다!)
n
I.e., Evaluate the summation:
i
i 1
There is a simple formula for the result, discovered by
Euler at age 12!
Page 14
Discrete Mathematics
by Yang-Sae Moon
Euler’s Trick, Illustrated
3.2 Sequences and Summations
Consider the sum:
1 + 2 + … + (n/2) + ((n/2)+1) + … + (n-1) + n
n+1
…
n+1
n+1
n/2 pairs of elements, each pair summing to n+1, for a
total of (n/2)(n+1).
(합이 n+1인 두 쌍의 element가 n/2개 있다.)
n( n 1)
i
2
i 1
n
Page 15
Discrete Mathematics
by Yang-Sae Moon
Symbolic Derivation of Trick (1/2) - skip
3.2 Sequences and Summations
n
k
k n ( k 1)
i i i i i (i ( k 1))
i 1
i 1
i 0
i 1 i k 1 i 1
n
2k
i
i 1
k
n ( k 1)
(( n ( k 1)) i ) ( k 1))
i 0
k
k j
i j
i 0
f (i ) f ( k i )
k
k
i 0
i 0
f (i ) f ( k i )
k n ( k 1)
k n k
i ( n i ) i ( n (i 1))
i 0
i 1
i 1 i 1
k n k
k k
i ( n 1 i ) i ( n 1 i ) ...
i 1 i 1
i 1 i 1
since n 2k
Page 16
Discrete Mathematics
by Yang-Sae Moon
Symbolic Derivation of Trick (2/2) - skip
3.2 Sequences and Summations
k
k k
i i ( n 1 i ) (i n 1 i )
i 1
i 1
i 1 i 1
n
k
( n 1) k( n 1) n2 ( n 1)
i 1
n( n 1) / 2
So, you only have to do 1 easy multiplication in your head,
then cut in half.
Also works for odd n (prove it by yourself).
Page 17
Discrete Mathematics
by Yang-Sae Moon
Geometric Progression (등비수열)
3.2 Sequences and Summations
A geometric progression is a series of the form a, ar, ar2,
ar3, …, ark, where a,rR.
The sum of such a sequence is given by:
k
S ar i
i 0
We can reduce this to closed form via clever manipulation
of summations...
Page 18
Discrete Mathematics
by Yang-Sae Moon
Derivation of Geometric Sum (1/3) - skip
3.2 Sequences and Summations
n
S ar i
i 0
n
n
n
n
i 0
i 0
i 0
i 0
rS r ar i rar i arr i ar 1r i
n
n 1
n 1
i 0
i 1
i 1
ar 1i ar 1( i 1) ar i
n 1
n
n
i
i
i
ar ar ar ar n 1 ...
i 1
i n 1
i 1
Page 19
Discrete Mathematics
by Yang-Sae Moon
Derivation of Geometric Sum (2/3) - skip
3.2 Sequences and Summations
n
n
i
n 1
0
0
i
rS ar ar ( ar ar ) ar ar n 1
i 1
i 1
n
i
ar ar ar n 1 ar 0
i 1
0
n
0
i
i
ar ar ar n 1 a
i 0
i 1
n
i
ar a( r n 1 1) S a( r n 1 1)
i 0
Page 20
Discrete Mathematics
by Yang-Sae Moon
Derivation of Geometric Sum (3/3) - skip
3.2 Sequences and Summations
rS S a( r n 1 1)
rS S a( r n 1 1)
S( r 1) a( r n 1 1)
r n 1 1
S a
r 1
when r 1
n
n
n
i 0
i 0
i 0
when r 1, S ar i a1i a 1 ( n 1)a
Page 21
Discrete Mathematics
by Yang-Sae Moon
Nested Summations
3.2 Sequences and Summations
These have the meaning you’d expect.
4 3
4
3
ij ij i j i 1 2 3
i 1 j 1
i 1 j 1
i 1 j 1 i 1
4
3
4
4
4
i 1
i 1
6i 6 i 6(1 2 3 4 )
6 10 60
Page 22
Discrete Mathematics
by Yang-Sae Moon
Some Shortcut Expressions
Sum
n
ar
k
,r 1
k 0
n
3.2 Sequences and Summations
Closed Form
a( r n1 1)
( r 1)
k
n( n 1)
2
2
k
n( n 1)( 2n 1)
6
k
n 2 ( n 1)2
4
k 1
n
k 1
n
3
k 1
k
x
,x 1
k 0
kx
k 1
k 1
,x 1
1
1 x
1
(1 x )2
Page 23
Infinite series
(무한급수)
Discrete Mathematics
by Yang-Sae Moon
Infinite Series (무한급수) (1/2) - skip
3.2 Sequences and Summations
n
x
n0 , x 1
x k 1 1
• Let a = 1 and r = x, then n0 kx
x 1
k
n
ar k 1 a
n
j
since j 0 ar
r 1
• If k , then xk+1 0
• Therefore,
1
1
n 0 x x 1 1 x
n
Page 24
Discrete Mathematics
by Yang-Sae Moon
Infinite Series (무한급수) (2/2) - skip
3.2 Sequences and Summations
n 1
kx
n0 , x 1
1
n 0 x 1 x
n
d
d 1
n
x
n 0
dx
dx 1 x
n 1 nx
n 1
1
(1 x )2
Page 25
d n
x nx n 1
dx
recall
d
f ' ( x )g( x ) f ( x )g' ( x )
f
(
x
)
( g( x ))2
dx
Discrete Mathematics
by Yang-Sae Moon
Using the Shortcuts
3.2 Sequences and Summations
100
Example: Evaluate
2
k
.
k 50
• Use series splitting.
• Solve for desired
summation.
• Apply quadratic
series rule.
• Evaluate.
100
49
2
2
2
k
k
k
k 1
k 1 k 50
100
49
100
2
2
2
k
k
k
k 50
k 1 k 1
100 101 201 49 50 99
6
6
338 ,350 40,425
100
297 ,925 .
Page 26
Discrete Mathematics
by Yang-Sae Moon
Cardinality: Formal Definition
3.2 Sequences and Summations
For any two (possibly infinite) sets A and B, we say that A
and B have the same cardinality (written |A|=|B|) iff
there exists a bijection (bijective function) from A to B.
(집합 A에서 집합 B로의 전단사함수가 존재하면, A와 B의 크기는 동일하다.)
When A and B are finite, it is easy to see that such a
function exists iff A and B have the same number of
elements nN.
(집합 A, B가 유한집합이고 동일한 개수의 원소를 가지면, A와 B가 동일한 크기
임을 보이는 것은 간단하다.)
Page 27
Discrete Mathematics
by Yang-Sae Moon
Countable versus Uncountable
3.2 Sequences and Summations
For any set S, if S is finite or if |S|=|N|, we say S is
countable. Else, S is uncountable.
(유한집합이거나, 자연수 집합과 크기가 동일하면 countable하며, 그렇지 않으
면 uncountable하다.)
Intuition behind “countable:” we can enumerate
(sequentially list) elements of S. Examples: N, Z.
(집합 S의 원소에 번호를 매길 수(순차적으로 나열할 수) 있다.)
Uncountable means: No series of elements of S (even an
infinite series) can include all of S’s elements.
Examples: R, R2
(어떠한 나열 방법도 집합 S의 모든 원소를 포함할 수 없다. 즉, 집합 S의 원소에
번호를 매길 수 있는 방법이 없다.)
Page 28
Discrete Mathematics
by Yang-Sae Moon
Countable Sets: Examples – skip
3.2 Sequences and Summations
Theorem: The set Z is countable.
• Proof: Consider f:ZN where f(i)=2i for i0 and f(i) = 2i1 for i<0.
Note f is bijective. (…, f(2)=3, f(1)=1, f(0)=0, f(1)=2, f(2)=4, …)
Theorem: The set of all ordered pairs of natural numbers
(n,m) is countable.
(1,1)
(2,1)
(3,1)
(4,1)
(5,1)
…
(1,2)
(2,2)
(3,2)
(4,2)
(5,2)
…
(1,3)
(2,3)
(3,3)
(4,3)
(5,3)
…
(1,4)
(2,4)
(3,4)
(4,4)
(5,4)
…
(1,5)
(2,5)
(3,5)
(4,5)
(5,5)
…
…
…
…
…
…
…
Page 29
consider sum
consider sum
consider sum
consider sum
consider sum
consider …
is
is
is
is
is
2, then
3, then
4, then
5, then
6, then
Note a set of rational
numbers is countable!
Discrete Mathematics
by Yang-Sae Moon
Uncountable Sets: Example (1/2) – skip
3.2 Sequences and Summations
Theorem: The open interval
[0,1) : {rR| 0 r < 1} is uncountable. ([0,1)의 실수는 uncountable)
Proof by Cantor
•
Assume there is a series {ri} = r1, r2, ... containing all elements r[0,1).
•
Consider listing the elements of {ri} in decimal notation in order of
increasing index:
r1 = 0.d1,1 d1,2 d1,3 d1,4 d1,5 d1,6 d1,7 d1,8…
r2 = 0.d2,1 d2,2 d2,3 d2,4 d2,5 d2,6 d2,7 d2,8…
r3 = 0.d3,1 d3,2 d3,3 d3,4 d3,5 d3,6 d3,7 d3,8…
r4 = 0.d4,1 d4,2 d4,3 d4,4 d4,5 d4,6 d4,7 d4,8…
…
•
Now, consider r’ = 0.d1 d2 d3 d4 … where di = 4 if dii 4 and di = 5 if dii = 4.
Page 30
Discrete Mathematics
by Yang-Sae Moon
Uncountable Sets: Example (2/2) – skip
•
3.2 Sequences and Summations
E.g., a postulated enumeration of the reals:
r1 = 0.3 0 1 9 4 8 5 7 1 …
r2 = 0.1 0 3 9 1 8 4 8 1 …
r3 = 0.0 3 4 1 9 4 1 9 3 …
r4 = 0.9 1 8 2 3 7 4 6 1 …
…
•
OK, now let’s make r’ by replacing dii by the rule.
(Rule: r’ = 0.d1 d2 d3 d4 … where di = 4 if dii 4 and di = 5 if dii = 4)
• r’ = 0.4454… can’t be on the list anywhere!
• This means that the assumption({ri} is countable) is wrong,
and thus, [0,1), {ri}, is uncountable.
Page 31
Discrete Mathematics
by Yang-Sae Moon