Docsity

Set Theory: Definitions, Identities, and Computer Representation, Study notes of Law

Partial preview of the text

Download Set Theory: Definitions, Identities, and Computer Representation and more Study notes Law in PDF only on Docsity!

1. SET

10/9/ Discrete Mathematics Fajrian Nur Adnan, M.CS 1

Discrete Mathematics

10/9/ Discrete Mathematics Fajrian Nur Adnan, M.CS 2

1. Set and Logic

  1. Relation
  2. Function
  3. Induction
  4. Boolean Algebra and Number Theory MID
  5. Graf dan Tree/Pohon
  6. Combinatorial
  7. Discrete Probability UAS

What is a set?

  • A set is a group of “objects”
    • People in a class: { Alice, Bob, Chris }
    • Classes offered by a department: { CS 101, CS 202, … }
    • Colors of a rainbow: { red, orange, yellow, green, blue, purple }
    • States of matter { solid, liquid, gas, plasma }
    • States in the US: { Alabama, Alaska, Virginia, … }
    • Sets can contain non-related elements: { 3, a, red, Virginia }
  • The objects in a set are called the elements or members of the set S, and we say S contains its elements.

What is a set?

  • Sets are notated with curly brackets
  • Order does not matter (its different from list)
    • We often write them in order because it is easier for humans to understand it that way
    • {1, 2, 3, 4, 5} is equivalent to {3, 5, 2, 4, 1}
  • Sets do not have duplicate elements
    • Consider the set of vowels in the alphabet.
      • It makes no sense to list them as {a, a, a, e, i, o, o, o, o, o, u}
      • What we really want is just {a, e, i, o, u}
    • Consider the list of students in this class
      • it does not make sense to list somebody twice

Specifying a set 1

• Sets are usually represented by a capital letter

(A, B, S, etc.)

• Elements are usually represented by an italic

lower-case letter ( a , x , y , etc.)

• Easiest way to specify a set is to list all the

elements: A = {1, 2, 3, 4, 5}

  • Not always feasible for large or infinite sets

Specifying a set 2

  • Can use an ellipsis (…): B = {0, 1, 2, 3, …}
    • Can cause confusion. Consider the set C = {3, 5, 7, …}. What comes next? - If the set is all odd integers greater than 2, it is 9 - If the set is all prime numbers greater than 2, it is 11
  • Can use set-builder notation
    • D = { x | x is prime and x > 2}
    • E = { x | x is odd and x > 2}
    • Note:
      • The vertical bar means “such that”
      • Thus, set D is read (in English) as: “all elements x such that x is prime and x is greater than 2”

Specifying a set 4

• Sets of sets : Sets can contain other sets

  • S = { {1}, {2}, {3} }
  • T = { {1}, {{2}}, {{{3}}} }
  • V = { {{1}, {{2}}}, {{{3}}}, { {1}, {{2}}, {{{3}}} } }
    • V has only 3 elements!

• Note that 1 ≠ {1} ≠ {{1}} ≠ {{{1}}}

  • They are all different

Type of set 1

Often used sets

  • N = {0, 1, 2, 3, …} is the set of natural numbers
  • Z = {…, - 2, - 1, 0, 1, 2, …} is the set of integers
  • Z + = {1, 2, 3, …} is the set of positive integers (a.k.a whole numbers)
  • Note that people disagree on the exact definitions of whole numbers and natural numbers
  • Q = { p / q | pZ , qZ , q ≠ 0} is the set of rational numbers
    • Any number that can be expressed as a fraction of two integers (where the bottom one is not zero)
  • R is the set of real numbers

Venn diagrams

  • Represents sets graphically
    • The box represents the universal set
    • Circles represent the set(s)
  • Consider set S, which is

the set of all vowels in the

alphabet

  • The individual elements

are usually not written

in a Venn diagram

a e i o u b c^ d f g (^) h j k l m n p q r s t v w x y z

U
S

Type of set 3

• The empty written using  or {}

  • If a set has zero elements, it is called the empty

(or null) set

  • As the empty set is a set, it can be a element of

other sets

  • { , 1, 2, 3, x } is a valid set

Subsets 2

  • The empty set is a subset of all sets (including itself!)
  • All sets are subsets of the universal set
  • A horrible way to define a subset:
    • x ( x A  x B )
    • English translation: for all possible values of x, (meaning for all possible elements of a set), if x is an element of A, then x is an element of B
    • This type of notation will be gone over later
  • Definition
    • If S is a subset of T, and S is not equal to T, then S is a proper subset of T
  • Example:
    • Let T = {0, 1, 2, 3, 4, 5}
    • If S = {1, 2, 3},
      • S is not equal to T, and S is a subset of T
      • Then S is a proper subset of T
      • A proper subset is written as S  T
    • Let R = {0, 1, 2, 3, 4, 5}.
      • R is equal to T, and thus is a subset (but not a proper subset) of T
      • Can be written as: R  T and R  T (or just R = T)
    • Let Q = {4, 5, 6}.
      • Q is neither a subset or T nor a proper subset of T

Proper Subsets 1

Proper subsets: Venn diagram

U
S
R

S  R

Set cardinality

  • The cardinality of a set is the number of elements in a set
    • Written as |A|
  • Examples
    • Let R = {1, 2, 3, 4, 5}. Then |R| = 5
    • || = 0
    • Let S = {, {a}, {b}, {a, b}}. Then |S| = 4
  • This is the same notation used for vector length in

geometry

  • A set with one element is sometimes called a singleton

set