Camp2013 Tutorial Combinatorics

Embed Size (px)

Citation preview

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    1/9

    Camp 2013 - Graph theory, invariants and periodic patterns

    Henk HOLLMANNSPMS-MAS #05-04,

    NTU, Singaporeemail: [email protected]; [email protected]

    May 24, 2013

    1

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    2/9

    1 Graph theory and examples of algorithmic invariants

    We begin with an intuitive introduction to graphs and directed graphs.

    A graph is a pair G = (V, E) of a finite set V (the vertices) and a finite set E (the edges, where eachedge e is associated with a pair of (not necessarily distinct) vertices called the endpoints of e. If anedge e has both endpoints equal to a vertex v, then the edge is called a loop at v. If two edges e1, e2have the same endpoints, then we speak of a multiple edge. A graph is called simple if it has noloops and multiple edges; in that case, we can think of E as a subset of

    V

    2

    , that is, each edge is a

    pair of vertices. A vertex v is called incident to an edge e if v is an endpoint of e; two vertices arecalled adjacent if there is an edge to which they are both incident.

    Figure 1: A graph with vertices x, y, z, u, a loop at v and a multiple edge {w, z}

    A walk in a graph G = (V, e) is a sequence

    v0, e1, v1, e2, v2, . . . , ek

    , vk

    where v0, . . . , vk are vertices, e1, . . . , ek are edges, such that ei has endpoints vi1 and vi (1 i n).The number k is called the length of the walk.The walk is called closed ifv0 = vk; if these are the onlyvertices that repeat, then the closed walk is called a cycle. If all the vertices v0, . . . , vk are distinct,then the walk is called a path.

    The graph G is connected if there is a path between every two vertices. Being connected is anequivalence relation; the equivalence classes are called the connected components. A cycle is a walkin the graph The valency or degree d(v) of a vertex v is the number of edges incident to v; here weadopt the convention that a loop at v contributes 2 to the degree of v. A vertex of degree 1 is calleda leaf. The graph is regular if the degree in each point is the same.

    A classical application of the pigeon-hole principle is the following.

    Problem 1 Every simple graph with at least two vertices has two vertices of the same degree.

    The single most important result in graph theory is the Handshaking Lemma. Be sure to rememberthis one!

    1

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    3/9

    Lemma 1.1 [Handshaking Lemma] The sum of the degrees in a graph equals twice the number of

    edges. That is, if G = (V, E) is a graph, thenvV

    d(v) = 2|E|.

    Proof: The proof is one of the most straightforward applications of the double counting method.Consider flags of the form (v, e) with v a vertex, e an edge, and v incident with e, that is, with v anendpoint of e. For the number F of flags, we find on the one hand that F =

    v d(v), and on the

    other hand F = |E|2 since every edge (also a loop!) has two endpoints, so contributes 2 to F. 2

    Problem 2 Suppose we have a collection of n points in the plane with the property that any two

    points are at distance at least 1. Show that there are at most 3n pairs of points with distance exactly1 between them.

    A graph G = (V, E) is called bipartite if it is possible to partition the vertex set V into twodisjoint parts V = A B in such a way that all edges have one endpoint in each of A, B. The partsA and B are called the partite sets. A well-known and easily proved result states that a graph isbipartite if and only if it does not contain any closed walks of odd size.

    A tree is a graph that is connected and has no cycles, that is, for every pair of vertices there is aunique path between them. Note that a tree is simple since both a loop and a multiple edge producea cycle.

    Lemma 1.2 If G = (V, E) is a tree, then |E| = |V| 1.

    Proof: The lemma obviously holds if |V| 2. Now suppose that |V| 3. Every tree has a leaf.(Why? If not, then keep on walking until you encounter a vertex already met earlier; this givesa cycle.) Remove the leaf together with the (unique) edge e incident to it. The remaining graphG = (V, E) with V = V {v} and E = E {e} is again connected without cycles, hence a tree.Now apply induction. 2

    The invariant for the above proof is |V| |E|. It remains invariant (= does not change) during theoperation of removing a leaf together with the corresponding vertex of degree 1.

    Trees are very interesting graphs, and there are many nice problems involving trees. We give afew examples.

    Problem 3 A vertex in a graph is called odd (or even)if its degree is odd (or even). Show that atree T has only odd vertices if and only if for every edge e, both components of T e (the graphobtained from T by removing edge e) have odd order.

    2

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    4/9

    Problem 4 Note that every tree is bipartite (it has no cycles at all). Show that every tree has a

    leaf in its larger partite set (and in both if they have the same size).

    A graph is planar if it can be embedded in the plane, a planar embedding, such that edges arenon-crossing. Consider a planar embedding without crossing edges of a planar graph G = (V, E).Such an embedding partitions the plane into faces, connected regions of the plane minus the graph.Note that one of the faces is infinite while all others are finite.

    Theorem 1.3 [Eulers formula] If a connected planar graphG = (V, E) is embedded without crossingedges, and with set of faces F, then |V| |E| + |F| = 2.

    Proof: Consider = |V| |E| + |F|. If G is a tree, then |F| = 1 (no cycles), so = 2. If G hascycles, then consider the effect of removing an edge on a cycle. This has the effect that |F|and |E|

    get one smaller wile |V| remains unchanged, hence is invariant. 2

    This theorem has various interesting applications. First of all, it can be used to determine all thePlatonic solids. For our purpose, a Platonic solid is a convex polyhedron; the faces are polygons,each containing the same number n of vertices, and the same number m of faces meet at each vertex.(Given such a solid, it can be deformed such that the faces are congruent regular polytopes.) Thereare exactly five such solids; each named after its number F of faces: the tetrahedron (F = 4),the cube or hexahedron (F = 6), the octahedron (F = 8), the dodecahedron (F = 12), and theicosahedron (F = 20). They are named after Plato, a famous Greek philosopher and mathematician.

    Example 1.4 Problem: find all Platonic solids. Solution: imagine a ball around the solid. Project

    it onto the ball, then cut the ball open around one face and spread it out in the plane by deformingit, to that the face that was cut open becomes the infinite face. In this way, we obtain a planar graphwhere the faces of the solid become the faces of the graph; the graph is regular of degree m and eachface contains n edges and n vertices. Suppose the resulting graph has V vertices, E edges, and Ffaces. Eulers formula states that

    V E+ F = 2.

    By the Handshaking Lemma (Yes, there it is!), we have

    2E = mV.

    Next, we use double counting to relate E and F. Consider flags of the form (e, f) with e an edge,

    f a face, and e f. Each edge is part of a face of the solid, hence on a cycle of the graph; as aconsequence, the faces on both side of the edge are distinct, so the edge is contained in two faces.On the other hand, each face contains n edges. So we conclude that

    2E = nF.

    3

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    5/9

    Combining the three formula, we find that

    E =

    1

    m+

    1

    n

    1

    2

    1.

    Now E is a positive integer, so the right-hand side is a positive integer and, in particular, 1m

    + 1n

    > 12

    .Obviously, m, n 3, and since 1/2 1/6 = 1/3, we have that m, n 5. So we quickly find that theonly possibilities are the following.

    m = n = 3, in which case E = 6, V = 4, F = 4; this is the tetrahedron.

    m = 3, n = 4, in which case E = 12, V = 8, F = 6; this is the cube.

    m = 3, n = 5, in which case E = 30, V = 20, F = 12; this is the dodecahedron.

    m = 4, n = 3, in which case E = 12, V = 6, F = 8; this is the octahedron.

    m = 5, n = 3, in which case E = 30, V = 12, F = 20; this is the icosahedron.

    Problem 5 [The utility problem](a) Suppose that three houses need to be connected to the gas, water, and electric companies. Is therea way to make all nine connections without any of the lines crossing each other? The correspondingutility graph, the complete bipartite graph K3, 3, has six vertices, grouped into two sets of three(representing the three houses and the three companies), with an edge between any two vertices from

    different groups and no edges between vertices in the same group. So the problem asks whether K3,3is planar or not. Use Eulers formula to show that K3,3 is in fact not a planar graph.(b) Similarly, use Eulers formula to show that K5, the complete graph on 5 vertices with an edgebetween any two of them, is nonplanar.

    Hint: every face of a potential embedding contains at least three edges...

    Let G = (V, E) be a graph. A subgraph of G is a graph H = (V, E) with V V and E E;the subgraph H is called spanning if V = V. A spanning tree of a graph is a spanning subgraphthat is also a tree. Obviously, if a graph has a spanning tree, then it is necessarily connected. Thefollowing converse is very important for practical applications and problem solving, so be sure toremember this one too!

    Theorem 1.5 Every connected graph has at least one spanning tree.

    4

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    6/9

    Proof: There are many algorithms to construct a spanning tree. Here is a simple one: Start with a

    connected graph G; at each step, remove an edge that is contained in a cycle; stop if no such edgesare left. The resulting subgraph T ofG is spanning (no vertices were removed), connected (since onlyedges are removed that are on a cycle), and has no cycles by the halting condition; so by definition,T is a tree. 2

    Every time when the wortd connected occurs in a problem about graphs, you should think of usinga spanning tree! Similarly, every time the words the same occur in a problem, you should think ofthe pigeonhole principle! The next practice problem provides a good illustration.

    Problem 6 Let G be a simple connected graph with n 4 points and 2n 3 edges. Show that Ghas two cycles of the same length.

    Problem 7 Let T be a tree on an even number of vertices. Show that T has a un ique (i.e., exactlyone) spanning subgraph in which the degree of every vertex is odd.

    1.1 Directed graphs and Euler graphs

    A directed graph or digraph is a pair G = (V, E) of a finite set V (the vertices) and a finite set E(the directed edges or arcs), where each directed edge e has a begin or tail vertex t(e) and an end orhead vertex h(e); we say that edge e is directed from t(e) to h(e). The underlying undirected graph

    Figure 2: A directed graph with vertices a,b,c,d,e with a loop at c

    is the graph G obtained from G by replacing each directed edge by an undirected one. A directedgraph is called connected if its underlying undirected graph is connected. Directed walks, paths, andcycles are defined in the obvious way.

    5

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    7/9

    Let G = (V, E) be a directed graph. The out-degree d+(v) of a vertex v V is the number of

    edges directed outwards from v, that is, the number of edges e E for which t(e) = v. Similarly,the in-degree d(v) is the number of edges directed towards v, that is, the number of edges e Efor which h(e) = v.

    Lemma 1.6 [Handshaking Lemma for directed graphs] Let G = (V, E) be a directed graph. ThenvV

    d+(v) =vV

    d(v) = |E|.

    Proof: By double counting both the flags (v, e) with v = t(e) and the flags (v, e) with v = t(e). Or,what is essentially the same argument, by the observation that each edge contributes exactly 1 toboth of the degree sums. 2

    Definition 1.7 A directed graph G = (V, E) is called balanced if the in-degree and out-degree inevery vertex are equal, that is, if d+(v) = d(v) for every v V. A directed graph is called Eulerianif the graph is both balanced and connected.

    A Eulerian circuit for a directed graph G = (V, E) is a closed walk in G that uses every edgeof the graph exactly once. Since such a closed walk enters and leaves each vertex the same numberof times, a directed graph possessing a Eulerian circuit is necessarily balanced and connected, i.e.,Eulerian. Probably the most important and useful result for directed graphs is the following converse.

    Theorem 1.8 A directed graph G = (V, E) has a Eulerian circuit if and only if it the graph is

    Eulerian.Proof: (Sketch) Let G be Eulerian. We build up an Eulerian circuit C for G as follows. Initially,C = , and no edge is marked. At each stage of the algorithm, we chose an unmarked edge e withtail v = t(e) (we choose v C except initially, when C is still empty), and start a directed walk Wfrom this edge. Each time that we extend W, we mark the new edge; we continue until we reach v.Indeed, the balanced condition ensures that we will never get stuck except possibly at v. Then wecombine the closed walk W and the current circuit C into a larger circuit C. If we cannot extendthe circuit any further, then since G is connected, every edge must be included in C. 2

    A typical application is the following.

    Problem 8Let G be a finite group of order |G| = n, generated by two elements a, b in G. Prove ordisprove: there is a sequence g1, g2, . . . , g2n of group elements such that

    1. Every element of the group occurs exactly twice in the sequence;

    2. For 1 i 2n, we have gi+1 {gia, gib} (here g2n+1 = g1).

    6

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    8/9

    1.2 Periodicity and recurrent relations

    Example 1.9 Let a and m be positive integers. Show that the sequence a, a2, a3, . . . is eventuallyperiodic modulo m.Solution: The sequence modulo m can be obtained as follows: a1 = a and an aan1 mod m for alln 2. By the pigeon-hole principle, among the numbers a1, . . . , am+1, two must be the same. Nowif ai = aj with 1 i < j m + 1, then ai+1 = aj+1, and, in general, ai+k = aj+k for all k 0. Sothe sequence is eventually periodic, with period j i.Remark: as an example, if m = 12 and a = 2, then the sequence an is

    2, 4, 8, 4, 8, 4, 8,...

    2

    Example 1.10 (a) The Fibonacci numbers are defined by F1 = F2 = 1 and Fn = Fn1+Fn2. Showthat the sequence fn = Fn mod 10 is eventually periodic. Then show that it is periodic.(b) Show that for some n 1, the n-th Fibonacci number Fn ends in 2013 zeros.Proof of (a): Consider pairs (Fn, Fn+1). Modulo 10, there are at most 100 possibilities for such pairs,so among these pairs for n = 1, . . . , 101, two must be the same modulo10. Now as in the previousproblem, if (Fi, Fi+1) and (Fj , Fj+1) are equal modulo 10, for 1 i < j, then from the recurrentrelation we see that also (Fi+k, Fi+k+1) and (Fj+k, Fj+k+1) are equal modulo 10 for all k 0, and inparticular we see that the sequence is eventually periodic, with period j i. Since we can also gobackward (we have Fn = Fn+2 Fn+1, the previous relation in fact holds for all k, and the sequenceis periodic.Remark 1: in fact, Fn+60 Fn mod 10.Remark 2: We now see that a similar thing holds much more general. Define a sequence {an}n1 byletting

    a1 = 1, . . . , ar = r,

    andan = c1an1 + c2an2 + + cranr,

    for certain constants 1, . . . , r (the initial values) and certain other constants c1, . . . , cr that deter-mine the recurrent relation for the sequence. We say that the sequence satisfies a recurrent relationof order r. Then, if all constants are integer and if m is also integer, then the sequence an mod m is

    eventually periodic (since the r-tuples (an, . . . , an+r1) repeat modulo m after at most mr

    + 1 steps),and is even periodic if cr and m are relatively prime (then you can go backwards, verify that foryourself).Proof of (b): for any m, there exist n and k such that Fn+k Fn and Fn+k1 Fn1, where all are modulo m. Hence Fn+k Fn holds for every n. In particular, Fk F0 = 0. 2

    7

  • 7/27/2019 Camp2013 Tutorial Combinatorics

    9/9

    Extra invariance and periodicity problems

    Problem 9 We play the following game on a sequence 101, 102, . . . , 200. A move consists of chosingtwo numbers a, b in the sequence, remove them, and replace them by the single number ab + a + b.When we have made 99 moves, one number remains. Determine the possible values of this number.

    Problem 10 Consider the array of numbers

    11 1 1

    1 2 3 2 11 3 6 7 6 3 1

    1 4 1 0 1 6 1 9 1 6 1 0 4 1...

    where each number is the sum of the three numbers above, above diagonally left, and above diagonallyright (empty places contribute 0). Show that every row except the first two contains an even number.

    Problem 11 The sequence f0, f1, . . . of Fibonacci numbers is defined by f0 = 0, f1 = 1, fn+2 =fn + fn+1 (n 0). The sequence F0, F1, . . . of Fermat numbers is defined by Fm = 22

    m

    for m 0.Determine all pairs (n, m) of nonnegative integers for which fn = Fm.

    An extra, completely different problem that I likeSomething bizar to end with:

    Problem 12 Let {xn} (n Z) be a two-sided infinite sequence of reals for which |xn| = xn1 + xn+1holds for every n Z. Show that the sequence is periodic, with period 9.

    8