CMSC250

Sets, Relations, Functions

Sets, Relations, Functions

Partitions, Powerset, Cartesian product
Relations
Functions

Partitions, Powerset, Cartesian Product

Partition: a set of nonempty disjoint subsets which when unioned together is equal to the initial set

\(A = \{1,2,3,4,5\}\)

Some Partitions:

  • \(\{\{1,2\},\{3,4,5\}\}\)
  • \(\{\{1\},\{2,3\},\{4,5\}\}\)
  • \(\{\{1,2,3,4,5\}\}\)

\(A = \{1,2,3,4,5\}\)

Not Partitions:

  • \(\{\{1,2\},\{4,5\}\}\)
  • \(\{\{1,2,3\},\{3,4,5\}\}\)
  • \(\{\{1,2,3,4,5\},\emptyset\}\)
  • \(\{1,2,3,4,5\}\)

Powerset \(\mathcal{P}(A)\): a set of all the subsets of \(A\)

\(\mathcal{P}(A) = \{S \vert S \subseteq A\}\)

\(\mathcal{P}(\{1,2\}) = \{\emptyset,\{1\},\{2\},\{1,2\}\}\)

Powerset \(\mathcal{P}(A)\): a set of all the subsets of \(A\)

\(\vert \mathcal{P}(A)\vert = ?\)

Powerset \(\mathcal{P}(A)\): a set of all the subsets of \(A\)

\(\vert \mathcal{P}(A)\vert = 2^{\vert A\vert}\)

\(\mathcal{P}(\emptyset) = ?\)

Powerset \(\mathcal{P}(A)\): a set of all the subsets of \(A\)

\(\vert \mathcal{P}(A)\vert = 2^{\vert A\vert}\)

\(\mathcal{P}(\emptyset) = \{\emptyset\}\)

\(\mathcal{P}(\{\emptyset\}) = ?\)

Powerset \(\mathcal{P}(A)\): a set of all the subsets of \(A\)

\(\vert \mathcal{P}(A)\vert = 2^{\vert A\vert}\)

\(\mathcal{P}(\emptyset) = \{\emptyset\}\)

\(\mathcal{P}(\{\emptyset\}) = \{\emptyset, \{\emptyset\}\}\)

Cartesian Product(\(A,B\)): a set of all ordered pairs between \(A\) and \(B\)

\(A \times B = \{(a,b)\vert a \in A \land b \in B\}\)

\(\{1,2\}\times \{3,4\} = \{(1,3),(1,4),(2,3),(2,4)\}\)

Note: The cartesian plane: \(\mathbb{R} \times \mathbb{R} = \mathbb{R}^2\)

Relations

Relation: A relation $R$ from set $A$ to set $B$ is any subset of $A \times B$

Examples:

  • $<,\mathbb{R}\times\mathbb{R}$:\(\{(-1.5,-1.2),(0,1),(3,5000),\dots\}\)
  • $\le,\mathbb{R}\times\mathbb{R}$:\(\{(-1.5,-1.2),(0,0),(3,5000),\dots\}\)
  • $\vert,\mathbb{N^{\ge 1}}\times\mathbb{Z}$:\(\{(1,5),(2,16),(17,51),\dots\}\)

$A$ is the Domain, $B$ is the co-domain

\(R: \{(x,y)\vert x+y \ge 100\}, \mathbb{R}\times\mathbb{N}\)

Read as: $R$ defined as the $\{(x,y)\vert x+y \ge 100\}$

$\{(100.0,0),(50.1,50),(0.0,200),\dots\}$

Reflexivity

A relation $X \subseteq A \times A$ is reflexive if \[(\forall x \in A)[(x,x) \in X]\]

Examples:

  • $<,\mathbb{R}\times\mathbb{R}$:No: ${\sim}(\exists x \in \mathbb{R})[x < x]$
  • $\le,\mathbb{R}\times\mathbb{R}$:Yes: $(\forall x \in \mathbb{R})[x \le x]$
  • \(R: \{(x,y)\vert x+y \ge 100\}, \mathbb{N}\times\mathbb{N}\):No: $10 \in \mathbb{N}$ but $(10,10) \not\in R$

