Comprehensive Notes on Sets, Functions, Sequences, and Matrices in Discrete Mathematics

Foundations of Discrete Structures: Sets, Functions, Sequences, Sums, and Matrices

Discrete mathematics is fundamentally concerned with discrete structures used to represent discrete objects. Many of these structures, including combinations, relations, graphs, and finite-state machines, are constructed using sets. Sets are collections of objects. Functions, which assign elements of one set to exactly one element of another set, are equally vital, playing roles in representing computational complexity, counting objects, and studying the size of sets. Sequences and strings represent special types of functions. Matrices are employed to represent discrete structures like relations and graphs and are manipulated through matrix arithmetic to solve complex problems.

Set Theory Fundamentals

A set is an unordered collection of objects, referred to as elements or members. A set is said to contain its elements. The notation aAa \in A denotes that aa is an element of set AA, while aAa \notin A signifies that it is not.

Describing Sets

There are several methods for describing a set:

  1. Roster Method: Listing all members between braces.

    • Example: The set of vowels in the English alphabet is V={a,e,i,o,u}V = \{a, e, i, o, u\}.

    • Example: The set of odd positive integers less than 1010 is O={1,3,5,7,9}O = \{1, 3, 5, 7, 9\}.

    • Sets can contain unrelated elements, such as {a,2,Fred,New Jersey}\{a, 2, \text{Fred}, \text{New Jersey}\}.

    • Ellipses (......) are used when the pattern is obvious. The set of positive integers less than 100100 is {1,2,3,,99}\{1, 2, 3, \dots, 99\}.

  2. Set Builder Notation: Characterizing elements by stating the properties they must possess.

    • Example: O={xx is an odd positive integer less than 10}O = \{x \mid x \text{ is an odd positive integer less than } 10\}.

    • Example: The set of positive rational numbers Q+={xRx=pq, for some positive integers p and q}\mathbb{Q}^+ = \{x \in \mathbb{R} \mid x = \frac{p}{q}, \text{ for some positive integers } p \text{ and } q\}.

Important Sets in Discrete Mathematics
  • N={0,1,2,3,}\mathbb{N} = \{0, 1, 2, 3, \dots\}, the set of natural numbers. (Note: Some authors exclude 00, but it is included here).

  • Z={,2,1,0,1,2,}\mathbb{Z} = \{\dots, -2, -1, 0, 1, 2, \dots\}, the set of integers.

  • Z+={1,2,3,}\mathbb{Z}^+ = \{1, 2, 3, \dots\}, the set of positive integers.

  • Q={p/qpZ,qZ, and q0}\mathbb{Q} = \{p/q \mid p \in \mathbb{Z}, q \in \mathbb{Z}, \text{ and } q \neq 0\}, the set of rational numbers.

  • R\mathbb{R}, the set of real numbers.

  • R+\mathbb{R}^+, the set of positive real numbers.

  • C\mathbb{C}, the set of complex numbers.

Intervals

For real numbers aa and bb with a < b:

  • Closed interval: [a,b]={xaxb}[a, b] = \{x \mid a \le x \le b\}

  • Left-closed, right-open: [a, b) = \{x \mid a \le x < b\}

  • Left-open, right-closed: (a, b] = \{x \mid a < x \le b\}

  • Open interval: (a, b) = \{x \mid a < x < b\}

Set Equality and Types
  • Definition of Equality: Two sets are equal if and only if they have the same elements. A=BA = B if and only if x(xAxB)\forall x(x \in A \leftrightarrow x \in B).

  • The order of elements does not matter: {1,3,5}={3,5,1}\{1, 3, 5\} = \{3, 5, 1\}.

  • Repetition does not matter: {1,3,3,3,5,5,5}={1,3,5}\{1, 3, 3, 3, 5, 5, 5\} = \{1, 3, 5\}.

  • Empty Set: Also called the null set, denoted by \emptyset or {}\{\}, it contains no elements.

  • Singleton Set: A set with exactly one element. Note that {}\emptyset \neq \{\emptyset\}; the latter is a singleton set containing the empty set.

