0% found this document useful (0 votes)
124 views11 pages

Topic 4 Sequenceand Strings

1. Sequences are ordered lists where the order of elements is important. They are represented by functions where the domain is the set of positive integers or integers from 1 to n. 2. Common sequence operations include finding individual terms, taking the sum or product of terms, and identifying subsequences which are sequences formed by selecting terms from the original sequence while maintaining their order. 3. Examples demonstrate increasing, decreasing, and constant sequences as well as operations like finding sums and products of sequence terms. Subsequences are identified from larger sequences by selecting specific terms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views11 pages

Topic 4 Sequenceand Strings

1. Sequences are ordered lists where the order of elements is important. They are represented by functions where the domain is the set of positive integers or integers from 1 to n. 2. Common sequence operations include finding individual terms, taking the sum or product of terms, and identifying subsequences which are sequences formed by selecting terms from the original sequence while maintaining their order. 3. Examples demonstrate increasing, decreasing, and constant sequences as well as operations like finding sums and products of sequence terms. Subsequences are identified from larger sequences by selecting specific terms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Topic X Sequence

4 and Strings

LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Describe the concept of sequence and operations on sequences;
and
2. Describe the concept of strings and operations on strings.

X INTRODUCTION
Sequences are used to represent ordered list of elements. A list of the letters as
they appear in a word (or normally called a string) is an example of sequence,
since the word „form‰ and „from‰ are two different words although both of them
consists of the same letters. The concept of sequence and strings will be the
subject of this topic.

4.1 SEQUENCE
SELF-CHECK 4.1

What are strings? Are strings often restricted to sequence?

A sequence is a list in which order is taken into account. It is a special type of


function. The formal definition of a sequence is as follows:
52 X TOPIC 4 SEQUENCE AND STRINGS

Definition 4.1a: A sequence whose smallest index is 1 is a function whose


domain is either the set of all positive integers or a set of the form {1 . n}.

If s is a sequence, we denote the first element as s1, the second element as s2,
and so on. In general, sn denotes the nth element.

4.1.1 Examples of Sequence


Example 4.1a

The ordered list 2, 4, 6, . 2n.. is a sequence. The first element is 2, the second
element is 4 and so on. The nth element is 2n. If we let s denote this sequence, we
have

S1 = 2 S2 = 4 S3 = 6 Sn = 2n

Figure 4.1: Ordered list sequence

Example 4.1b

KLIA Shuttle Inc. charges RM 1 for the first km and 50 cents for each additional
km. In general, the cost Cn of traveling n km is 1.00 (the cost of traveling the first
km) plus 0.50 times the number (n  1) of additional km. That is,

Cn = 1 + 0.5 (n  1)

For example:

C1 = 1 + 0.5 (1  1)
= 1 + 0.5 (0)
=1

C5 = 1 + 0.5 (5  1)
= 1 + 0.5 (0)
=3

The list fare in the example above is in sequence.

A sequence can have repetitions.


TOPIC 4 SEQUENCE AND STRINGS W 53

Example 4.1c

The ordered list a, a, b, a, b. is a sequence. The first element of the sequence is a,
the second element of the sequence is a and so on. If we denote this sequence, we
have

h1 = a h2 = a h3 = b hn = a h5 = b

Figure 4.2: Ordered list

An alternative notation for the sequence s is ¢sn². Here, s or ¢sn² denotes the
entire sequence s1, s2, s3,  We use the notation sn to denote the single, nth
element of the sequence s.

Define a sequence ¢tn² by the rule tn = n2 Qtthe first five terms of this
sequence are

0 3 8 15 24

Figure 4.3: Sequence of tn by the rule tn = n  1

The 55th term is

T55 = 552  1 = 3024

Example 4.1e

Define a sequence u by the rule un is the nth letter in the word digital. Then u1 =
d, u2 = u4 = i and u7 = l. This sequence is a finite sequence.

Word d i g i t a l
Sequence U1 U2 U3 U4 U5 U6 U7

Example 4.1f

If x is the sequence defined by

xn = n , 1 dn d 4

The elements of x are


2, 1, 1 2 , 1 4 , 1 8 , 1 16
54 X TOPIC 4 SEQUENCE AND STRINGS

4.1.2 Types of Sequence


Two important types of sequence are increasing sequence and decreasing
sequence.

Types of sequence

Decreasing sequence Increasing sequence

Figure 4.4: Types of sequence

Definition 4.1b: A sequence s is increasing if sn d sn+1 all n.

Example 4.1g
The sequence 2,4,6,  is increasing since sn = 2n d 2(n+1) = sn+1 for all n.
Example 4.1h
The sequence s
3, 5, 5, 7, 8, 8, 13.
Is increasing since sn d sn+1 for all n.

Definition 4.1c: A sequence s is decreasing if sn t sn+1 for all n.

Example 4.1i

The sequence 2, 1, 1 1 1 n  t 1 n+1 = x n+1 for


2, 4 , is decreasing since xn = 2 2
all n.
TOPIC 4 SEQUENCE AND STRINGS W 55

4.1.3 Subsequence
One way to form a new sequence from a given sequence is to retain only certain
terms of the original sequence, maintaining the order terms in the given
sequence. The resulting sequence is called a subsequence of the original sequence.

Definition 4.1d: Let ¢sn² be a sequence defined for n = m, m + 1,  and let n1,
n2,  be an increasing sequence satisfying nk nk+1, for all k, whose values
are in the set { m, m + 1,  }. We all the sequence ¢snk² a subsequence of ¢sn² .

Example 4.1j