Symmetry

A relation $X \subseteq A \times A$ is symmetric if \[(\forall x,y \in A)[(x,y) \in X \Rightarrow (y,x) \in X]\]

Examples:

  • $\le,\mathbb{R}\times\mathbb{R}$:No: $4 \le 5$ but ${\sim}(5 \le 4)$
  • $<,\mathbb{R}\times\mathbb{R}$:No: $4 < 5$ but ${\sim}(5 < 4)$
  • \(R:\{(x,y)\vert x+y \ge 100\}, \mathbb{N}\times\mathbb{N}\):Yes:$(\forall x,y \in \mathbb{N})[x+y \ge 100 \Rightarrow y+x \ge 100]$

Transitivity

A relation $X \subseteq A \times A$ is transitive if \[(\forall x,y,z \in A)[((x,y) \in X \land (y,z) \in X) \Rightarrow (x,z) \in X]\]

Examples:

  • $\le,\mathbb{R}\times\mathbb{R}$:Yes: \((\forall x,y,z \in \mathbb{R})[x \le y \land y \le z) \Rightarrow x \le z]\)
  • \(R:\{(x,y)\vert x+y \ge 100\}, \mathbb{N}\times\mathbb{N}\):no:\((1,100) \in R \land (100,5) \in R\), but \((1,5) \not\in R\)

Functions

Function: Something that takes elements of set $X$ and maps them an element of set $Y$

$x \mapsto f(x), x \in X \land f(x) \in Y$

$f: X \mapsto Y$

Arrow Diagrams can be used to visualize

$f:\mathbb{N} \mapsto \mathbb{N}, f(x) = \frac{x}{2}$

$f:\mathbb{N} \mapsto \mathbb{Q}, f(x) = \frac{x}{2}$

$f:\mathbb{N} \mapsto \mathbb{Q}, f(x) = \frac{x}{2}$

$f:\mathbb{R^{>0}} \mapsto \mathbb{R}, f(x) = log(x)$

$f:\mathbb{N} \mapsto \mathbb{Z}, f(x) = 4$

$f:\mathbb{R} \mapsto \mathbb{R}, f(x) = \sqrt{x}$

Surjective

A function $f: X \mapsto Y$ is surjective(or onto) iff \[(\forall y \in Y)(\exists x \in X)[y = f(x)]\]

Examples:

  • $f(x) = x^2:\mathbb{R}\mapsto\mathbb{R}$:No:$-1$ in codomain
  • $f(x) = x^2:\mathbb{R}\mapsto\mathbb{R^{\ge 0}}$:Yes
  • $f(x) = x^2:\mathbb{N}\mapsto SQUARES$:Yes

Injective

A function $f: X \mapsto Y$ is injective (or 1-1) iff \[(\forall x_1,x_2 \in X)[(f(x_1) = f(x_2)) \Rightarrow x_1 = x_2]\]

Examples:

  • $f(x) = x^2:\mathbb{R}\mapsto\mathbb{R}$:No:$f(3) = f(-3)$
  • $f(x) = x^2:\mathbb{R}\mapsto\mathbb{R^{\ge 0}}$:No:$f(3) = f(-3)$
  • $f(x) = x^2:\mathbb{N}\mapsto SQUARES$:Yes

Note: $\vert Y\vert$ can be larger than $\vert X\vert$

Bijective

A function $f: X \mapsto Y$ is bijective (or a bijection) iff it is both injective and surjective

Examples:

  • $f(x) = \vert x\vert :\mathbb{R}\mapsto\mathbb{R}$:No: not injective
  • $f(x) = ax,\forall a \in \mathbb{R}:\mathbb{R}\mapsto\mathbb{R}$:No:$a=0$ is not surjective
  • $f(x) = 4x-1:\mathbb{N}\mapsto \mathbb{R}$:No: not surjective
  • $f(x) = 4x-1:\mathbb{R}\mapsto \mathbb{R}$:Yes