CS285 · Chapter 2 · Annotated SlidesBasic Structures: Sets, Functions, Sequences, Sums, and Matrices
Original
Overview

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices

Sets (roster and set-builder notation, subsets, cardinality, power sets, Cartesian products), set operations and identities, functions (one-to-one, onto, bijections, inverses, composition, floor and ceiling), sequences and summations, recurrence relations, and matrices including zero-one matrices and Boolean products.

How to read this page

Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.

All 145 slides
  1. 1 Basic Structures: Sets, Functions,
  2. 2 Chapter Summary
  3. 3 Slide 3
  4. 4 Section Summary
  5. 5 Introduction
  6. 6 Sets
  7. 7 Describing Sets
  8. 8 Describing a Set: Roster Method
  9. 9 Roster Method
  10. 10 Set-Builder Notation
  11. 11 Interval Notation
  12. 12 Some Important Sets
  13. 13 Universal Set and Empty Set
  14. 14 John Venn (1834-1923) Cambridge, UK
  15. 15 Some things to remember
  16. 16 Set Equality
  17. 17 Subsets
  18. 18 Showing a Set is or is not a Subset of Another Set
  19. 19 Another look at Equality of Sets
  20. 20 Proper Subsets
  21. 21 Slide 21
  22. 22 Slide 22
  23. 23 Set Cardinality
  24. 24 Set Cardinality
  25. 25 Power Sets
  26. 26 Power Sets
  27. 27 Tuples
  28. 28 Ren é Descartes (1596-1650)
  29. 29 Cartesian Product
  30. 30 Slide 30
  31. 31 Slide 31
  32. 32 Slide 32
  33. 33 Truth Sets of Quantifiers
  34. 34 Slide 34
  35. 35 Section Summary
  36. 36 Boolean Algebra
  37. 37 Union
  38. 38 Intersection
  39. 39 Complement
  40. 40 Difference
  41. 41 The Cardinality of the Union of Two Sets
  42. 42 Review Questions
  43. 43 Symmetric Difference ( optional )
  44. 44 Set Identities
  45. 45 Set Identities
  46. 46 Set Identities
  47. 47 Proving Set Identities
  48. 48 Proof of Second De Morgan Law
  49. 49 Proof of Second De Morgan Law
  50. 50 Proof of Second De Morgan Law
  51. 51 Set-Builder Notation: Second De Morgan Law
  52. 52 Membership Table
  53. 53 Generalized Unions and Intersections
  54. 54 Slide 54
  55. 55 Section Summary
  56. 56 Functions
  57. 57 Functions
  58. 58 Functions
  59. 59 Representing Functions
  60. 60 Questions
  61. 61 Question on Functions and Sets
  62. 62 Injections
  63. 63 Surjections
  64. 64 Bijections
  65. 65 Slide 65
  66. 66 Showing that f is one-to-one or onto
  67. 67 Showing that f is one-to-one or onto
  68. 68 Injections, Surjections and Bijections
  69. 69 Injections, Surjections and Bijections
  70. 70 Showing that f is one-to-one or onto
  71. 71 Recall
  72. 72 Function types
  73. 73 Inverse Functions
  74. 74 Inverse Functions
  75. 75 Questions
  76. 76 Questions
  77. 77 Questions
  78. 78 Slide 78
  79. 79 Composition
  80. 80 Composition
  81. 81 Composition
  82. 82 Composition Questions
  83. 83 Composition Questions
  84. 84 Slide 84
  85. 85 Graphs of Functions
  86. 86 Slide 86
  87. 87 Some Important Functions
  88. 88 Some Important Functions
  89. 89 Floor and Ceiling Functions
  90. 90 Factorial Function
  91. 91 Slide 91
  92. 92 Section Summary
  93. 93 Introduction
  94. 94 Sequences
  95. 95 Sequences
  96. 96 Geometric Progression
  97. 97 Arithmetic Progression
  98. 98 Special Integer Sequences ( opt )
  99. 99 Questions on Special Integer Sequences ( opt )
  100. 100 Useful Sequences
  101. 101 Guessing Sequences ( optional )
  102. 102 Integer Sequences ( optional )
  103. 103 Integer Sequences ( optional )
  104. 104 Slide 104
  105. 105 Summations
  106. 106 Example
  107. 107 Example
  108. 108 Summations
  109. 109 Product Notation ( optional )
  110. 110 Some Useful Summation Formulae
  111. 111 Slide 111
  112. 112 Slide 112
  113. 113 Example
  114. 114 Slide 114
  115. 115 Slide 115
  116. 116 Example
  117. 117 Example
  118. 118 Slide 118
  119. 119 Recurrence Relations
  120. 120 Questions about Recurrence Relations
  121. 121 Questions about Recurrence Relations
  122. 122 Fibonacci Sequence
  123. 123 Solving Recurrence Relations
  124. 124 Iterative Solution Example
  125. 125 Iterative Solution Example
  126. 126 Financial Application
  127. 127 Financial Application
  128. 128 Slide 128
  129. 129 2.6. Matrices
  130. 130 Matrix Equality
  131. 131 Row and Column Order
  132. 132 Matrix Sums
  133. 133 Matrix Products
  134. 134 Matrix Product Example
  135. 135 Matrix Product Example
  136. 136 Matrix Product Example
  137. 137 Identity Matrices
  138. 138 Powers of Matrices
  139. 139 Matrix Transposition
  140. 140 Symmetric Matrices
  141. 141 Zero-One Matrices
  142. 142 Example
  143. 143 Boolean Products
  144. 144 Boolean Powers
  145. 145 Example
