Sets

-definition

-characteristics

-operations

-association rules

Sets

-Sets: a well-defined collection of distinct objects.

Examples:

  • Integers: \(\{1, 2, 3, 4, 5, ...\}\)
  • Pieces of furniture: \(\{bed, table, armchair, sofa\}\)
  • Students: \(\{?\}\)

Q: Your examples?

Basic Characteristic

For any set \(A\) and any element \(b\) only one of two statements is true: - \(A\) includes \(b\) (\(b \in A\)) - \(A\) does not include \(b\) (\(b \notin A\))

Examples:

  • Does the set {1, 2, 3} include 0? No (\(0 \notin \{1, 2, 3\}\))
  • Does the set {0, 1, 77, 245} include 0? Yes (\(0 \in \{0, 1, 77, 245\}\))

Basic Characteristic

  • Does the set of integers include 789?
  • Does the set of cities include New York?
  • Does the set of the federation regions include Kaliningrad?
  • Does the set of the federation regions include Saint Petersburg?
  • Does the set of male names include “Vadim”?

Ways of Defining Sets

  1. Enumeration
    • \(\{1, 3, 5\}\);
    • \(\{1, 3, 5, ...\}\)
  2. Set builder notation
    • \(\{x: x \hspace{0.5cm} integer \land x > 2 \land x < 10\}\)
  3. Superset and builder notation
    • \(\{x \in \mathbb{Z} : x > 2 \land x < 10\}\)

Correctly notated set suggest the definition of universal set \(U\) (general population).

Elements

\(A\) – set

\(n(A)\) – number of the set elements (cardinality of set)

\(\varnothing\); \({}\) - empty set, does not contain any elements

Empty set is a subset of any set

\(U\) - universal set (general population)

Universal sets varies for different cases

Elements

  • \(n(\varnothing)=?\)
  • \(\{0\} = \varnothing?\)
  • \(0 \in \varnothing ?\)

  • \(U\) for population census (is it the same in different countries?)

Subsets

  • A: NRU HSE SPb students
    • B: First year students
      • C: First year students of Sociology and Social Informatics Department
  • Set A (superset) includes B: \(B \subseteq A\)

  • \(B \subseteq A \implies (B = A) \lor (B \subset A)\)

  • \((B \subset A)\) – \(B\) is a proper subset of \(A\)

Subsets

  • \(C \subseteq B\) ?
  • \(C \subseteq A\) ?
  • What inequality is true for \(n(C), n(B), n(A)\)?
  • \(C \subset B\) means that …
  • \(B = A\) means that …

Union and intersection

  • A: NRU HSE SPb students
    • B: First year students
      • C: First year students, who are in the HSE Art Union
    • D: Students of the other years
      • E: Students of the other years, who are in the HSE Art Union
    • F Students, who are in the HSE Art Union

\(F = C \cup E\) – union \(C = F \cap B\) – intersection

Union and intersection

  • A: NRU HSE SPb students
    • B: First year students
      • C: First year students, who are in the HSE Art Union
    • D: Students of the other years
      • E: Students of the other years, who are in the HSE Art Union
    • F Students, who are in the HSE Art Union
  • \(n(B\cap D)=\)?
  • \(B\cap D=\)?
  • \(B\cup D=\)?
  • \(F\cap D=\)?

Union. Task 1

Sochum = {Sociology and social informatics, Oriental studies, Political Science, Management in Government Sector, History, Philology}

SEM = {Economics, Management, Logistics}

Write down a formula of C which includes bachelor programs in HSE and draw Euler Diagram

Union. Task 2

A = {Bike drivers}

B = {Car drivers}

C = {Pedestrians}

Write down a formula of D which includes all road users and draw Euler Diagram

Intersection. Task 1

G names = {George, Grigoriy, Gosha, Galina, Gulnara}

Girls’ names = {Anastasia, Masha, Galina, Alexandra, Gulnara}

Write down a formula of C which includes girls’ names starting with G and draw Euler Diagram

Intersection. Task 2

A = {People who have a bike}

B = {People who have a car}

C = {People who have a skateboard}

Write down a formula of D which includes people having bikes, cars, skateboards and draw Euler Diagram

Intersection. Task 3

A = {Teachers doing lectures and seminars at bachelor’s program “Sociology and Social Informatics”}

B = {Teachers working at department of Management and Economics}

Write down a formula of C which includes Teachers working at department of Management and Economics and doing lectures and seminars for sociologists and draw Euler Diagram

Intersection. Task 4

A = {Muslim countries}

B = {Countries with high life expectancy}

C = {Countries with high income per person}

Write down a formula of D which includes Muslim countries with high life expectancy and high income and draw Euler Diagram

Use Gapminder to answer this question

Set-theoretic difference

\(S \setminus T = \left\{{x \in S: x \notin T}\right\}\)

Set-theoretic difference. Task 1

A = {People playing Dota}

B = {People playing Counter Strike}

Write down a formula of C which includes those who play only Dota and draw Euler Diagram

Set-theoretic difference. Task 2

A = {People who have iOS device}

B = {People who have Android device}

Some students have smartphones or tablets with Android or iOS only and some students have smartphones or tablets with both systems.

Write down a formula of C which includes those who have only Android devices and draw Euler Diagram

Symmetric difference

\(S - T = (S \setminus T) \cup (T \setminus S)\)

Symmetric difference. Task 1

A = {People who have iOS device}

B = {People who have Android device}

Some students have smartphones or tablets with Android or iOS only and some students have smartphones or tablets with both systems.

Write down a formula of C which includes those who have only Android or iOS devices and draw Euler Diagram

What does C include?

Сomplement (Absolute difference)

\(A^c = U ∖ A\)

Task 1

A = {red cars, black cars, white cars}

U = {cars of all possible colors}

Cars of which colors will be in \(A^c\) ?

Task 2

U = {People who have any device}

A = {People who have iOS device}

All students have smartphones and some of them have iOS device.

Let C include people who don’t have iOS devices.

What does C include?

Draw using Euler Diagram

The principle of inclusion-exclusion. Task 1

The teacher asks the group of students:

  • How many students are studying academic writing? – 15

  • How many students are studying programming? – 13

  • How many students do not study any of two subjects? – 5

The group consists of 26 students.

How many students are studying programming, but not studying academic writing?

Inclusion-exclusion principle. Task 2

A = {Volkswagen, Jeep, Ferrari, Audi, Bugatti, Citroёn, Honda, Mazda}

B = {Fiat, Ford, Audi, Honda, Chrysler, Buick, Jeep}

Count a cardinality for \(A \cup B\)?