You are on page 1of 4

MAT214A

Friday 2/22
Spring 2019 10:55 am – 12:05 pm

Quiz on Section 3.1 today


Correction on Section 3-2 Homework: #5-11 all, 17-24 all, 40-50 even, 88-90 all

Recall - Section 3-1 Sequences and Stringsefin


 Sequences
A sequence is a special type of function; the domain is a set of integers. If s0, s1, s2, …, sn is a sequence the
numbers, 0, 1, 2, … are called indexes. Index 1 is the first element of the sequence, index 2 is second element
etc.

Sequence Defined by a Recurrence Equation


 Each term in the sequence is a function of previous terms.
 We can say that we have a solution to the recurrence relation if we have a non-recursive way to express
the terms.
 The initial conditions give the first term(s) of the sequence, before the recurrence part can take over.

Summation of Sequence (or Series)tion




Let { sn } n=0 be a sequence. Then ∑ sn = s 1 + s2 + s3 + . . . is the sum of the terms in the series.
n=0

Product of a Sequence


Let { sn } n=0 be a sequence. Then ∏ sn = s 1 * s2 * s3 * . . . is the product of the terms in the series.
n=0

Today: Finish Section 3-2


Last Part: Strings
A string is a finite sequence of elements.
Note: When talking about strings, they essentially work the same way as sequences, but with different
notation. Instead of the curly bracket notation, we name the strings (usually Greek letters) and we don’t use
commas to separate elements.

Example: let α = 1001 and β = 1101 they are both strings of length 4
The length of a string is denoted | |, so |α| = 4 and |β|=4

The string accbbb is different from the string ccabbb. Like sequences, order matters.
.
Repetitions can be specified with superscripts. For example: ccabbb may be written c 2ab3
The null string: is the string with no elements. It has length zero. The null string is denoted λ

Concatenation: The concatenation of two strings α and β is the string αβ formed by joining α and β.

Example: For α = 1001 and β = 1101, the concatenation of α and β, denoted αβ is 10011101
The concatenation of β and α, denoted βα is 11011001

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

Example: Let, X = {a, b, c}


α = ccabbb is a string over X

Substring:  a contiguous sequence of characters within a string.


Example: "the best of" is a substring of "It was the best of times".
Example: “add” is a substring of aaaddada

Do not confuse with a subsequence. A subsequence of a sequence s is when we choose certain terms in s in
the order that they appear.
Example: 2, 4, 8, 16 is a subsequence of 2, 4, 6, 8, 10, 12, 14, 16…2n…

Today:
A) Section 3-3 Relations
A relation is a set of ordered pairs
Note: A function f from X to Y is a special relation having properties:
#1 The domain of f is equal to X, the codomain is Y
#2 For each x∈ X there is exactly one y∈ Y, we write this as f(x) = y

Recall - Cartesian product


If X and Y are sets, we let X x Y denote the set of all ordered pairs (x,y) where x ∈ X and y ∈ Y. The Cartesian
product defines a set of all ordered arrangements of elements from sets in the Cartesian product.

Binary Relation: Let X and Y be two sets. A binary relation from X to Y is a subset of a Cartesian product X x Y.
• R  X x Y means R is a set of ordered pairs of the form (x,y) where x  X and y  Y.
• We use the notation x R y to denote (x,y)  R and x R y to denote (x,y)  R. If x R y, we say x is related to y by
R.

Note that relations do not have to be binary. We can have a Cartesian product for sets A, B, C. Let A be a set
of names, B a set of addresses, and C a set of telephone numbers. Then a set of 3-tuples  (name, address,
telephone number)   is a 3-ary (ternary) relation over A, B and C.

Example: Let A={a,b,c} and B={1,2,3}.


• Is R={(a,1),(b,2),(c,2)} a relation from A to B? Yes.
• Is Q={(1,a),(2,b)} a relation from A to B? No.
• Is P={(a,a),(b,c),(b,a)} a relation from A to A? Yes
Digraph
A digraph is a directed graph. The graph has a set of nodes(vertices) connected by edges, where the edges
have a direction associated with them.

Example: A = {2, 4, 7, 9}
Table below lists all ordered pairs in set A x A:

2 4 7 9
2 (2,2) (2,4) (2,7) (2,9)
4 (4,2) (4,4) (4,7) (4,9)
7 (7,2) (7,4) (7,7) (7,9)
9 (9,2) (9,4) (9,7) (9,9)

Choose a subset of these ordered pairs and create a relation: R = {(2,2) (2,4) (7,7) (7,2), (9,4)}
The relation R can be listed as a set or diagrammed using a digraph
The relation is built from the set A = {2,4,7,9}. We create nodes(vertices) at 2, 4, 7, 9

9 4

*can’t draw this here – see page 142 for another example*

---------------------------------stopped here ----------------------------------

You might also like