Slide 1 / 145

Basic Structures: Sets, Functions,

Slide 1: Basic Structures: Sets, Functions,
Slide 2 / 145

Chapter Summary

Slide 2: Chapter Summary
Slide 3 / 145

Slide 3

Slide 3: Slide 3
Slide 4 / 145

Section Summary

Slide 4: Section Summary
Slide 5 / 145

Introduction

Slide 5: Introduction
Slide 6 / 145

Sets

Slide 6: Sets
Slide 7 / 145

Describing Sets

Slide 7: Describing Sets
Slide 8 / 145

Describing a Set: Roster Method

Slide 8: Describing a Set: Roster Method

Notes

  1. Roster method lists the elements: {a, e, i, o, u}. Order and repetition don’t matter: {1, 2, 2} = {2, 1}.

Exam angle

PredictionQ1

{1, 3, 3, 5} and {5, 3, 1} are equal sets.

Slide 9 / 145

Roster Method

Slide 9: Roster Method
Slide 10 / 145

Set-Builder Notation

Slide 10: Set-Builder Notation
Slide 11 / 145

Interval Notation

Slide 11: Interval Notation
Slide 12 / 145

Some Important Sets

Slide 12: Some Important Sets
Slide 13 / 145

Universal Set and Empty Set

Slide 13: Universal Set and Empty Set

Notes

  1. Universal set U holds everything under discussion; ∅ = {} has no elements, and {∅} is NOT empty (it has one element).

  2. Trap ∅ ≠ {∅}: |∅| = 0 but |{∅}| = 1.

Exam angle

PredictionQ1

|{∅, {∅}}| equals:

Slide 14 / 145

John Venn (1834-1923) Cambridge, UK

Slide 14: John Venn (1834-1923) Cambridge, UK
Slide 15 / 145

Some things to remember

Slide 15: Some things to remember
Slide 16 / 145

Set Equality

Slide 16: Set Equality
Slide 17 / 145

Subsets

Slide 17: Subsets

Exam angle

PredictionQ1

∅ ⊆ A for every set A.

Slide 18 / 145

Showing a Set is or is not a Subset of Another Set

Slide 18: Showing a Set is or is not a Subset of Another Set
Slide 19 / 145

Another look at Equality of Sets

Slide 19: Another look at Equality of Sets
Slide 20 / 145

Proper Subsets

Slide 20: Proper Subsets
Slide 21 / 145

Slide 21

Slide 21: Slide 21
Slide 22 / 145

Slide 22

Slide 22: Slide 22
Slide 23 / 145

Set Cardinality

Slide 23: Set Cardinality
Slide 24 / 145

Set Cardinality

Slide 24: Set Cardinality
Slide 25 / 145

Power Sets

Slide 25: Power Sets

Exam angle

PredictionQ1

If A = {a, b, c}, |P(A)| is:

PredictionQ2

P(∅) equals:

Slide 26 / 145

Power Sets

Slide 26: Power Sets
Slide 27 / 145

Tuples

Slide 27: Tuples
Slide 28 / 145

Ren é Descartes (1596-1650)

Slide 28: Ren é Descartes (1596-1650)
Slide 29 / 145