Relationships Between Sets

Subsets

Set AA is a subset of BB (ABA \subseteq B) if and only if every element of AA is also an element of BB. This is expressed by the quantification x(xAxB)\forall x(x \in A \rightarrow x \in B).

  • To show ABA \subseteq B, show that if xAx \in A, then xBx \in B.

  • To show A⊈BA \not\subseteq B, find a single counterexample xAx \in A such that xBx \notin B.

  • Theorem 1: For every set SS, (i) S\emptyset \subseteq S and (ii) SSS \subseteq S.

  • Proper Subsets: ABA \subset B if ABA \subseteq B but ABA \neq B. This requires x(xAxB)x(xBxA)\forall x(x \in A \rightarrow x \in B) \land \exists x(x \in B \land x \notin A).

Venn Diagrams

Named after John Venn (18811881), these represent sets graphically.

  • The Universal Set UU is represented by a rectangle.

  • Sets are represented by circles within the rectangle.

  • Points may represent specific elements.

Size and Power Sets
  • Cardinality: If a set SS contains exactly nn distinct elements where nn is a nonnegative integer, SS is finite and its cardinality is S=n|S| = n.

  • An infinite set is one that is not finite (e.g., Z+\mathbb{Z}^+).

  • Power Set: The set of all subsets of SS, denoted P(S)\mathcal{P}(S).

    • Example: if S={0,1,2}S = \{0, 1, 2\}, P(S)={,{0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}}\mathcal{P}(S) = \{\emptyset, \{0\}, \{1\}, \{2\}, \{0, 1\}, \{0, 2\}, \{1, 2\}, \{0, 1, 2\}\}.

    • If a set has nn elements, its power set has 2n2^n elements.

Cartesian Products
  • Ordered n-tuple: (a1,a2,,an)(a_1, a_2, \dots, a_n) is an ordered collection. Two nn-tuples are equal if every corresponding pair of elements is equal.

  • Cartesian Product (A×BA \times B): The set of all ordered pairs (a,b)(a, b) where aAa \in A and bBb \in B. A×B={(a,b)aAbB}A \times B = \{(a, b) \mid a \in A \land b \in B\}.

    • A×BB×AA \times B \neq B \times A unless A=BA = B, A=A = \emptyset, or B=B = \emptyset.

  • Relations: A subset RR of the Cartesian product A×BA \times B is a relation from AA to BB.

Set Operations

Basic Operations
  1. Union (ABA \cup B): AB\in A \lor \in B. Shaded as the area in either circle in a Venn diagram.

  2. Intersection (ABA \cap B): AB\in A \land \in B. Shaded as the overlapping area.

    • Two sets are disjoint if AB=A \cap B = \emptyset.

  3. Principle of Inclusion-Exclusion: For finite sets, AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|.

  4. Difference (ABA - B): Elements in AA but not in BB. Also called the complement of BB with respect to AA.

  5. Complement (A\overline{A}): Elements in the universal set UU not in AA. A=UA\overline{A} = U - A.

Set Identities
  • Identity Laws: A=AA \cup \emptyset = A; AU=AA \cap U = A

  • Domination Laws: AU=UA \cup U = U; A=A \cap \emptyset = \emptyset

  • Idempotent Laws: AA=AA \cup A = A; AA=AA \cap A = A

  • Complementation Law: (A)=A\overline{(\overline{A})} = A

  • Commutative Laws: AB=BAA \cup B = B \cup A; AB=BAA \cap B = B \cap A

  • Associative Laws: A(BC)=(AB)CA \cup (B \cup C) = (A \cup B) \cup C; A(BC)=(AB)CA \cap (B \cap C) = (A \cap B) \cap C

  • Distributive Laws: A(BC)=(AB)(AC)A \cup (B \cap C) = (A \cup B) \cap (A \cup C); A(BC)=(AB)(AC)A \cap (B \cup C) = (A \cap B) \cup (A \cap C)

  • De Morgan's Laws: AB=AB\overline{A \cap B} = \overline{A} \cup \overline{B}; AB=AB\overline{A \cup B} = \overline{A} \cap \overline{B}

  • Absorption Laws: A(AB)=AA \cup (A \cap B) = A; A(AB)=AA \cap (A \cup B) = A

  • Complement Laws: AA=UA \cup \overline{A} = U; AA=A \cap \overline{A} = \emptyset

