Course Theory
Book 1. Foundations of Olympiad Combinatorics
Book 1. Foundations of Olympiad Combinatorics
- 1. Counting Principles
- 2. Permutations and Arrangements
- 3. Combinations
- 4. Counting in Two Ways
- 5. Pigeonhole Principle I
- 6. Invariants I
- 7. Coloring and Board Problems
- 8. Games and Strategies I
- 9. Graphs I
- 10. Recursion and Sequences
- 11. Mixed Problems I
- 12. Mock Olympiads I
Chapter
Counting Principles
Key Idea
Counting begins not with a formula, but with the question: what is chosen first, what is chosen next, and does the next choice depend on the previous one? The sum rule is used for disjoint cases, while the product rule is used for sequential choices when the number of options at each step is known.
The olympiad difficulty is often not arithmetic, but avoiding double counting and missing forbidden cases. Therefore this module emphasises a careful order of choice, casework, and complement counting.
Basic Facts
- If an object can be obtained in \(a\) ways of one type or \(b\) ways of another type, and the types are disjoint, there are \(a+b\) ways.
- If the first step has \(a\) choices and after each first step the second has \(b\) choices, there are \(a\cdot b\) ways.
- If the number of choices on a later step depends on an earlier step, write a product by cases or draw a choice tree.
- Complement counting: sometimes it is easier to count all objects and subtract the forbidden ones.
- Overcounting happens when the same object can be obtained in several ways; then choose a different order or divide by the number of repetitions.
When to Use This Method
- You need to count numbers, words, paths, selections, or colorings with simple restrictions.
- The condition naturally splits into disjoint cases.
- Forbidden objects are easier to count than allowed objects.
- There is a danger that different descriptions produce the same object.
How to Recognise the Method
The word “or” often suggests the sum rule, provided the cases are disjoint. Words like “first”, “then”, and “after that” suggest the product rule. If the statement says “at least one”, “not less than one”, or “without such a property”, check the complement method.
If several objects are chosen, ask: does order matter? If order does not matter, one cannot simply multiply sequence choices without later correction.
Typical Mistakes
- Adding choices when the choices must be made simultaneously.
- Multiplying cases that overlap.
- Forgetting that the first digit of a number cannot be \(0\).
- Counting “at least one” directly when complement counting is shorter.
- Counting the same object twice because it was chosen in different orders.
Mini-Checklist
- What exactly counts as one object?
- Does the order of choices matter?
- Are the cases truly disjoint?
- Are forbidden objects easier to subtract?
- Does a later choice depend on an earlier one?
- Can the same object be obtained in several ways?
Example 1. Sum Rule
The cases must be disjoint.
Problem. A student has \(5\) mathematics books and \(4\) physics books. In how many ways can he choose one book?
He chooses either a mathematics book or a physics book. These cases do not overlap. Therefore there are \(5+4=9\) ways.
Comment. If he had to choose two books, one mathematics and one physics, it would be a product, not a sum.
Example 2. Product Rule
Sequential steps give a product.
Problem. There are \(3\) roads from city \(A\) to city \(B\), and \(4\) roads from \(B\) to \(C\). How many routes go from \(A\) to \(C\) through \(B\)?
First choose the road \(A o B\): \(3\) choices. Then choose the road \(B o C\): \(4\) choices. Total: \(3\cdot4=12\) routes.
Comment. Every first choice is compatible with every second choice.
Example 3. Choosing Without Repetition
The number of choices changes after each step.
Problem. How many three-digit numbers can be formed from digits \(1,2,3,4,5\) if digits do not repeat?
The hundreds digit can be chosen in \(5\) ways, the tens digit in \(4\) ways, and the units digit in \(3\) ways. Total: \(5\cdot4\cdot3=60\).
Comment. After the first digit is chosen, it is no longer available.
Example 4. The First Digit Is Not Zero
The restriction on the first step must not be forgotten.
Problem. How many three-digit numbers with distinct digits can be formed from \(0,1,2,3,4\)?
The hundreds digit can be chosen in \(4\) ways: \(1,2,3,4\). Then \(4\) digits remain for the tens place and \(3\) for the units place. Total: \(4\cdot4\cdot3=48\).
Comment. Starting with \(5\cdot4\cdot3\) would count strings that begin with zero.
Example 5. Complement Counting
“At least one” is often better counted by the opposite condition.
Problem. How many binary strings of length \(6\) contain at least one \(1\)?
There are \(2^6=64\) binary strings in total. There is exactly one string with no ones: \(000000\). Therefore the answer is \(64-1=63\).
Comment. Direct counting by the number of ones would be longer.
Example 6. Cases by the Last Digit
Splitting into cases helps handle divisibility.
Problem. How many four-digit numbers with distinct digits from \(0,1,\ldots,7\) are divisible by \(5\)?
The last digit must be \(0\) or \(5\). If it is \(0\), the first digit has \(7\) choices, then \(6\), then \(5\): \(210\). If it is \(5\), the first digit is neither \(0\) nor \(5\): \(6\) choices, then \(6\), then \(5\): \(180\). Total: \(390\).
Comment. The cases are disjoint, so their counts are added.
Example 7. Overcounting
Sometimes the order of choosing creates extra copies.
Problem. In how many ways can two monitors be chosen from \(8\) students if the roles are identical?
If we choose first and second in order, we get \(8\cdot7=56\) choices. But each pair is counted twice: \(AB\) and \(BA\). Therefore the answer is \(56/2=28\).
Comment. This is the first signal that order is not always part of the object.
Example 8. Complement with Two Restrictions
Two forbidden conditions require adding back the intersection.
Problem. How many words of length \(5\) over the alphabet \(\{A,B,C\}\) contain at least one \(A\) and at least one \(B\)?
There are \(3^5=243\) words in total. Without \(A\): \(2^5=32\). Without \(B\): \(2^5=32\). Without both \(A\) and \(B\), the word consists only of \(C\), so there is one. By complement counting, the answer is \(243-32-32+1=180\).
Comment. The intersection of the two forbidden sets was subtracted twice, so it must be added back.
Chapter
Permutations and Arrangements
Key Idea
A permutation is an arrangement of objects in order. The key difference from simple selection is that order is part of the object. If all objects are distinct, \(n\) objects can be arranged in \(n!\) ways. If some objects are identical, overcounting from permuting identical copies must be removed.
Olympiad permutation problems rarely reduce to one formula. More often, one needs the right device: glue a block, subtract forbidden adjacencies, fix a rotation in circular seating, or split by positions.
Basic Facts
- \(n\) distinct objects can be arranged in a line in \(n!\) ways.
- If \(k\) objects are chosen and ordered from \(n\) distinct objects, the number of ways is \(n(n-1)\cdots(n-k+1)\).
- If among \(n\) objects there are identical groups of sizes \(a,b,c,\ldots\), the number of distinct permutations is \(n!/(a!b!c!\cdots)\).
- In circular seating, rotations are considered the same, so \(n\) distinct people can be seated at a round table in \((n-1)!\) ways.
- If several objects must be together, glue them into one block and then count the internal order of the block.
When to Use This Method
- You need to arrange people, books, letters, digits, or objects in a row or around a circle.
- The statement contains “next to”, “not next to”, “in a certain order”, or “in fixed positions”.
- There are repeated letters or repeated objects.
- It is easier to count all arrangements and subtract forbidden ones.
How to Recognise the Method
If objects must be together, try a block. If objects must not be together, it is often easier to subtract cases where they are together. If the arrangement is circular, first fix one object or use \((n-1)!\). If there are identical letters, first count as if they were distinct and then divide by permutations of identical copies.
For forbidden positions, ask whether the restrictions are independent or overlap. If they overlap, inclusion-exclusion may be needed.
Typical Mistakes
- Counting circular seating as linear seating.
- Forgetting the internal order of a glued block.
- Subtracting forbidden cases but forgetting that several restrictions can hold at once.
- Dividing by factorials of repeated objects when the objects were already treated as indistinguishable.
- Confusing “\(A\) before \(B\)” with “\(A\) next to \(B\)”.
Mini-Checklist
- Are the objects distinct or are some identical?
- Is the arrangement linear or circular?
- Are there blocks that must stay together?
- Is “not adjacent” easier directly or by complement?
- Does order inside the chosen group matter?
- Can forbidden conditions overlap?
Example 1. Permuting Distinct Objects
Basic technique: each next choice reduces the number of options.
Problem. In how many ways can \(6\) different books be arranged on a shelf?
The first position has \(6\) choices, the second \(5\), then \(4,3,2,1\). Total: \(6!=720\).
Comment. This is a linear arrangement of distinct objects.
Example 2. Repeated Letters
Identical letters create overcounting.
Problem. How many distinct words can be obtained by rearranging the letters of \(BANANA\)?
There are \(6\) letters. The letter \(A\) appears \(3\) times and \(N\) appears \(2\) times. If all copies are treated as distinct, there are \(6!\) arrangements, but each word is counted \(3!\cdot2!\) times. Answer: \(6!/(3!\cdot2!)=60\).
Comment. Divide only by permutations of identical letters.
Example 3. Adjacent Block
If two objects must stand together, glue them.
Problem. In how many ways can \(6\) people stand in a row if Anton and Boris must stand together?
Glue Anton and Boris into a block. Then there are \(5\) objects: the block and \(4\) other people. They can be arranged in \(5!\) ways. Inside the block there are \(2\) orders. Answer: \(2\cdot5!=240\).
Comment. Do not forget the internal order of the block.
Example 4. Not Adjacent by Complement
A prohibition is often easier as all minus bad.
Problem. In how many ways can \(6\) people stand in a row if Anton and Boris must not stand together?
There are \(6!=720\) total arrangements. They stand together in \(2\cdot5!=240\) ways. Therefore the number not together is \(720-240=480\).
Comment. This is the complement of the previous problem.
Example 5. Circular Seating
In a circle, rotations are considered the same.
Problem. In how many ways can \(5\) distinct people sit at a round table?
Fix one person. The remaining \(4\) people can be arranged around that person in \(4!\) ways. Answer: \(24\).
Comment. Fixing one person removes rotation.
Example 6. Circle and Adjacency
Blocks also work at a round table.
Problem. In how many ways can \(6\) people sit at a round table if two specified people must sit together?
Glue the two people into a block. We get \(5\) objects around a circle, which can be arranged in \((5-1)!=24\) ways. The block has \(2\) internal orders. Answer: \(48\).
Comment. First handle the circle, then the block order.
Example 7. Before, Not Necessarily Adjacent
Half of all permutations have \(A\) before \(B\).
Problem. How many permutations of \(1,2,3,4,5\) have \(1\) before \(2\)?
In all \(5!\) permutations, the numbers \(1\) and \(2\) are symmetric: in exactly half, \(1\) comes before \(2\), and in half the reverse happens. Answer: \(5!/2=60\).
Comment. This is not an adjacency condition.
Example 8. First Inclusion-Exclusion
Forbidden fixed points overlap.
Problem. How many permutations of \(1,2,3,4\) leave no number in its own position?
There are \(4!=24\) total permutations. Subtract those with at least one fixed point: \(4\cdot3!\). Add back intersections of two fixed points: \(6\cdot2!\). Subtract three: \(4\cdot1!\). Add four: \(1\). Answer: \(24-24+12-4+1=9\).
Comment. This is the first derangement problem.
Chapter
Combinations
Key Idea
A combination is a selection of objects without regard to order. If the order of selection is not part of the answer, sequential counting usually overcounts. The number of ways to choose \(k\) objects from \(n\) is denoted by \(\binom{n}{k}\).
In olympiad combinatorics, combinations are more than a formula. They encode objects: positions of ones, vertices of a polygon, boundaries of a rectangle, elements of a subset, or places for dividers.
Basic Facts
- \(\binom{n}{k}\) is the number of ways to choose \(k\) objects from \(n\), ignoring order.
- \(\binom{n}{k}=\binom{n}{n-k}\): choosing \(k\) objects is the same as choosing the \(n-k\) objects not taken.
- Pascal's identity: \(\binom{n}{k}=\binom{n-1}{k}+\binom{n-1}{k-1}\).
- Complement counting: “at least one” is often counted as all cases minus cases without the property.
- Choosing nonconsecutive elements often reduces by shifting: replace \(a_1<\cdots
When to Use This Method
- You need to choose a team, subset, positions, vertices, or a collection of objects.
- The order of choice does not matter.
- The problem says “exactly \(k\)”, “at least \(k\)”, or “at least one”.
- You need to prove a combinatorial identity by counting the same collection in two ways.
How to Recognise the Method
If an object is completely determined by a set of chosen elements, use combinations. If it is determined by positions of special symbols, choose positions. If the condition says “not consecutive”, write the chosen numbers as \(a_1<\cdots If a formula looks algebraic, ask: what does the left-hand side count, and what does the right-hand side count?
Typical Mistakes
- Counting ordered choices when order does not matter.
- Forgetting to subtract forbidden cases in “at least” problems.
- Using the combination formula without saying what is being chosen.
- Confusing choosing \(k\) objects with partitioning objects into groups.
- In nonconsecutive selection problems, forgetting the required gaps.
Mini-Checklist
- Is one answer a set or an ordered list?
- Which elements are being chosen?
- Can the complement be counted?
- If there is a “not adjacent” condition, where are the required gaps?
- If proving an identity, what common object do both sides count?
- Do we need to split by the number of objects of different types?
Example 1. Choosing Without Order
A team does not depend on the order of selection.
Problem. In how many ways can \(3\) students be chosen from \(8\)?
If we choose in order, we get \(8\cdot7\cdot6\), but each team of three is counted \(3!\) times. Therefore the answer is \(8\cdot7\cdot6/3!=56\).
Comment. This is \(\binom{8}{3}\).
Example 2. Complementary Choice
Sometimes it is easier to choose what remains.
Problem. In how many ways can \(4\) books be chosen from \(10\) if one specified book must be chosen?
The specified book is already chosen. We must choose \(3\) more books from the remaining \(9\). Answer: \(\binom{9}{3}=84\).
Comment. There is no need to consider the position of the specified book.
Example 3. At Least One Girl
Complement counting shortens casework.
Problem. From \(5\) boys and \(4\) girls, a team of \(3\) is chosen. How many teams contain at least one girl?
There are \(\binom{9}{3}=84\) teams in total. Teams with no girls: \(\binom{5}{3}=10\). Therefore the answer is \(84-10=74\).
Comment. The words “at least” often suggest complement counting.
Example 4. Pascal's Identity
The same set can be counted according to whether a special element is present.
Problem. Prove \(\binom{n}{k}=\binom{n-1}{k}+\binom{n-1}{k-1}\).
Choose a \(k\)-element subset from an \(n\)-element set and fix one element \(x\). Either \(x\) is not chosen: then choose all \(k\) elements from the other \(n-1\). Or \(x\) is chosen: then choose the remaining \(k-1\) from the other \(n-1\). This gives the identity.
Comment. This proof is more memorable than the formula.
Example 5. Positive Solutions
Dividers encode distribution.
Problem. How many positive solutions does \(x+y+z=10\) have?
First put \(1\) into each variable. There remain \(7\) units to distribute among \(3\) variables. This is encoded by two dividers among \(9\) positions, so the answer is \(\binom{9}{2}=36\).
Comment. One may also think of a string of ones and two dividers.
Example 6. No Consecutive Numbers
A shift removes the required gaps.
Problem. How many \(3\)-element subsets of \(\{1,\ldots,10\}\) contain no consecutive numbers?
Let the chosen numbers be \(a_1
Comment. This is the standard technique for forbidding adjacency.
Example 7. Sum by Number of Girls
Split by the type of selected objects.
Problem. How many teams of \(4\) can be chosen from \(6\) boys and \(5\) girls if the team must contain exactly \(2\) girls?
Choose \(2\) girls from \(5\) and \(2\) boys from \(6\). These choices are independent. Answer: \(\binom{5}{2}\binom{6}{2}=10\cdot15=150\).
Comment. Typical selection from two groups.
Example 8. A Small Theorem on Comparable Subsets
Combinations help us understand layer sizes.
Problem. Why do any \(7\) subsets of a four-element set contain two subsets one of which contains the other?
All \(16\) subsets can be split into \(6\) inclusion chains: one long chain from \(\varnothing\) to the full set, three chains of length \(3\), and two singleton chains in the middle layer. By the pigeonhole principle, \(7\) chosen subsets hit the same chain twice, and any two sets in a chain are comparable.
Comment. This previews future ideas about chains and antichains.
Chapter
Counting in Two Ways
Key Idea
Double counting means counting the same set of objects in two different ways. The result may be an equality, an identity, an average, or a proof that an object with a desired property must exist.
Most often, we count pairs: \((student,club)\), \((vertex,edge)\), \((subset,element)\), \((point,line)\). If the right pairs are chosen, the problem often becomes short.
Basic Facts
- If the same finite set is counted in two ways, the answers are equal.
- The sum of degrees of a graph equals \(2E\), because every edge has two ends.
- If \(T\) objects are distributed among \(m\) boxes, some box contains at least the average \(T/m\).
- The number of pairs \((S,x)\), where \(x\) belongs to subset \(S\), can be counted by \(S\) or by \(x\).
- Double counting often turns “prove existence” into a statement about an average.
When to Use This Method
- The problem contains relations between objects: a student attends a club, a point lies on a line, a vertex is incident to an edge.
- You need to prove a combinatorial identity.
- There is a table, rows and columns, and entries can be counted in two ways.
- You need to prove existence of an object with high or low load.
How to Recognise the Method
Look for phrases such as “each object is connected to”, “in every group”, “each pair”, “total number of memberships”, or “average number”. They almost always suggest a set of pairs or incidences.
If you see a sum like \(0C(n,0)+1C(n,1)+\cdots+nC(n,n)\), try counting pairs “chosen subset and marked element inside it”.
Typical Mistakes
- Counting two different sets of objects instead of one set in two ways.
- Forgetting that each graph edge has two ends.
- Using an average but not stating the conclusion “there exists at least the average”.
- Confusing ordered pairs and unordered pairs.
- In identity problems, not explaining what is being counted.
Mini-Checklist
- What set of objects are we counting?
- Can each object be described as a pair \((a,b)\)?
- What happens if we count by the first component?
- What happens if we count by the second component?
- Do we need equality or only an estimate?
- How does the average imply existence?
Example 1. Handshakes
Each handshake can be counted by its two participants.
Problem. In a room of \(10\) people, everyone shook hands with everyone else. How many handshakes occurred?
Count pairs of people: choose \(2\) people from \(10\), giving \(45\). Equivalently, each person gives \(9\) handshake-ends, \(90\) ends in total, and each handshake has two ends, so \(90/2=45\).
Comment. This is the first version of sum of degrees.
Example 2. Club Memberships
Count pairs “student — club”.
Problem. In a school, \(30\) students each attend exactly \(2\) clubs. How many student-club memberships are there?
Each student gives \(2\) pairs \((student,club)\). Total: \(30\cdot2=60\) memberships.
Comment. If club sizes are known, their sum must also be \(60\).
Example 3. Average Gives Existence
If the average is large, someone is at least average.
Problem. There are \(60\) memberships across \(8\) clubs. Prove that some club has at least \(8\) students.
If every club had at most \(7\) students, the total would be at most \(8\cdot7=56\) memberships. But there are \(60\). Hence some club has at least \(8\) students.
Comment. This is the average argument in contradiction form.
Example 4. Sum of Degrees
Every edge has two ends.
Problem. Prove that in every graph, the sum of all vertex degrees equals twice the number of edges.
Count pairs \((v,e)\), where vertex \(v\) is an endpoint of edge \(e\). Counting by vertices gives the sum of degrees. Counting by edges gives \(2\) pairs per edge. Thus the sum of degrees is \(2E\).
Comment. This is the main graph-counting lemma.
Example 5. Identity with Subsets
Count a subset and a marked element.
Problem. Prove that \(\sum_{k=0}^n kC(n,k)=n2^{n-1}\).
Count pairs \((S,x)\), where \(S\) is a subset of an \(n\)-element set and \(x\in S\). By size \(S=k\), we get the left side. By the element \(x\), choose \(x\) in \(n\) ways and choose the remaining elements of \(S\) freely from \(n-1\), giving \(n2^{n-1}\).
Comment. The identity became a problem about pairs.
Example 6. Pairs of Subsets
Each element may be outside both sets, only in the larger set, or in both.
Problem. How many pairs \((A,B)\) of subsets of an \(n\)-element set satisfy \(A\subset B\)?
For each element there are three possibilities: outside \(B\), in \(B\) but not in \(A\), or in both \(A\) and \(B\). Hence there are \(3^n\) pairs.
Comment. This is also a double viewpoint: by elements instead of by sets.
Example 7. Point-Line Incidences
The same table “point lies on line” is counted by rows or columns.
Problem. There are \(9\) lines, each containing \(5\) marked points. Each marked point lies on exactly \(3\) lines. How many marked points are there?
Count incidences \((point,line)\). By lines there are \(9\cdot5=45\). By points there are \(3N\), where \(N\) is the number of points. Thus \(3N=45\), so \(N=15\).
Comment. Classic incidence-counting problem.
Example 8. Bounding by Pairs
If each triple contains \(3\) pairs, we can bound the number of triples.
Problem. There are three-element subsets of a \(10\)-element set, and no pair of elements occurs in two different subsets. Prove that there are at most \(15\) such subsets.
Each three-element subset contains \(3\) pairs of elements. There are \(45\) pairs total in a \(10\)-element set. Since pairs do not repeat, \(3m\le45\), where \(m\) is the number of subsets. Hence \(m\le15\).
Comment. This is already an olympiad-style double-counting bound.
Chapter
Pigeonhole Principle I
Key Idea
The pigeonhole principle says: if there are more objects than boxes, then some box contains at least two objects. The strengthened form says: if \(N\) objects are distributed among \(k\) boxes, some box contains at least \(\lceil N/k ceil\) objects.
The olympiad part is choosing the right “boxes”. They may be months, residues, sums, intervals, colors, odd parts of numbers, small regions in a geometric partition, or pairs of parameters.
Basic Facts
- If \(k+1\) objects lie in \(k\) boxes, two objects lie in the same box.
- If \(N\) objects lie in \(k\) boxes, some box contains at least \(\lceil N/k ceil\) objects.
- Residues modulo \(n\) give \(n\) boxes.
- For problems where a sum must be divisible by \(n\), partial sums are often useful.
- In geometry, the boxes are often small regions into which a large figure is partitioned.
When to Use This Method
- You need to prove that among many objects, two share a property.
- There are residues, months, colors, intervals, parity classes, or other finite categories.
- You need to prove existence of a pair with small distance or a special sum.
- The statement says “for every choice of sufficiently many objects”.
How to Recognise the Method
Ask: which property can take only a small number of values? If there are more objects than possible values, two objects share that value. For divisibility, boxes are often residues. For closeness, boxes are intervals or small cells.
If subset sums appear, consider partial sums or all subset sums and compare the number of sums with the number of possible values.
Typical Mistakes
- Choosing boxes without proving there are fewer boxes than objects.
- Finding two objects in the same box but not explaining why this gives the required property.
- Forgetting residue \(0\) in modular problems.
- In geometric problems, using regions with diameter too large.
- In subset-sum problems, forgetting to remove common elements from two equal-sum subsets.
Mini-Checklist
- What are the objects?
- What are the boxes?
- How many objects and how many boxes are there?
- What does it mean for two objects to be in the same box?
- Do we need the simple or strengthened form?
- If sums are used, can equal sums be turned into nonempty disjoint sets?
Example 1. Birth Months
The simplest box model.
Problem. Prove that among \(13\) people, two were born in the same month.
The boxes are the \(12\) months. The objects are the \(13\) people. Since there are more objects than boxes, some month contains at least two people.
Comment. It is important to name the boxes explicitly.
Example 2. Residues
Residues modulo a number give ready-made boxes.
Problem. Prove that among any \(n+1\) integers, two have the same residue modulo \(n\).
There are \(n\) possible residues: \(0,1,\ldots,n-1\). There are \(n+1\) numbers, so two fall into the same residue class.
Comment. Their difference is divisible by \(n\).
Example 3. Strengthened Principle
Sometimes we need many objects in one box, not just two.
Problem. A box contains \(25\) balls of three colors. Prove that some color occurs at least \(9\) times.
If every color occurred at most \(8\) times, there would be at most \(3\cdot8=24\) balls, contradiction. Hence some color occurs at least \(9\) times.
Comment. This is the form \(\lceil25/3 ceil=9\).
Example 4. Sum \(11\)
Boxes can be pairs of numbers.
Problem. From the numbers \(1,2,\ldots,10\), \(6\) are chosen. Prove that two chosen numbers have sum \(11\).
Split the numbers into pairs \((1,10),(2,9),(3,8),(4,7),(5,6)\). There are \(5\) pair-boxes and \(6\) chosen numbers. One pair contains both chosen numbers, whose sum is \(11\).
Comment. These boxes are specially designed, not residues.
Example 5. One Number Divides Another
The boxes are odd parts of numbers.
Problem. Prove that among any \(10\) numbers from \(1,\ldots,18\), two are such that one divides the other.
Write each number as \(2^k m\), where \(m\) is odd. The possible odd parts in \(1,\ldots,18\) are \(1,3,5,7,9,11,13,15,17\), only \(9\) boxes. Among \(10\) numbers, two have the same odd part. They differ only by a power of \(2\), so the smaller divides the larger.
Comment. This is an important non-obvious choice of boxes.
Example 6. Geometric Box
Partitioning a figure controls distance.
Problem. In a square of side \(2\), \(5\) points are chosen. Prove that two of them are at distance at most \(\sqrt{2}\).
Divide the square into \(4\) unit squares. By the pigeonhole principle, two points lie in one small square. The diagonal of a unit square is \(\sqrt{2}\), so the distance between these two points is at most \(\sqrt{2}\).
Comment. The diameter of each box must not exceed the required distance.
Example 7. Partial Sums
A consecutive block sum appears from equal residues.
Problem. Prove that among \(n\) integers, there is a nonempty consecutive block whose sum is divisible by \(n\).
Consider partial sums \(s_1,\ldots,s_n\). If one is divisible by \(n\), we are done. Otherwise the \(n\) sums have only \(n-1\) nonzero residues, so two have the same residue. Their difference is the sum of a consecutive block and is divisible by \(n\).
Comment. This is one of the main templates of the module.
Example 8. Monotone Subsequence
A sophisticated box can be a pair of numbers.
Problem. Prove that among \(10\) distinct numbers, there is an increasing subsequence of length \(4\) or a decreasing subsequence of length \(4\).
For each number, record the pair \((a,b)\): the length of the longest increasing subsequence starting there and the length of the longest decreasing subsequence starting there. If neither type has length \(4\), then \(a,b\in\{1,2,3\}\), only \(9\) pairs. But there are \(10\) numbers. Two positions would have the same pair; for the earlier and later position this is impossible, because if the earlier number is smaller, its increasing length is larger, and if it is larger, its decreasing length is larger.
Comment. This is a strong example of the pigeonhole principle.
Chapter
Invariants I
Key Idea
An invariant is a quantity or property that does not change under the allowed operations. If the initial and final states have different invariant values, then the transition is impossible.
In olympiad problems, the invariant is often hidden. Look among parity, sum, residue modulo a number, coloring, product of signs, number of objects of a certain color, or permutation parity.
Basic Facts
- If an operation changes a quantity by an even number, its parity is preserved.
- If an operation adds to one part and subtracts from another, the sum is often preserved.
- If an operation changes a quantity by a multiple of \(m\), the residue modulo \(m\) is preserved.
- For board colorings, track how many cells of each color a tile covers or a move changes.
- For sign changes, the product of all signs or the parity of the number of minus signs is often useful.
When to Use This Method
- You need to prove that one state cannot be obtained from another.
- There is a repeated operation changing a configuration.
- The problem contains tokens, coins, lamps, signs, board cells, or permutations.
- Direct search over moves is impossible or quickly becomes chaotic.
How to Recognise the Method
Ask: what does the operation definitely not change? If a number of objects changes, check parity. If objects are moved, check the sum. If the operation is local on a board, color the board. If signs change, check the product or number of minus signs.
Sometimes the invariant is not the quantity itself, but its residue. For example, a sum may change, but always by a multiple of \(3\), so the sum modulo \(3\) is preserved.
Typical Mistakes
- Showing a quantity does not change in some moves, but not checking all possible moves.
- Choosing a quantity that is almost preserved but breaks under one type of move.
- Proving impossibility without comparing initial and final invariant values.
- Using a board coloring without checking the colors covered by the tile.
- Forgetting that an invariant may be composite, such as “inversion parity plus number of moves”.
Mini-Checklist
- What is the initial state?
- What final state is required?
- What does one move change?
- Which quantity is preserved by every move?
- Do the initial and final invariant values differ?
- If one invariant fails, should we try a modulus, coloring, or product?
Example 1. Parity
The most common invariant is parity.
Problem. The number \(0\) is written on a board. In one move, one may add \(2\) or subtract \(2\). Can \(101\) be obtained?
The parity of the number does not change: an even number is added or subtracted. Initially \(0\) is even, while \(101\) is odd. Therefore \(101\) cannot be obtained.
Comment. Invariant: residue modulo \(2\).
Example 2. Flipping Two Coins
The number of heads changes by an even number.
Problem. There are \(15\) coins heads up. In one move, exactly two coins are flipped. Can all coins become tails up?
The number of heads changes by \(-2\), \(0\), or \(2\). Therefore its parity is preserved. Initially there are \(15\) heads, odd; in the final state there would be \(0\), even. Impossible.
Comment. It does not matter which coins are flipped.
Example 3. Sum Is Preserved
The operation moves one unit from one place to another.
Problem. There are two piles with \(7\) and \(11\) stones. In one move, one stone may be moved from one pile to the other. Can the piles become \(5\) and \(20\)?
The total number of stones is preserved. Initially it is \(18\), while \(5\) and \(20\) total \(25\). Therefore it is impossible.
Comment. An invariant may be very simple.
Example 4. Residue Modulo a Number
The sum may change, but the residue is preserved.
Problem. A sum is written on the board. In one move, one may add \(6\) or subtract \(9\). If the initial sum is \(2\), can \(100\) be obtained?
Both changes are divisible by \(3\), so the sum modulo \(3\) is preserved. Initially it is \(2\pmod3\), while \(100\equiv1\pmod3\). Therefore \(100\) cannot be obtained.
Comment. Invariant: sum modulo \(3\).
Example 5. Board Coloring
A domino covers one black and one white cell.
Problem. Can an \(8\) by \(8\) board be tiled by dominoes if two opposite corner cells are removed?
In chessboard coloring, opposite corners have the same color. Removing them leaves two fewer cells of one color than the other. Each domino covers one black and one white cell, so tiling is impossible.
Comment. This is the main coloring-invariant example.
Example 6. Product of Signs
Changing two signs preserves the product.
Problem. There are \(9\) plus signs on the board. In one move, exactly two signs may be changed. Can we obtain exactly one minus sign?
The product of all signs does not change when two signs are changed: it is multiplied by \((-1)^2=1\). Initially the product is \(+1\), while with one minus it is \(-1\). Impossible.
Comment. One may also track the parity of the number of minus signs.
Example 7. Color of a Knight's Square
Some moves necessarily change color.
Problem. A knight stands on a black square of a chessboard. Can it be on a black square after \(7\) moves?
A knight move always changes the color of the square. After an odd number of moves, the color is opposite to the initial one. After \(7\) moves, the knight is on a white square, so it cannot be on black.
Comment. Invariant: color plus parity of the number of moves.
Example 8. Inversions and Number of Moves
Sometimes the preserved quantity is the sum of two parities.
Problem. Starting from \(12345678\), we want to obtain \(87654321\) by adjacent swaps in exactly \(27\) moves. Is it possible?
One adjacent swap changes the parity of the number of inversions. Initially there are \(0\) inversions. The reversed string has \(C(8,2)=28\) inversions, again even. After \(27\) swaps, inversion parity would be odd, contradiction. Impossible.
Comment. Invariant: inversion parity matches the parity of the number of adjacent swaps made.
Chapter
Coloring and Board Problems
Key Idea
A coloring turns a board picture into a counting problem. If every tile covers colors in a fixed ratio, then the whole tiled region must have the same ratio.
The main skill is to choose a useful coloring, not a pretty one. Dominoes often need the usual chessboard coloring. Straight trominoes and tetrominoes are handled by diagonal colorings modulo \(3\) and \(4\). For knight moves, remember that a knight changes square color at every move.
Basic Facts
- A \(1\times2\) domino on a chessboard covers one black and one white cell.
- A straight \(1\times3\) tromino, under the coloring of cell \((i,j)\) by \(i+j\pmod3\), covers one cell of each of the three colors.
- A straight \(1\times4\) tetromino, under the coloring of cell \((i,j)\) by \(i+j\pmod4\), covers one cell of each of the four colors.
- With vertical stripe coloring, a horizontal domino covers two colors, while a vertical domino covers two cells of one color.
- A knight move changes the color of the square in the usual chessboard coloring.
When to Use This Method
- You need to prove that a board cannot be tiled by given pieces.
- The area divisibility check passes, but the tiling still looks impossible.
- Special cells are removed: corners, a diagonal, the center, or cells of one color.
- There is a condition on the number of vertical or horizontal pieces.
- A piece moves on a board, and its possible position after a given number of moves matters.
How to Recognise the Method
First check area. If area gives no contradiction, try chessboard coloring. If the pieces are long, use coloring modulo their length. If directions matter, color rows or columns in stripes.
A good test is to count how many cells of each color one tile covers. If this number is fixed for every tile, the whole region must have the same color ratio.
Typical Mistakes
- Stopping after the area check and not checking a coloring.
- Using chessboard coloring when a modulo \(3\) or modulo \(4\) coloring is needed.
- Forgetting that a piece may be rotated.
- Counting colors on the full board but forgetting to subtract removed cells.
- Proving a necessary condition and accidentally treating it as sufficient.
Mini-Checklist
- What is the area of the region and of one tile?
- What does one tile cover in chessboard coloring?
- If the tile has length \(3\) or \(4\), what does \(i+j\pmod3\) or \(i+j\pmod4\) give?
- What colors are the removed cells?
- Do the required color counts match?
- If the problem is about a moving piece, how does color change after one move?
Example 1. Dominoes and Two Corners
The basic example shows why area alone is not enough.
Problem. Can an \(8\times8\) board be tiled by dominoes if two opposite corner cells are removed?
In chessboard coloring, opposite corners have the same color. After removing these two cells, one color has two fewer cells than the other. Each domino covers one black and one white cell. Therefore the remaining board cannot be tiled by dominoes.
Comment. Invariant: the difference between the numbers of black and white cells.
Example 2. An Odd Board
Sometimes coloring immediately determines which cell must remain free.
Problem. A \(7\times7\) board is covered by dominoes so that exactly one cell is left uncovered. What color is this cell in chessboard coloring?
On a \(7\times7\) board, one color has \(25\) cells and the other has \(24\). Each domino covers one cell of each color. Thus \(24\) dominoes cover \(24\) cells of each color, and the remaining cell has the color that appeared \(25\) times.
Comment. On an odd board, the majority color is the color of the corners.
Example 3. Diagonal Coloring Modulo \(3\)
A straight tromino needs a three-coloring, not the usual chessboard coloring.
Problem. Can a \(5\times5\) board with the corner cell \((1,1)\) removed be tiled by straight \(1\times3\) trominoes?
Color cell \((i,j)\) by the residue of \(i+j\pmod3\). Any straight tromino, horizontal or vertical, covers one cell of each color. On a \(5\times5\) board the color counts are \(9,8,8\). The corner \((1,1)\) has color \(2\), so after removing it the counts become \(9,8,7\). They are not equal, so no tiling exists.
Comment. For straight pieces of length \(3\), diagonal coloring is stronger than chessboard coloring.
Example 4. Stripes and Domino Direction
A coloring may track not only the shape but also the direction of pieces.
Problem. Can a \(6\times6\) board be tiled by dominoes so that exactly \(5\) dominoes are vertical?
Color the columns alternately black and white. A horizontal domino covers one black-column cell and one white-column cell. A vertical domino covers two cells of the same column color. The full board has equal numbers of the two column colors. Hence vertical dominoes must contribute equal numbers of cells of the two colors, so the number of vertical dominoes in black columns must equal the number in white columns. But there are \(5\) vertical dominoes, and an odd number cannot be split equally. Impossible.
Comment. This idea often appears when the number of horizontal or vertical tiles is restricted.
Example 5. A Knight Move
Coloring works for movement problems as well as tiling problems.
Problem. A knight stands on a black square of a chessboard. Can it return to a black square after \(9\) moves?
Every knight move changes the color of the square. After an odd number of moves, the color is opposite to the initial one. Since \(9\) is odd, the knight is on a white square, not on a black one.
Comment. Here the preserved relation is between color and the parity of the number of moves.
Example 6. Four-Coloring
Straight tetrominoes require coloring modulo \(4\).
Problem. Can an \(8\times8\) board with its four corners removed be tiled by straight \(1\times4\) tetrominoes?
Color cell \((i,j)\) by the residue of \(i+j\pmod4\). Any straight tetromino covers one cell of each of the four colors. On the full \(8\times8\) board, each color appears \(16\) times. The four corners have colors \(2,1,1,0\), so after removing them the four color counts are not equal. Therefore such a tiling is impossible.
Comment. The usual chessboard coloring gives no contradiction here: two black and two white cells are removed.
Example 7. One Monomino Among Trominoes
Sometimes coloring does not only forbid; it tells where the exceptional cell must be.
Problem. An \(8\times8\) board is to be covered by \(21\) straight \(1\times3\) trominoes and one single cell. Prove that the single cell must have color \(0\) under the coloring \((i,j)\mapsto i+j\pmod3\).
Under this coloring, every straight tromino covers one cell of each color. Therefore \(21\) trominoes cover \(21\) cells of each color. On an \(8\times8\) board, the counts of colors \(0,1,2\) are \(22,21,21\). The single cell must be the extra cell of color \(0\).
Comment. This is a necessary condition. It does not automatically prove that such a tiling exists.
Example 8. When Two Colorings Have Different Strength
A stronger problem often requires replacing the usual chessboard coloring.
Problem. All cells on both diagonals of a \(10\times10\) board are removed. Can the remaining region be tiled by straight \(1\times4\) tetrominoes?
The area is \(100-20=80\), divisible by \(4\). Chessboard coloring also gives no contradiction: one diagonal consists of cells of one color and the other diagonal of cells of the other color. Now color cell \((i,j)\) by \(i+j\pmod4\). A straight tetromino covers one cell of each of the four colors. On the full \(10\times10\) board, colors \(0,1,2,3\) occur \(25,24,25,26\) times. The main diagonal removes \(5\) cells of color \(0\) and \(5\) of color \(2\); the other diagonal removes \(10\) cells of color \(3\). After removal, the color counts cannot become equal. Hence no tiling exists.
Comment. The point is: if a simple coloring is silent, change the coloring.
Chapter
Games and Strategies I
Key Idea
In complete-information games, we usually look not for one lucky move, but for classes of positions: winning positions, from which there is a move to a losing position, and losing positions, from which every legal move goes to a winning position.
At the first level, four tools are enough: residues in stone games, symmetry strategy, pairing strategy, and backward analysis from the end of the game.
Basic Facts
- If a position has a move to a losing position, then it is winning.
- If every legal move goes to a winning position, then it is losing.
- In the game “take from \(1\) to \(k\) stones, last move wins”, the losing positions are multiples of \(k+1\).
- In the game “add from \(1\) to \(k\), whoever reaches the target wins”, one often keeps totals separated by \(k+1\).
- Symmetry works when after the opponent’s move, the reflected move is always legal.
When to Use This Method
- You need to determine who wins with perfect play.
- The game repeats similar moves with piles, numbers, or board cells.
- There are natural pairs of objects: numbers with a fixed sum, symmetric cells, or equal piles.
- The end of the game is clear, but the beginning looks complicated. Then analyze backward from losing terminal positions.
How to Recognise the Method
If the game has one pile, check residues. If two players choose objects from a symmetric set, look for a pairing strategy. If a board has a center or an axis of symmetry, try a mirror response. If the rules are unusual, list the last few positions and label them winning or losing.
Typical Mistakes
- Showing a good first move without explaining how to respond later.
- Calling a position losing without checking all legal moves from it.
- Using symmetry without proving that the reflected move is unoccupied and legal.
- Confusing the normal game with the variant where taking the last stone loses.
- In target-number games, forgetting to check the first move and the final target.
Mini-Checklist
- What are the terminal positions?
- Who wins or loses in a terminal position?
- Can positions be classified by residues?
- Is there a symmetry or pairing that can be maintained?
- After any opponent move, is there a predetermined response?
- Is the strategy proven until the end, not only for the first move?
Example 1. One Pile and Residues
The most important first template: leave a multiple to the opponent.
Problem. There are \(20\) stones in a pile. In one move, a player may take \(1\), \(2\), or \(3\) stones. Whoever takes the last stone wins. Who wins?
The losing positions are \(0,4,8,12,16,20\), the multiples of \(4\). From a multiple of \(4\), every move leaves a non-multiple of \(4\), while from any non-multiple one can take \(1\), \(2\), or \(3\) stones and leave a multiple of \(4\). Since \(20\) is a multiple of \(4\), the first player is in a losing position; the second wins by always making the two moves together remove \(4\) stones.
Comment. It is important to prove the whole strategy, not only the first answer.
Example 2. Taking the Last Stone Loses
A small rule change changes the losing residues.
Problem. There are \(28\) stones. In one move, a player may take from \(1\) to \(3\) stones. The player who takes the last stone loses. Who wins?
With this rule, positions \(1,5,9,13,17,21,25\) are losing: if one stone remains, the player must take the last stone and lose; then the step size is \(4\). From \(28\), the first player takes \(3\) stones and leaves \(25\), a losing position. Then the first player always complements the opponent’s move to \(4\). At the end, the opponent is left with \(1\) stone.
Comment. Always check who wins on the last move.
Example 3. Reaching a Number
Here the goal is not to leave zero, but to control the running total.
Problem. Players alternately add a number from \(1\) to \(6\) to the current total. The initial total is \(0\). Whoever first obtains \(50\) wins. Who wins?
Since \(50\equiv1\pmod7\), the first player first adds \(1\). After each opponent move of \(a\), where \(1\le a\le6\), the first player adds \(7-a\). Then after the first player’s turns, the totals are \(1,8,15,\ldots,50\). Thus the first player reaches \(50\) and wins.
Comment. This is the same complement idea, applied to sums.
Example 4. Two Equal Piles
A pairing strategy often means: copy the opponent’s move in the symmetric part.
Problem. There are two piles of \(13\) stones. In one move, a player may take any positive number of stones from one pile. Whoever takes the last stone wins. Prove that the second player wins.
After every first-player move, the second player takes the same number of stones from the other pile. This restores equality. If the first player could move, then one pile had stones, so the second player’s symmetric response is legal. The last move will also be made by the second player.
Comment. Positions with two equal piles are losing for the player to move.
Example 5. Symmetry on a Board
A symmetric response can be a complete strategy.
Problem. Players alternately place tokens on empty cells of a \(5\times5\) board. A player who cannot move loses. Who wins?
The first player places a token in the center cell. After that, whenever the second player chooses a cell, the first player chooses the centrally symmetric cell. That cell is unoccupied: if it had been occupied earlier, then its symmetric partner would also have been occupied. Therefore the first player always has a response and makes the last move.
Comment. One must check separately that the reflected cell is free.
Example 6. Pairing
Pairing strategy works even without geometry.
Problem. Players alternately choose one number from \(1,2,\ldots,20\). After all numbers are chosen, they compare sums; the larger sum wins. Prove that the second player can avoid losing.
The second player pairs the numbers in advance by sum \(21\): \((1,20),(2,19),\ldots,(10,11)\). Whatever number the first player chooses, the second chooses its partner. From each pair the players get one number each, so their total sums are equal. The second guarantees a draw, so does not lose.
Comment. The pairs must cover all objects without overlap.
Example 7. Rooks on a Board
Sometimes the number of moves is fixed in advance.
Problem. Players alternately place rooks on a \(7\times7\) board so that no two rooks attack each other. A player who cannot move loses. Who wins?
After \(k\) moves, \(k\) rows and \(k\) columns are occupied. As long as \(k<7\), there is a free row and a free column, so another rook can be placed. Therefore the game always lasts exactly \(7\) moves. The seventh move is made by the first player, so the first player wins.
Comment. This is not a choice strategy, but a proof of fixed game length.
Example 8. Three Piles and Nim-Sum
A stronger preview shows where the method will develop later.
Problem. There are piles of \(3\), \(4\), and \(5\) stones. In one move, a player may take any positive number of stones from one pile. Whoever takes the last stone wins. Find a winning move.
Use bitwise addition without carrying: \(3\oplus4\oplus5=2\). We need to reduce one pile so that the nim-sum becomes \(0\). Reduce the pile \(3\) to \(1\), because \(1\oplus4\oplus5=0\). After that, every opponent move can be answered by restoring nim-sum \(0\). Thus the winning first move is \(3\to1\).
Comment. This is only an introductory version of the nim method, but it is useful for strong problems.
Chapter
Graphs I
Key Idea
A graph replaces relations between objects by vertices and edges. People and acquaintances, cities and roads, teams and games, cells and legal moves often become the same kind of structure.
The first main graph tool is the degree-sum formula: every edge has two ends, so \(\sum \deg(v)=2E\). From this simple formula come the parity of odd degrees, average arguments, and many impossibility proofs.
Basic Facts
- The degree of a vertex is the number of edges incident to it.
- In every finite undirected graph, \(\sum \deg(v)=2E\).
- The number of vertices of odd degree is always even.
- The complete graph on \(n\) vertices has \(\binom{n}{2}\) edges.
- A connected graph on \(n\) vertices has at least \(n-1\) edges; a tree has exactly \(n-1\) edges.
- A bipartite graph has no odd cycle.
When to Use This Method
- The problem contains pairs of objects: acquaintances, roads, games played, or possible transitions.
- You need to prove that a system of relations is impossible.
- Degrees or numbers of connections are given, and you need to find edges or a contradiction.
- You need to prove the existence of a vertex with large or small degree.
- There is a restriction on triangles, cycles, or connections inside two groups.
How to Recognise the Method
Ask: what are the vertices, and what are the edges? If the relation is mutual, use an undirected graph. If the relation is directed, it may be a tournament or directed graph, but often it is enough to count in-degrees and out-degrees.
If the statement contains words like “each”, “exactly”, “at least”, “is acquainted with”, or “is connected to”, it is almost always useful to write down degrees and use the degree-sum formula.
Typical Mistakes
- Counting each edge once in the degree sum, although it contributes \(2\).
- Confusing the number of edges of a complete graph with \(n^2\) instead of \(\binom{n}{2}\).
- Proving connectedness without excluding several components.
- Using tree properties for graphs that may contain cycles.
- In acquaintance problems, forgetting that acquaintance is usually mutual.
Mini-Checklist
- What are the vertices?
- What are the edges?
- Which degrees are known or bounded?
- What does \(\sum \deg(v)=2E\) give?
- Do we need connectedness, a tree, a cycle, or bipartiteness?
- Can we use an average argument: some vertex has degree at least or at most the average?
Example 1. Degree Sum
The first action in a graph is to count degrees.
Problem. A graph has vertex degrees \(2,3,3,4,4\). How many edges does it have?
The sum of degrees is \(2+3+3+4+4=16\). Each edge contributes \(2\) to the degree sum, so the number of edges is \(16/2=8\).
Comment. If the degree sum is odd, such a graph does not exist.
Example 2. Odd Degrees
Parity often gives a quick contradiction.
Problem. Can a graph have exactly \(5\) vertices of odd degree?
No. The sum of all degrees is \(2E\), hence even. The sum of even degrees is even, so the sum of odd degrees must also be even. But the sum of \(5\) odd numbers is odd. Contradiction.
Comment. Therefore, the number of vertices of odd degree is always even.
Example 3. Complete Graph
A complete graph appears when every pair of objects is connected.
Problem. How many edges are there in the complete graph on \(9\) vertices?
Each edge is determined by a pair of vertices. Therefore the number of edges is \(\binom{9}{2}=36\).
Comment. Do not count ordered pairs: edge \(AB\) and \(BA\) are the same edge.
Example 4. Acquaintances
The graph model removes unnecessary wording.
Problem. In a group of \(8\) people, each person knows exactly \(3\) others. How many acquaintance pairs are there?
Build a graph: vertices are people, edges are acquaintance pairs. The degree sum is \(8\cdot3=24\). Each acquaintance pair is counted twice, so there are \(24/2=12\) pairs.
Comment. Mutual acquaintance matters: this is an undirected graph.
Example 5. Connected Graph
Connectedness requires at least \(n-1\) edges.
Problem. Prove that a connected graph on \(n\) vertices has at least \(n-1\) edges.
Start with one vertex and add the remaining vertices one by one along paths from the already added part. For a new vertex to be connected to the previous part, at least one new edge is needed. Adding \(n-1\) vertices requires at least \(n-1\) edges.
Comment. Equality is achieved by trees.
Example 6. A Tree Has Leaves
A tree always has vertices of degree \(1\).
Problem. Prove that a tree with at least two vertices has at least two leaves.
Take a longest simple path in the tree. If one endpoint had degree greater than \(1\), an edge would go from it to a vertex outside the path; otherwise there would be a cycle or the path could be extended. This contradicts maximality. Hence both endpoints have degree \(1\).
Comment. The longest-path argument appears very often.
Example 7. Bipartiteness
Bipartite graphs are recognized by the absence of odd cycles.
Problem. Prove that a bipartite graph has no cycle of odd length.
Let the vertices be split into two parts, with every edge going between the parts. While moving along a cycle, the parts alternate. To return to the starting part, one must make an even number of steps. Thus every cycle has even length.
Comment. This is the same alternation principle as in chessboard coloring.
Example 8. A Small Ramsey Statement
Graphs help prove statements about acquaintances and strangers.
Problem. Prove that among any \(6\) people, there are either \(3\) mutual acquaintances or \(3\) mutual strangers.
Choose one person \(A\). Among the other \(5\), person \(A\) either knows at least \(3\) or does not know at least \(3\). Suppose, for instance, that \(A\) knows \(B,C,D\). If among \(B,C,D\) there is an acquaintance pair, then together with \(A\) we get \(3\) mutual acquaintances. If there is no acquaintance pair among them, then \(B,C,D\) are mutual strangers. The case of three strangers of \(A\) is analogous.
Comment. This is a strong example, but the proof structure is short.
Chapter
Recursion and Sequences
Key Idea
Recursion appears when an object can be built from a smaller object by its last step. Instead of counting the large case at once, define \(a_n\) as the number of ways for size \(n\), then express \(a_n\) through previous values.
In olympiad problems, the point is not to guess a sequence, but to justify the split: by the last step, last tile, last symbol, last column, or last point of a path.
Basic Facts
- If the last step has length \(1\) or \(2\), the recurrence \(a_n=a_{n-1}+a_{n-2}\) often appears.
- Tilings of a \(2\times n\) strip by dominoes give the same Fibonacci recurrence.
- Binary strings with no adjacent ones are naturally split by the last symbol.
- Grid paths satisfy \(P(i,j)=P(i-1,j)+P(i,j-1)\), or can be counted by \(\binom{m+n}{m}\).
- If one state is not enough, introduce extra states, such as “a board with one missing corner on the right”.
When to Use This Method
- You need to count ways for a long string, strip, staircase, or path.
- An object of size \(n\) naturally ends in one of several types of last steps.
- Small cases are easy to list, and the general case resembles previous ones.
- Direct enumeration grows quickly, but the structure repeats.
How to Recognise the Method
Ask: what can the last step look like? If that last step is removed, what remains? If it is the same kind of problem, one recurrence may be enough. If several “almost the same” problems remain, use several states.
For strings, look at the last symbol or last two symbols. For tilings, look at the last column. For paths, look at where the path came from before the final point.
Typical Mistakes
- Writing a recurrence without initial conditions.
- Counting objects twice because the last-step cases overlap.
- Not checking small values \(n=0\), \(n=1\), although the recurrence needs them.
- Using a Fibonacci recurrence when there is a third type of last step.
- In path problems, confusing the number of steps with the number of grid points.
Mini-Checklist
- What does \(a_n\) mean?
- Which initial values are needed?
- By which final element do we split cases?
- Are the cases disjoint?
- Are all possibilities included?
- Do we need a second state?
Example 1. Stairs
The last step immediately gives a Fibonacci recurrence.
Problem. In how many ways can one climb \(7\) stairs if each move is \(1\) or \(2\) stairs?
Let \(a_n\) be the number of ways to climb \(n\) stairs. The last move was either \(1\) stair from \(n-1\), or \(2\) stairs from \(n-2\). Therefore \(a_n=a_{n-1}+a_{n-2}\). Initial values: \(a_0=1\), \(a_1=1\). Thus \(a_2=2\), \(a_3=3\), \(a_4=5\), \(a_5=8\), \(a_6=13\), \(a_7=21\).
Example 2. A \(2\times n\) Strip
Domino tilings have the same structure.
Problem. In how many ways can a \(2\times6\) board be tiled by dominoes?
Let \(a_n\) be the number of tilings of \(2\times n\). The last column is either covered by a vertical domino, leaving \(2\times(n-1)\), or the last two columns are covered by two horizontal dominoes, leaving \(2\times(n-2)\). Hence \(a_n=a_{n-1}+a_{n-2}\), with \(a_0=1\), \(a_1=1\). We get \(a_6=13\).
Example 3. Binary Strings
Strings are naturally split by the last symbol.
Problem. How many binary strings of length \(6\) contain no two adjacent ones?
Let \(a_n\) be the number of such strings of length \(n\). If the string ends in \(0\), before it there may be any valid string of length \(n-1\). If it ends in \(1\), the previous symbol must be \(0\), and before that there is a valid string of length \(n-2\). Hence \(a_n=a_{n-1}+a_{n-2}\). With \(a_0=1\), \(a_1=2\), we get \(a_6=21\).
Example 4. Grid Paths
The last step into a point comes from the left or from below.
Problem. How many shortest paths go from \((0,0)\) to \((4,3)\), if only right and up moves are allowed?
One must make \(4\) right moves and \(3\) up moves, \(7\) moves total. Choose the positions of the \(4\) right moves: \(\binom{7}{4}=35\).
Example 5. A Path Through a Point
Sometimes a path splits into two independent parts.
Problem. How many shortest paths from \((0,0)\) to \((5,4)\) pass through \((2,1)\)?
To reach \((2,1)\), one needs \(2\) right moves and \(1\) up move: \(\binom{3}{1}=3\) paths. From \((2,1)\) to \((5,4)\), one needs \(3\) right and \(3\) up moves: \(\binom{6}{3}=20\) paths. Total: \(3\cdot20=60\).
Example 6. Compositions
Splitting by the last summand gives a recurrence with three previous terms.
Problem. In how many ways can \(8\) be represented as a sum of \(1\), \(2\), and \(3\), if order matters?
Let \(a_n\) be the number of ways to get sum \(n\). The last summand is \(1\), \(2\), or \(3\), so \(a_n=a_{n-1}+a_{n-2}+a_{n-3}\). With \(a_0=1\), \(a_1=1\), \(a_2=2\), we get \(a_3=4\), \(a_4=7\), \(a_5=13\), \(a_6=24\), \(a_7=44\), \(a_8=81\).
Example 7. Forbidden Three Zeros
Sometimes one must look at the final block.
Problem. How many binary strings of length \(7\) contain no three consecutive zeros?
Let \(a_n\) be the number of such strings. A valid string ends in \(1\), \(01\), or \(001\), according to the final block of zeros before the last one; for string endings this gives the recurrence \(a_n=a_{n-1}+a_{n-2}+a_{n-3}\). Initial values: \(a_0=1\), \(a_1=2\), \(a_2=4\). Thus \(a_7=81\).
Example 8. An Extra State
For a harder tiling, one variable is no longer enough.
Problem. A \(2\times n\) board is tiled by dominoes and L-trominoes. Explain why a second state is useful.
Let \(A_n\) be the number of full tilings of \(2\times n\), and let \(B_n\) be the number of tilings of a \(2\times n\) board with one right corner cell removed. The last block may create or fill such a “gap”, giving recurrences \(B_n=A_{n-2}+B_{n-1}\), \(A_n=A_{n-1}+A_{n-2}+2B_{n-1}\). The second state is needed because after removing an L-tromino, what remains is often not a rectangle but an almost-rectangle.
Chapter
Mixed Problems I
Key Idea
In mixed problems, the method is not written in the statement. The student must recognize the structure: what should be counted, where cases are needed, where the boxes are, what is invariant, which coloring to choose, and whether the problem is a game, graph, or recurrence.
The main habit is to ask before computing: “what kind of object repeats here?” Repeated choices suggest counting. More objects than types suggests pigeonhole. Operations suggest invariants. Boards suggest coloring. Relations suggest graphs. Growing size suggests recursion.
Basic Facts
- The method is chosen by structure, not by keywords.
- First look for a simple invariant or simple count; a difficult method is not always needed.
- For existence, check averages, pigeonhole, or graph degrees.
- For impossibility, check parity, residues, coloring, or a sum.
- For counting a family of size \(n\), look for the last step and a recurrence.
When to Use This Method
- After several topics have been studied, when the statement no longer names the technique.
- Before a mock olympiad, where problems appear in arbitrary order.
- When the obvious first approach creates many chaotic cases.
How to Recognise the Method
Run a quick diagnosis: are we counting, proving existence, proving impossibility, or building a strategy? Is there a repeated operation? Is there a board? Is there a relation between pairs of objects? Can the last element be removed to get a smaller problem of the same kind?
If two methods seem possible, start with the coarser one: parity, residues, sum, or average. Often it immediately explains why the problem has its shape.
Typical Mistakes
- Recognizing a familiar topic and applying it mechanically without checking the conditions.
- Trying to count directly when a coloring or invariant is needed.
- In existence problems, forgetting to define the boxes or the average.
- In games, giving a first move but not the continuing strategy.
- In recurrences, not proving that the last-step cases are disjoint.
Mini-Checklist
- What is required: find a number, prove existence, prove impossibility, or build a strategy?
- Which objects repeat?
- Are there natural boxes, colors, degrees, or residues?
- Can the problem be reduced to a smaller size?
- Have edge cases been checked?
- Does the solution explain the choice of method?
Example 1. Diagnose First
The word “pigeonhole” is absent, but residues hide it.
Problem. Prove that among any \(8\) integers, two have a difference divisible by \(7\).
Consider residues modulo \(7\). There are only \(7\) residues and \(8\) numbers. By the pigeonhole principle, two numbers have the same residue. Their difference is divisible by \(7\).
Comment. Method signal: more objects than types.
Example 2. Do Not Count All Tilings
A board almost always asks for coloring.
Problem. Can a \(6\times6\) board be tiled by dominoes if two cells on the main diagonal are removed?
All cells on the main diagonal have the same color in chessboard coloring. After removing two such cells, the two color counts are unequal. Each domino covers one cell of each color. Therefore tiling is impossible.
Comment. Method signal: board and dominoes.
Example 3. Operation Means Invariant
If a configuration changes by a repeated move, look for a preserved quantity.
Problem. There are \(11\) plus signs on a board. In one move, the signs of two symbols are changed. Can exactly one minus sign be obtained?
The product of all signs does not change when two signs are changed. Initially the product is \(+1\), while with one minus sign it is \(-1\). Therefore such a configuration cannot be obtained.
Comment. Method signal: allowed operation.
Example 4. Too Many Connections
In graph problems, degrees often give an average.
Problem. A graph has \(9\) vertices and \(23\) edges. Prove that some vertex has degree at least \(6\).
The degree sum is \(46\). The average degree is \(46/9>5\). If all degrees were at most \(5\), the sum would be at most \(45\). Hence some vertex has degree at least \(6\).
Comment. Method signal: connections between pairs of objects.
Example 5. A Game Without Search
In games, look for control positions.
Problem. There are \(41\) stones. In one move, a player takes from \(1\) to \(4\). The last move wins. Who wins?
Multiples of \(5\) are losing. Since \(41\equiv1\pmod5\), the first player takes \(1\) stone and leaves \(40\). Then the first player complements the opponent’s moves to \(5\). The first player wins.
Comment. Method signal: perfect play and repeated moves.
Example 6. Recursion by Last Step
If size changes, look for a smaller problem.
Problem. How many binary strings of length \(7\) contain no two adjacent ones?
Let \(a_n\) be the number of such strings. A string ends in \(0\) or \(01\), so \(a_n=a_{n-1}+a_{n-2}\). With \(a_0=1\), \(a_1=2\), we get \(a_7=34\).
Comment. Method signal: a family of objects of length \(n\).
Example 7. A Path with a Condition
Sometimes counting is easier by complement.
Problem. How many shortest paths from \((0,0)\) to \((4,4)\) do not pass through \((2,2)\)?
There are \(\binom{8}{4}=70\) paths total. Paths through \((2,2)\) number \(\binom{4}{2}\cdot\binom{4}{2}=36\). Therefore \(70-36=34\) paths avoid the point.
Comment. Method signal: paths and a forbidden point.
Example 8. Mixed Finale
Sometimes the method appears only after the first simplification.
Problem. In a group of \(10\) people, each person knows at least \(6\) others. Prove that there are three mutual acquaintances.
Choose a person \(A\). This person has at least \(6\) acquaintances. If among these acquaintances there is an acquaintance pair, then together with \(A\) we get three mutual acquaintances. If there is no acquaintance pair among them, then each of these \(6\) people knows \(A\) and can know only the three people outside this set and outside \(A\), so their degree is at most \(4\), contradicting the condition \(6\).
Comment. This is already an extremal graph move.
Chapter
Mock Olympiads I
Key Idea
A mock olympiad tests not one method, but method choice under time pressure. One set may contain counting, pigeonhole, invariants, games, graphs, and recurrences side by side.
The goal of this module is to train students to read a statement quickly, choose the first reasonable tool, and finish with a rigorous proof.
Basic Facts
- Problem 1 in a mini-set usually checks careful counting or a simple construction.
- Problem 2 often needs pigeonhole, coloring, or complement counting.
- Problem 3 trains invariants, games, or recurrences.
- Problem 4 requires combining ideas: graph, average, cycle, partial sums, or a strong coloring.
When to Use This Method
- When students have studied the basic methods and must solve without topic labels.
- Before a school, municipal, or internal selection round.
- When diagnosing gaps in counting, proof, strategy, or careful condition checking.
How to Recognise the Method
Start by classifying the goal: count, prove existence, prove impossibility, or find a strategy. Then identify the object: numbers, board, graph, sequence, or game. Finally choose the simplest tool that can plausibly work.
Typical Mistakes
- Spending too much time on brute force when an invariant is present.
- Giving an answer to a counting problem without explaining the cases.
- In existence problems, not naming pigeonhole, average, or a concrete construction.
- In graphs, forgetting that the degree sum is twice the number of edges.
- In games, not describing responses to all opponent moves.
Mini-Checklist
- What exactly must be proved or found?
- Which method looks cheapest?
- Is there a quick test: parity, residue, color, average?
- Can the solution be written in 5-8 lines?
- Are edge cases and the final conclusion checked?
Example 1. Counting Without Brute Force
The first problem in a mock set often depends on the right order of choice.
Problem. How many four-digit numbers with distinct digits can be formed from \(1,2,3,4,5\), if the number must be odd?
The last digit must be \(1\), \(3\), or \(5\): \(3\) choices. The other three positions are filled without repetition from the remaining \(4\) digits: \(4\cdot3\cdot2\). Total: \(3\cdot4\cdot3\cdot2=72\).
Example 2. Quick Pigeonhole
If there is one more object than types, the solution should be short.
Problem. Prove that among \(13\) people, two were born in the same month.
There are \(12\) months and \(13\) people. By the pigeonhole principle, two people fall into the same month.
Example 3. Invariant Instead of Search
Operations rarely require listing all states.
Problem. The number \(0\) is written on a board. In one move, one may add \(6\) or subtract \(9\). Can \(100\) be obtained?
Both changes are divisible by \(3\), so the residue modulo \(3\) is invariant. Initially the residue is \(0\), while \(100\equiv1\pmod3\). Thus \(100\) cannot be obtained.
Example 4. Coloring
Boards should be checked by color even after the area check.
Problem. Can an \(8\times8\) board with two opposite corners removed be tiled by dominoes?
Opposite corners have the same color. After removing them, the color counts are unequal, while every domino covers one black and one white cell. Therefore tiling is impossible.
Example 5. Game
In a game, the answer must include a strategy.
Problem. There are \(29\) stones. In one move, a player takes from \(1\) to \(4\). The last move wins. Who wins?
Since \(29\equiv4\pmod5\), the first player takes \(4\) and leaves \(25\). Then the first player complements each opponent move to \(5\). The first player wins.
Example 6. Graph
Relations between pairs almost always become a graph.
Problem. A graph has \(8\) vertices and \(17\) edges. Prove that some vertex has degree at least \(5\).
The degree sum is \(34\), so the average degree is \(34/8>4\). Therefore at least one vertex has degree at least \(5\).