Cartesian Product

Slide 29: Cartesian Product

Notes

  1. A × B = {(a, b) | a ∈ A, b ∈ B}; |A × B| = |A|·|B|; A × B ≠ B × A in general.

Exam angle

PredictionQ1

If |A| = 3 and |B| = 4, |A × B| is:

Slide 30 / 145

Slide 30

Slide 30: Slide 30
Slide 31 / 145

Slide 31

Slide 31: Slide 31
Slide 32 / 145

Slide 32

Slide 32: Slide 32
Slide 33 / 145

Truth Sets of Quantifiers

Slide 33: Truth Sets of Quantifiers
Slide 34 / 145

Slide 34

Slide 34: Slide 34
Slide 35 / 145

Section Summary

Slide 35: Section Summary
Slide 36 / 145

Boolean Algebra

Slide 36: Boolean Algebra
Slide 37 / 145

Union

Slide 37: Union

Notes

  1. A ∪ B: in A or B (or both).

Slide 38 / 145

Intersection

Slide 38: Intersection
Slide 39 / 145

Complement

Slide 39: Complement

Notes

  1. Complement Ā = U − A.

Slide 40 / 145

Difference

Slide 40: Difference

Notes

  1. A − B: in A but not in B (= A ∩ B̄).

Slide 41 / 145

The Cardinality of the Union of Two Sets

Slide 41: The Cardinality of the Union of Two Sets

Exam angle

PredictionQ1

|A| = 10, |B| = 7, |A ∩ B| = 3. |A ∪ B| =

Slide 42 / 145

Review Questions

Slide 42: Review Questions
Slide 43 / 145

Symmetric Difference ( optional )

Slide 43: Symmetric Difference ( optional )
Slide 44 / 145

Set Identities

Slide 44: Set Identities

Notes

  1. Set identities mirror the logical equivalences (∪ ↔ ∨, ∩ ↔ ∧, complement ↔ ¬).

Slide 45 / 145

Set Identities

Slide 45: Set Identities
Slide 46 / 145

Set Identities

Slide 46: Set Identities
Slide 47 / 145

Proving Set Identities

Slide 47: Proving Set Identities
Slide 48 / 145

Proof of Second De Morgan Law

Slide 48: Proof of Second De Morgan Law

Notes

  1. De Morgan for sets: (A ∩ B)‾ = Ā ∪ B̄ and (A ∪ B)‾ = Ā ∩ B̄.

Slide 49 / 145

Proof of Second De Morgan Law

Slide 49: Proof of Second De Morgan Law
Slide 50 / 145

Proof of Second De Morgan Law

Slide 50: Proof of Second De Morgan Law
Slide 51 / 145

Set-Builder Notation: Second De Morgan Law

Slide 51: Set-Builder Notation: Second De Morgan Law
Slide 52 / 145

Membership Table

Slide 52: Membership Table

Notes

  1. Membership table: 1/0 for "in"/"not in"; the identity holds if both columns match.

Slide 53 / 145

Generalized Unions and Intersections

Slide 53: Generalized Unions and Intersections
Slide 54 / 145

Slide 54

Slide 54: Slide 54
Slide 55 / 145

Section Summary

Slide 55: Section Summary
Slide 56 / 145

Functions

Slide 56: Functions

Notes

  1. A function f: A → B assigns EXACTLY ONE element of B to each element of A. A is the domain, B the codomain, f(A) the range.

  2. Trap Range ⊆ codomain; they are not always equal.

Exam angle

PredictionQ1

For f: A → B, the set of values actually taken by f is the:

Slide 57 / 145

Functions

Slide 57: Functions
Slide 58 / 145

Functions

Slide 58: Functions
Slide 59 / 145

Representing Functions

Slide 59: Representing Functions
Slide 60 / 145

Questions

Slide 60: Questions
Slide 61 / 145

Question on Functions and Sets

Slide 61: Question on Functions and Sets
Slide 62 / 145

Injections

Slide 62: Injections

Notes

  1. One-to-one (injective): f(a) = f(b) ⇒ a = b, no two inputs share an output.

Slide 63 / 145

Surjections

Slide 63: Surjections
Slide 64 / 145

Bijections

Slide 64: Bijections

Exam angle

PredictionQ1

f: ℤ → ℤ, f(x) = x + 1 is:

PredictionQ2

f: ℤ → ℤ, f(x) = 2x is:

PredictionQ3

f: ℝ → ℝ, f(x) = x² is:

Slide 65 / 145

Slide 65

Slide 65: Slide 65
Slide 66 / 145

Showing that f is one-to-one or onto

Slide 66: Showing that f is one-to-one or onto
Slide 67 / 145

Showing that f is one-to-one or onto

Slide 67: Showing that f is one-to-one or onto

Notes

  1. To show one-to-one: assume f(x) = f(y) and derive x = y. To show onto: take any y and solve for an x with f(x) = y.

Slide 68 / 145

Injections, Surjections and Bijections

Slide 68: Injections, Surjections and Bijections
Slide 69 / 145

Injections, Surjections and Bijections

Slide 69: Injections, Surjections and Bijections
Slide 70 / 145

Showing that f is one-to-one or onto

Slide 70: Showing that f is one-to-one or onto
Slide 71 / 145

Recall

Slide 71: Recall
Slide 72 / 145

Function types

Slide 72: Function types
Slide 73 / 145

Inverse Functions

Slide 73: Inverse Functions

Exam angle

PredictionQ1

Find the inverse of f: ℝ → ℝ, f(x) = 3x − 2.

Compare with the model answer

Let y = 3x − 2, so x = (y + 2)/3; f⁻¹(y) = (y + 2)/3. It exists because f is a bijection.

Slide 74 / 145

Inverse Functions

Slide 74: Inverse Functions
Slide 75 / 145

Questions

Slide 75: Questions
Slide 76 / 145

Questions

Slide 76: Questions
Slide 77 / 145

Questions

Slide 77: Questions
Slide 78 / 145

Slide 78

Slide 78: Slide 78
Slide 79 / 145

Composition

Slide 79: Composition

Notes

  1. (f ∘ g)(x) = f(g(x)): apply g FIRST.

  2. Trap f ∘ g ≠ g ∘ f in general.

Exam angle

PredictionQ1

f(x) = 2x + 3, g(x) = 3x + 2. (f ∘ g)(x) =

Slide 80 / 145

Composition

Slide 80: Composition
Slide 81 / 145

Composition

Slide 81: Composition
Slide 82 / 145

Composition Questions

Slide 82: Composition Questions
Slide 83 / 145

Composition Questions

Slide 83: Composition Questions
Slide 84 / 145

Slide 84

Slide 84: Slide 84
Slide 85 / 145

Graphs of Functions

Slide 85: Graphs of Functions
Slide 86 / 145

Slide 86

Slide 86: Slide 86
Slide 87 / 145

Some Important Functions

Slide 87: Some Important Functions
Slide 88 / 145

Some Important Functions

Slide 88: Some Important Functions
Slide 89 / 145

Floor and Ceiling Functions

Slide 89: Floor and Ceiling Functions

Notes

  1. ⌊x⌋ largest integer ≤ x; ⌈x⌉ smallest integer ≥ x. ⌊−1.5⌋ = −2, ⌈−1.5⌉ = −1.

Exam angle

PredictionQ1

⌊−2.3⌋ + ⌈2.3⌉ equals:

Slide 90 / 145

Factorial Function

Slide 90: Factorial Function

Notes

  1. n! = 1·2·…·n, 0! = 1.

Slide 91 / 145

Slide 91

Slide 91: Slide 91
Slide 92 / 145

Section Summary

Slide 92: Section Summary
Slide 93 / 145

Introduction

Slide 93: Introduction
Slide 94 / 145

Sequences

Slide 94: Sequences
Slide 95 / 145

Sequences

Slide 95: Sequences
Slide 96 / 145

Geometric Progression

Slide 96: Geometric Progression
Slide 97 / 145

Arithmetic Progression

Slide 97: Arithmetic Progression
Slide 98 / 145

Special Integer Sequences ( opt )

Slide 98: Special Integer Sequences ( opt )
Slide 99 / 145

Questions on Special Integer Sequences ( opt )

Slide 99: Questions on Special Integer Sequences ( opt )
Slide 100 / 145

Useful Sequences

Slide 100: Useful Sequences
Slide 101 / 145

Guessing Sequences ( optional )

Slide 101: Guessing Sequences ( optional )
Slide 102 / 145

Integer Sequences ( optional )

Slide 102: Integer Sequences ( optional )
Slide 103 / 145

Integer Sequences ( optional )

