Docsity

Discrete Structures: Sets and Their Properties, Slides of Computer Science

Partial preview of the text

Download Discrete Structures: Sets and Their Properties and more Slides Computer Science in PDF only on Docsity!

CSC102 - Discrete Structures By Mahwish Waqas

Department Of Computer Science, CUI

Lahore Campus

Course Outline

  • Sets
    • Set Terminologies
    • Sets of sets
    • Power Set
    • Cartesian Product
    • Set notation with Quantifier

Set

  • A set is an unordered collection of objects.
  • The objects in a set are called the elements , or members , of the set.
  • A set is said to contain its elements. Example:
    • Z is the set of integers.
    • Cities in the Pakistan: {Lahore, Karachi, Islamabad, … }
    • Sets can contain non-related elements: {3, a, red, Gilgit } Properties:
  • Order does not matter
    • {1, 2, 3, 4, 5} is equivalent to {3, 5, 2, 4, 1}
  • Sets do not have duplicate elements
    • Consider the list of students in this class
    • It does not make sense to list somebody twice

Set Membership

  • a is an element of the set A , denoted by a ∈ A.
  • a is not an element of the set A , denoted by a ∉

A.

Sets (example)

  • Example: V: {a,e,i,o,u} a ∈ V b ∉ V I: {0,1,2,…,99} 50 ∈ I 100 ∉ I S: {a,2,class} 2 ∈ S room ∉ S

Specifying a Set

  • Capital letters (A, B, S…) for sets
  • Italic lower-case letter for elements ( a, x, y …)
  • Easiest way: list all the elements
    • A = { 1 , 2 , 3 , 4 , 5 }, Not always feasible!
  • May use ellipsis (…): B = { 0 , 1 , 2 , 3 , …}
  • May cause confusion. C = { 3 , 5 , 7 , …}. What’s 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

Important Sets

  • Set of natural numbers
    • 𝐍 = { 1 , 2 , 3 ,…}
  • Set of integers
    • 𝐙 = {…,- 2 ,- 1 , 0 , 1 , 2 ,…}
  • Set of positive integers
    • 𝐙
      • = { 1 , 2 , 3 ,…}
  • Set of rational numbers
    • 𝐐 = {p/q | p ∈ 𝐙, q ∈ 𝐙, and q ≠ 0 }
  • Set of real numbers
    • 𝐑

Examples

• S 1 = { N, Z, Q, R }

  • S 1 has 4 elements, each of which is a set.
  • S 2 = {x | x ∈ N and ∃k k ∈ N , x = k 2 }
  • Set of squares of natural numbers

Equality of Sets (examples)

  • { 1 , 2 , 3 } and { 3 , 2 , 1 } { 1 , 2 , 3 } = { 3 , 2 , 1 }
  • 𝐙
    • and { 0 , 1 , 2 ,…} 𝐙
      • ≠ { 0 , 1 , 2 ,…}

The Universal Set

  • U is the universal set – the set containing all objects or elements (or the “universe”), and of which all other sets are subsets
  • For the set {- 2 , 0. 4 , 2 }, U would be the real numbers
  • For the set { 0 , 1 , 2 }, U could be the N, Z, Q, R depending on the context
  • For the set of the vowels of the alphabet, U would be all the letters of the alphabet

Empty Set (example)

  • Example:
  • S = {x | x ∈ 𝑍
    • and x < 0 } S = { } = Ø
  • A set that has no elements called empty set , or null set.
  • Ø and {Ø} Ø ≠ {Ø}

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

Subset and Equality

  • A ⊆ B, ∀ x (x ∈ A → x ∈ B) and
  • B ⊆ A, ∀ x (x ∈ B → x ∈ A) then
  • A = B, ∀ x (x ∈ A ↔ x ∈ B)

Subset (example)

  • Q and R Q ⊆ R
  • N and Z N ⊆ Z
  • A = {x | x ∈ 𝐙
    • and x< 10 } B = {x | x ∈ 𝐙
      • , x is even and x< 10 } B ⊆ A