Sequences Sequences (examples) • • • • 1,2,3,4,5,6, 1,3,5,7,9,11,13 2,4,6,8,10,12,14 1,1,2,3,5,8,13 Sequences • Characteristics – Arranged in a definite order – Finite or Infinite – Elements may be distinct, or repeated • Example: – S,U,P,E,R,M,A,N = distinct elements – Number 15 in binary representation = 001111 » 0’s as first and second elements, 1’s as third, fourth, fifth and sixth elements – 1,3,5,7,9,… = infinite distinct elements ( “…” means and so on) Try these • Predict the next element of the following sequences – 1, 3, 5, 7, 9, … – 2, 4, 6, 8, 10, 12, ….. – 1, 1, 2, 3, 5, 8, 13, …. – 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, ... Sequences • 2 kinds – Recursive - Refers to previous terms to define the next terms. Every recursive formula must include a starting place – Explicit - Refers to position of elements in the sequence. For example, the nth element will be referred as an Sequences: Recursive formula Write recursive formula for the following sequences: Hint:**previous term, next term & starting point 1. 2, 6, 10, 14, 18, 22, … 2. 3, 9, 15, 21, 27, … 3. 5, 1, -3, -7, -11 Sequences: Explicit formula • Write explicit formula for the following sequences: • 2, 4, 8, 16, 32, … • 1, 4, 9, 16, 25, … • -3, 1, 5, 9, … Sequences • May also contain alphabets or words – Example: • “INTERNET” = a finite sequence of an English word – I,N,T,E,R,N,E,T • “TODAY IS A BEAUTIFUL DAY” = sequence of words, called strings – “TODAY, IS, A, BEUATIFUL, DAY” Set Corresponding to a Sequence • Refers to the set of all distinct elements in the sequence – Example: 1,0,0,1,0,1,0,0,1,1,1 • Set corresponding = {1,0} or {0,1} • Try these – B,A,N,A,N,A – D,I,S,C,R,E,T,E,S,T,R,U,C,T,U,R,E – S,E,H,A,T,I,S,E,J,I,W,A Characteristic Functions • A function on a set that assigns some ‘value’ to each element of the set • If A is a subset of a universal set U, the characteristic function, fA is defined as: 1 if x A fA (x) = 0 if x A • We may add and multiply characteristic functions, since their values are numbers Theorems… 1. f A ∩ B = fAfB ; that is f A ∩ B (x) = fA(x)fB(x) for all x 2. f A ᴜ B = fA + fB - fAfB ; that is f AᴜB (x) = fA(x) + fB(x) - fA(x)fB(x) for all x 3. f A⊕B = fA + fB - 2 fAfB ; that f A⊕B (x) = fA(x) + fB(x) - 2 fA(x)fB(x) for all x Computer representation of sets & subsets • To represent a set in a computer, elements of the sets must be arranged in a sequence • When a universal set is finite, U = {x1, x2, x3, …, xn}, then characteristics function assigns 1 for xi that belongs to A and 0 for xi that does not belong to A. • Thus, fA can be represented by 0’s and 1’s of length n. Computer representation of sets & subsets • Example: – U = {1,2,3,4,5,6,7,8,9} – A = {2,3,5} fA = 0 1 1 0 1 0 0 0 0 – B = {1,3,5,7} fB = 1 0 1 0 1 0 1 0 0 – C = {8} fC = 0 0 0 0 0 0 0 1 0 Try these… • Recursive formula – Write the recursive formula for the following sequence • 2, 4, 6, 8, 10 • 3, 9, 27, 81 • 2, 5, 26, 677 Try these… • Recursive formula – Write the first four terms for the following formula • a1 = 4, an = an-1 + 5 • a1 = -3, an = (an-1)3 Try these… • Explicit formula – Write the recursive formula for the following sequence • 2, 4, 6, 8, 10 • 3, 9, 27, 81 • 4, 24, 124, 624