CS2304 Overall Review

Final review for CS2304, Mathematical Foundations of Computer Science.

Set and Ordering

I won’t repeat the basics of set theory here.

Symmetric difference: the elements that are in or but not both:

Relations and Functions

  • Ordered pair:
  • Cartesian product:

Relations

  • Binary relation: (a set of ordered pairs)
  • Properties:
    • Reflexivity:
    • Symmetry:
    • Transitivity:

Equivalence Relations and Partitions

  • Equivalence relation: a relation that is reflexive, symmetric and transitive at the same time
  • Equivalence class:
  • Partition: a family of non-empty, mutually disjoint subsets of A that covers A

Functions

  • Definition of a function: a relation F such that
    • , written F(x) = y
  • Special functions:
    • Injective:
    • Surjective:
    • Bijective: both injective and surjective

Orderings

Partial Order

  • Definition: a relation satisfying:
    • Reflexivity:
    • Antisymmetry:
    • Transitivity:
  • A linear order (Total Order) is a special case of a partial order that satisfies:
    • Any two elements are comparable:
    • Unique maximal and minimal elements
  • Hasse Diagram:
    keeps only the immediate successor relation ( means is the immediate successor of )

Special Elements

Element typeDefinition
Minimal (no smaller element)
Maximal (no larger element)
Smallest
Largest

Properties:

  • The largest/smallest element is always maximal/minimal, but the converse does not hold
  • A finite partially ordered set always has minimal and maximal elements

Linear Extension Theorem

Linear extensions: for a finite partially ordered set , there exists a linearly ordered set such that

That is, any partial order can be extended to a linear order while preserving the original order relation. (This is actually topological sorting.)

Antichains and Chains

ConceptDefinition
ChainAny two elements are comparable:
AntichainNo two elements are comparable:

Dilworth’s Theorem

  • Core result: the size of the largest antichain equals the minimum number of antichains in a partition
  • Corollary:
    where is the size of the largest antichain and is the length of the longest chain

Application: the Erdős–Szekeres Lemma

Any sequence of real numbers contains a monotone subsequence of length .

Cardinality

Equinumerosity

  • Definition:
  • Important results:
    • (the natural numbers and the rationals are equinumerous)
    • (the reals are uncountable)
    • (Cantor’s theorem)

Continuum Hypothesis

  • Question: is there a cardinal with ?
  • Conclusion: it can be neither proved nor disproved within the ZFC axiom system (Gödel & Cohen)

Combinatorics

Basic Counting Problem: The Balls-into-Boxes Model

The different cases of putting n balls into m boxes:

Ball type \ Box typeNo restriction≤1 ball per box≥1 ball per box
Distinct balls, distinct boxes
Identical balls, distinct boxes
Distinct balls, identical boxes
Identical balls, identical boxes

where:

  • : the falling factorial
  • : Stirling numbers of the second kind (set partitions)
  • : the number of ways to partition the integer n into k parts

Basic Counting Principles

Counting Subsets

  • Number of subsets of an n-element set:
  • Number of k-element subsets:

Counting Permutations

  • Number of permutations of an n-element set:
  • Permutations with constraints (multinomial coefficients):

The Binomial and Multinomial Theorems

Binomial Theorem

Corollaries:

Multinomial Theorem

Generalized Binomial Theorem (Newton)

where

Special Counting Sequences

Catalan Numbers

Definition:

Recurrence:

Applications:

  • Triangulations of a convex (n+2)-gon
  • Dyck paths (lattice paths that do not cross the diagonal)
  • Number of valid parenthesis sequences

Stirling Numbers

  • Stirling numbers of the second kind (set partitions):

  • Stirling numbers of the first kind (permutations by cycles):

Properties:

Inclusion–Exclusion Principle

Basic Formula

Applications

Derangements:

Euler’s totient function:

Generating Functions

Ordinary Generating Functions (OGF)

Definition:

Operations on Generating Functions

OperationDescriptionChange in generating functionChange in the sequence
AdditionAdd the sequences and
Scaling by a constantMultiply the sequence by a constant
Right shiftShift the sequence right by n positions (pad the first n with 0)
Left shiftShift the sequence left by n positions (drop the first n terms)
Substitute Multiply the terms by
Substitute Take one element every terms
DifferentiationMultiply the terms by the index n
IntegrationDivide the terms by
Multiplication/convolutionConvolution of two sequences

Applications

Fibonacci sequence:

Catalan numbers:

Solving Recurrence Relations

Homogeneous Linear Recurrences

Method:

  1. Solve the characteristic equation:
  2. Build the general solution according to the roots:
    • Simple root :
    • Root of multiplicity :

Non-homogeneous Recurrences

General solution = homogeneous solution + particular solution (guess the particular solution from the form of )

Asymptotic Analysis

Asymptotic Notation

  • f(n) = O(g(n)):
  • : f=O(g) and g=O(f)

Important Asymptotic Estimates

Factorial (Stirling’s formula):

Harmonic series:

Binomial coefficients:

Graph theory

Already covered in detail in Graph Theory

(Rant: I started learning graph theory in Data Structures in the second semester of freshman year, learned it again in Circuit Theory and Discrete Mathematics in the first semester of sophomore year, and then once more in Algorithms and this math course in the second semester of sophomore year. Saturation-style learning, I guess.)

The probabilistic method

Same as above, I won’t repeat the basic concepts.

Random Variables

Definition and Distribution

  • Random variable
  • Discrete distribution:

Expectation and Variance

  • Expectation:
  • Variance:
  • Linearity:

Common Distributions

DistributionPMFExpectationVariance
Bernoulli(p)
Binomial(n,p)
Geometric(p)

Memorylessness of the Geometric Distribution


Probability Inequalities

Basic Inequalities

  • Markov: for non-negative and :
  • Chebyshev:

Chernoff Bounds

For independent Bernoulli() variables, , :

  • Upper tail:
  • Lower tail:

The Probabilistic Method

By choosing objects of a specified class at random and showing that the probability of obtaining the target object is greater than zero, we prove that it exists. This is a non-constructive method.

Basic Counting Arguments

  • Existence of Boolean functions: there exists an -variable Boolean function that needs symbols to describe

Expectation Arguments

  • Graph cuts: a graph with vertices and edges has a partition with a cut
  • Lower bound on independent sets:
  • MAXSAT: with clauses (minimum length ), there exists an assignment satisfying clauses

Lovász Local Lemma

For events whose dependency graph has maximum degree , if and , then:

Applications:

  • A -SAT instance is satisfiable when each variable appears times
  • Existence of edge-disjoint paths: a solution exists when

Random graph

Random Graphs


Translated from the Chinese original.

Welcome to my other publishing channels

中文