Fermat's little theorem: if p is prime, then ap ≡ 1 mod p for all a ≢ 0
(n choose k) = n! / (n-k)!k! = n×(n-1)×...×(n-k+1) / k×(k-1)×...×3×2×1
Birthday formula: if N values are chosen from among M, the probability p of no duplicates is (M/M)*(M-1)/M*(M-2)/M*...*(M-N+1)/M. The probability of two values being the same is then 1-p.
Approximate birthday formula: if N values are chosen from among M, the probability of no duplicates ≃ 1 - N2/2M, for N randomly distributed choices each in the range 1..M. The approximation is good as long as N2/2M is small compared to 1. The probability of duplicates is then N2/2M; again, this is accurate if it is much less than 1.0.
Bayes formula: P(A|B) = P(B|A)*P(A)/P(B), where P(A|B) denotes the probability of event A given that event B is known to have occurred. B may represent an event that directly reflects some partial information about A, or B may be independent of A, or somewhere in between.
Poisson distribution: if the average rate is λ, the probability P of the exact number being k is P(X=k) = λke-λ/k!.
A graph is a set of individual nodes called vertices (or vertexes) joined selectively by edges. In a standard graph, you cannot have two or more edges between the same pair of vertices. A multigraph is a variation which allows multiple edges between the same pair of vertices.
Two vertices are adjacent if they are connected by an edge.
A bipartite graph is a graph that can be colored with two colors so that no edge connects two vertices of the same color. Alternatively, a bipartite graph is a graph for which the set of vertices can be partitioned into two sets, such that no edge connects two vertices in the same set.
A complete graph is a graph in which every pair of vertices is connected by an edge. A complete bipartite graph is a graph in which vertices are colored with two colors, and every pair of differently-colored vertices is connected by an edge.
The chromatic number of a graph is the minimum number of colors needed to color all vertices, so that no adjacent vertices have the same color. Such a coloring is known as a proper vertex coloring.
A path is a sequence of adjacent vertices (or a sequence of edges, each consecutive pair of which stop and start at the same vertex)
A cycle is a path that returns to the same vertex, and in which no vertex is repeated.
An Euler path is a path that traverses each edge exactly once. It is an Euler cycle if it stops and starts at the same vertex.
A planar graph is one that can be drawn on the plane with no edge crossings.
A tree is a graph with no cycles. Between any two vertices of the tree, there is a unique path. The tree satisfies v -1 = e.
Handshaking formula: sum of all vertex degrees is 2*edges
Tree formula: If a graph is a tree, then vertices - edges = 1.
Euler formula: for any planar graph, vertices + faces - edges = 2. The concept of faces does not make sense for non-planar graphs!
Euler path: a path through a graph that uses every edge exactly once.
Hamilton path: A path through a graph that goes through every vertex exactly once, but it may skip some edges or use them twice.
DFA: A directed graph with the edges labeled with letters. At each vertex, the next input letter uniquely determines the next vertex. A string is matched by the DFA if each consecutive letter of the string leads to a successive vertex of the DFA, so that when we reach the end of the string the graph vertex is a designated stopping vertex.
NFA: Like a DFA, but sometimes two edges may leave the same vertex labeled with the same letter. Also, some edges may be labeled with the empty string; such edges may always be taken. An input string now determines a sequence of sets of vertices.