Slide 103: Integer Sequences ( optional )
Slide 104 / 145

Slide 104

Slide 104: Slide 104
Slide 105 / 145

Summations

Slide 105: Summations
Slide 106 / 145

Example

Slide 106: Example
Slide 107 / 145

Example

Slide 107: Example
Slide 108 / 145

Summations

Slide 108: Summations
Slide 109 / 145

Product Notation ( optional )

Slide 109: Product Notation ( optional )
Slide 110 / 145

Some Useful Summation Formulae

Slide 110: Some Useful Summation Formulae

Notes

  1. Key sums: Σk = n(n+1)/2, Σk² = n(n+1)(2n+1)/6, Σarᵏ (k = 0…n) = (arⁿ⁺¹ − a)/(r − 1) for r ≠ 1.

Exam angle

PredictionQ1

Σ_{k=1}^{100} k =

Slide 111 / 145

Slide 111

Slide 111: Slide 111
Slide 112 / 145

Slide 112

Slide 112: Slide 112
Slide 113 / 145

Example

Slide 113: Example
Slide 114 / 145

Slide 114

Slide 114: Slide 114
Slide 115 / 145

Slide 115

Slide 115: Slide 115
Slide 116 / 145

Example

Slide 116: Example
Slide 117 / 145

Example

Slide 117: Example
Slide 118 / 145

Slide 118

Slide 118: Slide 118
Slide 119 / 145

Recurrence Relations

Slide 119: Recurrence Relations

Exam angle

PredictionQ1

aₙ = aₙ₋₁ + 3, a₀ = 2. a₃ =

Slide 120 / 145

Questions about Recurrence Relations

Slide 120: Questions about Recurrence Relations
Slide 121 / 145

Questions about Recurrence Relations

Slide 121: Questions about Recurrence Relations
Slide 122 / 145

Fibonacci Sequence

Slide 122: Fibonacci Sequence

Notes

  1. Fibonacci: f₀ = 0, f₁ = 1, fₙ = fₙ₋₁ + fₙ₋₂.

Slide 123 / 145

Solving Recurrence Relations

Slide 123: Solving Recurrence Relations
Slide 124 / 145

Iterative Solution Example

Slide 124: Iterative Solution Example

Notes

  1. Iteration (forward/backward substitution): expand until a pattern appears, then close the formula.

Slide 125 / 145

Iterative Solution Example

Slide 125: Iterative Solution Example
Slide 126 / 145

Financial Application

Slide 126: Financial Application
Slide 127 / 145

Financial Application

Slide 127: Financial Application
Slide 128 / 145

Slide 128

Slide 128: Slide 128
Slide 129 / 145

2.6. Matrices

Slide 129: 2.6. Matrices
Slide 130 / 145

Matrix Equality

Slide 130: Matrix Equality
Slide 131 / 145

Row and Column Order

Slide 131: Row and Column Order
Slide 132 / 145

Matrix Sums

Slide 132: Matrix Sums
Slide 133 / 145

Matrix Products

Slide 133: Matrix Products

Notes

  1. A (m×k) times B (k×n) gives an m×n matrix; cᵢⱼ = row i of A · column j of B. Inner sizes must match.

  2. Trap AB ≠ BA in general, and BA may not even be defined.

Exam angle

PredictionQ1

A is 2×3 and B is 3×4. AB is:

Slide 134 / 145

Matrix Product Example

Slide 134: Matrix Product Example
Slide 135 / 145

Matrix Product Example

Slide 135: Matrix Product Example
Slide 136 / 145

Matrix Product Example

Slide 136: Matrix Product Example
Slide 137 / 145

Identity Matrices

Slide 137: Identity Matrices
Slide 138 / 145

Powers of Matrices

Slide 138: Powers of Matrices
Slide 139 / 145

Matrix Transposition

Slide 139: Matrix Transposition

Notes

  1. Transpose Aᵗ swaps rows and columns; symmetric when A = Aᵗ.

Slide 140 / 145

Symmetric Matrices

Slide 140: Symmetric Matrices
Slide 141 / 145

Zero-One Matrices

Slide 141: Zero-One Matrices
Slide 142 / 145

Example

Slide 142: Example
Slide 143 / 145

Boolean Products

Slide 143: Boolean Products
Slide 144 / 145

Boolean Powers

Slide 144: Boolean Powers
Slide 145 / 145

Example

Slide 145: Example