Generalized Unions and Intersections
  • i=1nAi=A1A2An\bigcup_{i=1}^n A_i = A_1 \cup A_2 \cup \dots \cup A_n

  • i=1nAi=A1A2An\bigcap_{i=1}^n A_i = A_1 \cap A_2 \cap \dots \cap A_n

Computer Representation of Sets

A subset AA of a finite universal set U={a1,a2,,an}U = \{a_1, a_2, \dots, a_n\} can be represented by a bit string of length nn. The iith bit is 11 if aiAa_i \in A and 00 otherwise.

  • Union: Bitwise OR.

  • Intersection: Bitwise AND.

  • Complement: Bitwise NOT (flips bits).

Functions

Definitions
  • Function f:ABf: A \rightarrow B: Assignments of exactly one element of BB to each element of AA. If f(a)=bf(a) = b, bb is the unique element assigned to aa.

  • Domain: The set AA.

  • Codomain: The set BB.

  • Image/Preimage: If f(a)=bf(a) = b, bb is the image of aa and aa is the preimage of bb.

  • Range: The set of all images of elements of AA.

Function Arithmetic

For real-valued functions f1,f2f_1, f_2:

  • (f1+f2)(x)=f1(x)+f2(x)(f_1 + f_2)(x) = f_1(x) + f_2(x)

  • (f1f2)(x)=f1(x)f2(x)(f_1 f_2)(x) = f_1(x) f_2(x)

Injections, Surjections, and Bijections
  • One-to-One (Injective): ff is injective if f(a)=f(b)a=bf(a) = f(b) \rightarrow a = b for all a,ba, b in the domain.

  • Onto (Surjective): ff is surjective if for every bBb \in B, there exists aAa \in A such that f(a)=bf(a) = b.

  • One-to-One Correspondence (Bijective): both injective and surjective.

Inverse and Composition
  • Inverse Function (f1f^{-1}): If ff is a bijection, f1(b)=af^{-1}(b) = a when f(a)=bf(a) = b.

  • Composition (fgf \circ g): (fg)(a)=f(g(a))(f \circ g)(a) = f(g(a)). Range of gg must be a subset of the domain of ff.

Floor and Ceiling Functions
  • Floor Function (Greatest Integer Function) (x\lfloor x \rfloor): The largest integer less than or equal to xx.

  • Ceiling Function (x\lceil x \rceil): The smallest integer greater than or equal to xx.

  • Example Calculations:

    • 0.5=0\lfloor 0.5 \rfloor = 0

    • 0.5=1\lceil 0.5 \rceil = 1

    • 0.5=1\lfloor -0.5 \rfloor = -1

    • 0.5=0\lceil -0.5 \rceil = 0

  • Properties:

    • \lfloor x \rfloor = n \iff n \le x < n + 1

    • \lceil x \rceil = n \iff n - 1 < x \le n

    • x - 1 < \lfloor x \rfloor \le x \le \lceil x \rceil < x + 1

    • x=x\lfloor -x \rfloor = -\lceil x \rceil

    • x=x\lceil -x \rceil = -\lfloor x \rfloor

Sequences and Summations

Sequences

A sequence is an ordered list, formally a function from a subset of integers to a set SS.

  • Geometric Progression: a,ar,ar2,,arn,a, ar, ar^2, \dots, ar^n, \dots where aa is the initial term and rr is the common ratio.

  • Arithmetic Progression: a,a+d,a+2d,,a+nd,a, a+d, a+2d, \dots, a+nd, \dots where aa is the initial term and dd is the common difference.

Recurrence Relations