The sequence
b, c
is a subsequence of the sequence
aabcq
Notice that the sequence
c, b
is not a subsequence of the sequence.
Table 4.2 illustrates the example:
Table 4.2: Example 4.1j

Sequence b,c

Subsequence of sequence a,b b,c c,q

Therefore, c,b is not a subsequence of the sequence

Example 4.1k

The sequence
2, 4, 8, 16
is a subsequence of the sequence
2, 4, 6, 8, 10, 12, 14, 16.
56 X TOPIC 4 SEQUENCE AND STRINGS

ACTIVITY 4.1
1. The sequence S is defined by
c, d, d, c, d, c
(a) Find s1
(b) Find s4

2. The sequence k is defined by


kn = 2n - 1, n > 1
(a) Find k3
(b) Find k100
(c) Find k7
(d) Find k2077
(e) Is k increasing or descreasing?

3. The sequence r defined by


rn = 3.2 n 4.5n , n t 1
(a) Find r0
(b) Find r1
(c) Find r2
(d) Find r3
(e) Find a formula for rp
(f) Find a formula for rn-2
(g) Show that { rn } satisfies
rn = 7rn 110rn2Ê n > 2
(h) Is r in increasing or decreasing?

4. Define ¢ tn² by the rule


sn = 2n  1, n > 1
The Subsequence of s obtained by taking first, third, fifth, terms
(a) List the first seven terms of s
(b) List the first seven terms of the subsequence
(c) Find a formula for the expression nk of definition 4.1d
(d) Find a formula for the kth term of the subsequence
TOPIC 4 SEQUENCE AND STRINGS W 57

4.2 SEQUENCE OPERATION


n
Definition 4.2a: if a i i=m
is a subsequence, we define the sum and product of
terms in the sequence as
n n

i=m
¦ ai a m  a m+1 + ... + a n , –a
i=m
i a m x a m+1 x ... x a n

Example 4.2a
Let a be sequence defined by an = 2n, nt1. Then

3 3

¦
i =1
a i = a1  a 2 + a 3 = 2 + 4 + 6 = 12 –a
i=1
i = a1 x a 2 x a 3 = 2 x 4 x 6 = 48

Example 4.2b

The geometric sum


a + ar + ar2 +  + arn
can be rewritten compactly using the sum notation as
n

¦ ar
i =0
i

Example 4.2c

Let a be the sequence defined by the rule an = 2(1)n, where n >1. find a formula
for the sequence s defined by

n
Sn ¦ ar
i=0
i

We find that
Sn = 2(1)1 + 2(-1)2 + 2(-1)2 +  + 2(-1)n
= 2 2 + 2  +(-1)n 2 = 2 if n is even
0 if n is odd
58 X TOPIC 4 SEQUENCE AND STRINGS

ACTIVITY 4.2

1. The sequence g is defined by

gn=n2 - 3n + 3, n > 1

4
(a) Find ¦g
i =1
i

5
(b) Find ¦g
i =3
i

6
(c) Find ¦g
k =1
k

2
(d) Find –g
i =1
i

3
(e) Find –g
i =1
i

2. the sequence v is defined by vn = n(1)n


4
(a) Find ¦v
i =1
i

10
(b) Find ¦v
i =1
i

(c) Find a formula for the sequence c defined by


n
cn ¦v
i =1
i

(d) Find a formula for the sequence d defined by


n
dn = –v
i =1
i

3. Rewrite the sum


n

¦v v
i =1
2 n-i

Replacing the index i by k, where i = k+1


TOPIC 4 SEQUENCE AND STRINGS W 59

4.3 STRING
ACTIVITY 4.3

Let X={a,c,e,i,m,s,t}. Find the sequence if the string contains the


word „mathematics‰.

Definition 4.3a: A string over X is a finite sequence of elements from X.

Example 4.3a

Let X = {a, b, c}. If we let

q1 = b, q2 = a, q3 = a, q4 = c

We obtain a string over X. This string is written baac

q1 q2 q3 q4

b a a c

Figure 4.5: Sequence with order

Since a string is a sequence, order is taken into account. For example, the string
baac is different from the string acab.

Repetition in a string can be specified by superscripts. For example, the string


bbaaac may be written b2a3c.

Definition 4.3b: We let X * denotes the string of all strings over X,


including the null string, and we let X+ denotes the set of all nonnull
strings over X.

The string with no elements is called the null string and is denoted as O
60 X TOPIC 4 SEQUENCE AND STRINGS

Example 4.3b

Let X = {a, b}. Some elements in X* are

O, a, b, abab, b20a5 ba

Definition 4.3c: The length of a string Dis the number of elements inDthe
length ofDis denoted by| D |

Example 4.3c

If D = aabab and E = a3b4a32, then

| D| =5 and | E | = 39

If D and E are two strings, the string consisting of D followed by E, written DE,
is called the concatenation of D and E.

Example 4.3d

If t = aab and e = cabd, then

te = aabcabd, et = cabdaab, tO = t = aab,


Ot = t = aab.

ACTIVITY 4.4
Suppose we have three strings as follows
D = baab, E = caaba, J = bbab
(a) Write the string DE, DD, ED, E3D2J, J2E, DEJ, E2JD
(b) Compute the value of |DE|, |ED|, |DD|, |EE|
TOPIC 4 SEQUENCE AND STRINGS W 61

This PDF document contains notes about sequence and strings. If you have
installed acrobat reader on your PC you will be able to download the
notes and you can read it at anytime offline.

URL: http://cc.ee.ntu.edu.tw/~farn/courses/DM/slide/Module-11-
Sequences-color.pdf

You might also like