An equation expressing ana_n in terms of previous terms (e.g., a0,a1,,an1a_0, a_1, \dots, a_{n-1}).

  • Fibonacci Sequence: defined by f0=0,f1=1f_0 = 0, f_1 = 1 and fn=fn1+fn2f_n = f_{n-1} + f_{n-2} for n2n \ge 2.

  • Iteration: A method to solve recurrences by forward or backward substitution.

Summations

The sum of terms am,am+1,,ana_m, a_{m+1}, \dots, a_n is denoted by j=mnaj\sum_{j=m}^n a_j.

  • Geometric Series Formula:     j=0narj={arn+1ar1amp;if r1(n+1)aamp;if r=1\sum_{j=0}^n ar^j = \begin{cases} \frac{ar^{n+1} - a}{r - 1} &amp; \text{if } r \neq 1 \\ (n+1)a &amp; \text{if } r = 1 \end{cases}

  • Important Finite Sums:

    • k=1nk=n(n+1)2\sum_{k=1}^n k = \frac{n(n+1)}{2}

    • k=1nk2=n(n+1)(2n+1)6\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}

    • k=1nk3=n2(n+1)24\sum_{k=1}^n k^3 = \frac{n^2(n+1)^2}{4}

  • Infinite Series: For |x| < 1, k=0xk=11x\sum_{k=0}^{\infty} x^k = \frac{1}{1 - x}.

Cardinality and Infinite Sets

Countability
  • Two sets have the same cardinality if there is a one-to-one correspondence between them.

  • Countable Set: Finite or has the same cardinality as the positive integers (S=0|S| = \aleph_0, read as "aleph null").

  • Uncountable Set: Not countable.

  • Surprising Results:

    • The set of all integers is countable (0,1,1,2,2,0, 1, -1, 2, -2, \dots).

    • The set of positive rational numbers is countable (shown via a grid traversal excluding repeats).

    • The set of real numbers R\mathbb{R} is uncountable. This is proven via Cantor's Diagonalization Argument.

Schröder-Bernstein Theorem

If AB|A| \le |B| and BA|B| \le |A|, then A=B|A| = |B|. Equivalently, if there are injections from AA to BB and BB to AA, there is a bijection.

Uncomputable Functions

A function is uncomputable if no program can calculate all its values. Because the set of computer programs is countable but the set of functions from Z+\mathbb{Z}^+ to Z+\mathbb{Z}^+ is uncountable, such functions must exist.

Continuum Hypothesis

Asserts there is no cardinal number XX such that \aleph_0 < X < c, where c=Rc = |\mathbb{R}|. It has been shown that this hypothesis can neither be proven nor disproven under standard set theory axioms (Zermelo-Fraenkel).

Matrices

A matrix is a rectangular array of numbers. An m×nm \times n matrix has mm rows and nn columns.

Matrix Operations
  • Addition: For two m×nm \times n matrices AA and BB, the sum A+B=[aij+bij]A + B = [a_{ij} + b_{ij}].

  • Multiplication (ABAB): Defined when the number of columns in AA equals the number of rows in BB. If AA is m×km \times k and BB is k×nk \times n, ABAB is an m×nm \times n matrix where cij=s=1kaisbsjc_{ij} = \sum_{s=1}^k a_{is}b_{sj}.

    • Matrix multiplication is not commutative (ABBAAB \neq BA in general).

  • Identity Matrix (InI_n): Square matrix with 11s on the main diagonal and 00s elsewhere. AIn=ImA=AAI_n = I_m A = A.

  • Transpose (AtA^t): Obtained by swapping rows and columns (bij=ajib_{ij} = a_{ji}).

  • Symmetric Matrix: Square matrix where A=AtA = A^t.

Zero-One Matrices

Matrices with only 00 and 11 as entries.

  • Join (ABA \lor B): Entrywise Boolean OR.

  • Meet (ABA \land B): Entrywise Boolean AND.

  • Boolean Product (ABA \odot B): Similar to matrix multiplication but with OR (\lor) replacing addition and AND (\land) replacing multiplication.

  • Boolean Powers (A[r]A^{[r]}): The Boolean product of rr factors of AA.