Here is an interesting problem from the 2026 International Zhautykov Olympiad. It turned out to be a difficult problem, and no participant solved it completely during the competition. The solution presented here is somewhat computational, but I believe that the sequence of steps is well motivated.
Problem (IZHO 2026, p6). Find all real polynomials for which there exist pairwise distinct, non-constant polynomials with real coefficients and positive senior coefficients for which and
(N. Safaei, A. Golovanov)
Solution. We will prove that the only polynomials are , where is a real constant and . Observe that if satisfies the given conditions, then for any constant , the polynomial also satisfies them. So, we can assume that is monic. Let , where . We have
Thus,
Now, we proceed as if are real numbers, and and we vary keeping fixed. We prove that for large enough , takes distinct values when is small. Let us denote . Under this notation,
Consider the function
Further, we can write it as
where . Note that for which is in a small neighborhood of , we can write , where is a branch of the complex logarithm, analytic in a neighborhood of . Let
It easily follows
Therefore,
Since
we get
where are some constants. Suppose now . Let be the first integer number for which . Such does exist, because has another non-zero coefficient that is not the senior one.
Since , , from (2), we get
Due to the fact that is a non-zero real number with small integer part, from (1) we obtain
Here are constants (depending eventually on ) and . The last estimate holds for all where is sufficiently small constant not depending on , providing is small enough.
In case when , the estimate (4) shows that has the same sign in . Let us assume . We use the Taylor expansion (integral form) for at .
Let , where will be determined later. Using (3) and (4), we get
Taking into account these estimates, for sufficiently small we have
for all , when is large enough. This means that the sign of does not change when . Observe that
I have recently seen an interesting problem that made me review the Five color theorem. In this blog post we will present two different proofs of Five color theorem and see how the ideas behind them can help us with similar problems.
Let me first show you the problem. It was given in 2018 Saint Petersburg Lyceum 239 Math Olympiad, it was problem 8, senior league (see [1]).
Problem (239 MO, 2018, p8). Graph becomes planar when any vertex is removed. Prove that its vertices can be properly colored in five colors. (Using the four-color theorem without proof is not allowed!) (Proposed by D. Karpov)
These graphs are called critical nonplanar graphs. It seems that it should be a known property, but I haven’t been able to find it. Since a critical nonplanar graph is not far away from a planar graph, it’s logical to see how the same claim was proved for planar graphs and see if it could be modified in some way to cover this more general case. Here I present two well-known approaches with slightly different ideas. They are concise and can be used in other scenarios. The second proof is due to Paul Kainen, see [2]. His approach allowed him to generalize the five-color theorem somewhat, but the statement of the presented problem is not a direct application of the results obtained in [2].
The Five Color Theorem
First, what is a planar graph? It’s a graph which can be embedded in the plane so that its edges can be drawn without intersections (except at its vertices of course). We say that a graph can be (properly) colored in colors if its vertices can be colored in at most colors such that no two vertices of the same color are connected.
Theorem. (Five-color theorem)Any planar graph can be colored properly with 5 colors.
We know that a planar graph can be actually colored in 4 colors, the famous Four-color theorem, but its proof is computer aided and long. Whereas the Five color theorem has a nice short proof and in most of the applications it suffices to know only this theorem.
First Proof of the Five Color Theorem
We do it by induction. The small cases are trivial, so suppose we have proved it for any planar graph with less then vertices (). Let be a planar graph with vertices. The following claim has a standalone value, so we prove it saparately.
Claim. Any planar graph has a vertex with .
Proof. Assume on the contrary, . Then But, it’s well known that a planar graph of vertices has at most edges, contradiction.
Let . The idea is to delete the vertex . The resulting graph is planar with vertices, so by the induction hypothesis it can be colored in colors. Then we add back and somehow color it so that its color is different from any color of its neighbors.
If we can color in the missing color of its neighbors. Assume . Let be the neighbors of in If two vertices among are colored in the same color, we can again color in the missing color in the set of colors used in the coloring of Let us assume that each vertex is colored in distinct color, say, is colored in the color
Let be the induced graph on the vertices colored in and If and are in different connected components of then we can recolor the vertices of the connected component containing by swapping the colors and . In this way the vertex will be colored in the color and this will be a proper coloring. By the above argument, we can color the vertex in thus proper coloring
Figure 1
So, suppose that and are in the same connected component. This means that there is a path from to with vertices colored alternately in and – see Figure 1. By the same argument, there is a path from to with vertices colored alternately in and . But in this case these two paths will intersect and since is planar, they must intersect in a vertex which on one hand should be colored in or and on the other hand — in or , contradiction. Therefore, this case is impossible.
Can we use a similar idea to the initial problem? Maybe, but I tried it and it became too complicated. So, apparently a fresh idea is needed! What follows is another proof of the Five color theorem. Let’s see if this is of any help.
Second proof of the Five color theorem
We use again induction on the number of vertices. It was established that in a planar graph with vertices, there is a vertex with degree at most We delete and let be the resulting graph. It has vertices and it is a planar graph. So, it can be colored in colors. If we color in a color different from the color of its neighbors and we are done. Suppose has five neighbors
It is not possible that all the vertices be connected with each other, because would contain a complete graph with vertices, which is impossible. Thus, two of the vertices, say, and are not connected. In we contract and This means that we glue together and into one vertex and if there are double edges incident with that vertex then we delete one of them. Let be the resulting graph. It has vertices ( was deleted and and are glued together). It is easy to see that is still planar, because is planar and roughly speaking and are on the same face. Further we color in colors and after that we reconstruct back to preserving the same colors. Note that is properly colored. Moreover, and are in the same color! That’s the reason why is properly colored — because and are not connected. That was the trick – we colored but and are colored in the same color. Now, we can color properly $G$ itself by coloring in a color different from the colors of its neighbors (they are colored in at most four distinct colors). So, the induction step is completed.
Having in mind this idea, we can adapt it to our initial problem. The details follow.
Back to the original problem.
Using the ideas from the second proof, we will prove the claim by induction on . It is trivial in case (the smallest possible critical nonplanar graph is the complete graph of 5 vertices). Suppose it’s proved for and is a graph with the given property with .
Outline: First, we prove that there is a vertex with . If we are done, so assume . There exist two neighbors of which are not connected (otherwise would be subgraph of , but it’s not critical nonplanar graph). We contract and into a vertex and prove that the new graph is either planar or critical nonplanar. So, it can be colored in colors. Next, we recover the old graph and use the same colors, that is, and will be colored in the color of . Hence all the neighbors of are colored in a set of colors, which allows us to color properly and complete the induction step. Here are the details.
Lemma 1. There exists a vertex with .
Proof. Let be a vertex with minimum degree. We have . Indeed, assume . After removing we obtain a planar graph with all the vertices of degree at least except of them of degree at least . Denoting the number of vertices in as , we have
This is contradiction since the maximum number of edges in any planar graph of vertices is at most .
So, we proved that there exists a vertex with . If we are done, since the set of colors of the neighbors of consists of at most colors, so we can color properly. Assume .
Lemma 2. Suppose is a critical nonplanar graph. Let but Let be the graph obtained from by first deleting and then contracting and into a new vertex . Then is either planar or a critical nonplanar graph.
Remark. Contracting and into a vertex means that we delete and , then add a new vertex and connect to all the vertices that and were connected to.
Proof. If we delete from then the resulting graph can be obtained from by removing and , so it will be a planar graph. Let . Assume that the vertex is deleted. The resulting graph can be obtained from by the following operations:
1) removing the vertex – as a result we obtain a planar graph. 2) removing all the edges incident with except the edges and 3) contracting the edge into a single vertex. 4) contracting the edge into a vertex.
Starting from a planar graph and contracting an edge into a single vertex, the graph remains planar. Thus, the resulting graph will be planar after the fourth step.
Back on the original problem. There exist two neighbors, say, of which are not connected (otherwise would be subgraph of , but it’s not a critical nonplanar graph). We apply Claim 1 by contracting and into a vertex The resulting graph is either planar or critical nonplanar. In both cases, applying the induction hypothesis implies that it can be colored in colors. Next, we recover the old graph keeping the same colors, that is, and will be colored in the color of . It will be a proper coloring since and are not connected. Therefore, all neighbors of in are colored in a set of at most colors, which allows us to color properly and complete the induction step.
In the previous blog post, we discussed a problem from a recent Bulgarian tournament—an instructive exercise in applying averaging arguments. We presented three solutions, and here is another one. I include it because it relies on results concerning the decomposition of complete graphs into Hamiltonian cycles. These results, which we prove below, are also of independent interest.
Problem (Autumn Tournament, p10.3). In the plane, points are given. The sum of all pairwise distances between them is Prove that there exists a closed broken line passing through each point exactly once whose total length does not exceed
As before, we write instead of , and let denote the total sum of all distances between the given points. We will prove that there exists a Hamiltonian cycle whose length is at most . Here we’ll prove it using another averaging argument, but using less Hamiltonian cycles.
We discuss two auxiliary statements that are also of independent interest. In the first solution of previous post, we considered all Hamiltonian cycles and took their average length. To compute the total length of all cycles, we crucially used the fact that each edge appears in the same number of these cycles. Thus, it is not necessary to take all possible Hamiltonian cycles. It suffices to take only some of them, provided that each edge appears in exactly of these cycles, where . We would like to use the smallest possible value of .
We will see that when the number of vertices is odd, is possible; that is, there exists a set of Hamiltonian cycles such that each edge appears in exactly one of them. The version below is formulated in graph-theoretic language. A complete graph with vertices is a graph with vertices in which every pair of vertices is connected by an edge.
Theorem 1. (Folklore) If is an odd number, then there exists a decomposition of the complete graph into Hamiltonian cycles.
Proof. Let the vertices of be . Temporarily remove the vertex . What remains is a complete graph with (an even number of) vertices—denote it by . Consider the path
Figure 1 illustrates the case , with the indicated path highlighted in bold. Thus, starts at and ends at . Using , we will generate a sequence of paths. The path is obtained by rotating by an angle , that is, “moves’’ to , to , and so on.
By successive rotations we obtain the paths . It is easy to see that each edge of appears in exactly one of the paths .
Figure 1. Decomposition into Hamiltonian paths when is even
Now restore the vertex and close each of the above paths into a cycle. For example, we close the path by adding the edges and .
Thus, we have constructed a decomposition of into Hamiltonian cycles.
Now we consider the case when is even. In this case one cannot expect a decomposition into Hamiltonian cycles, because each vertex is incident to edges, i.e., an odd number, whereas each Hamiltonian cycle contributes exactly two of these edges. However, it turns out that there exists a set of Hamiltonian cycles such that each edge appears in exactly two of them.
Theorem 2. (Folklore) Let be an even number. In the complete graph there exist Hamiltonian cycles such that each edge appears in exactly two of them.
Proof. We use a similar idea as in the odd case. Let be the vertices of . Remove for the moment. What remains is the complete graph . In it, consider (see Figure 2) the path:
Figure 2. Decomposition into Hamiltonian paths when is odd.
This path is Hamiltonian, i.e., every vertex of appears in it. Again, we construct a sequence of Hamiltonian paths in . The path is obtained by rotating by an angle , i.e., moves to , to , and so on. By successive rotations we obtain . Note that every edge of appears in exactly two of the paths . Now put back the vertex and close each of the above paths into a cycle. For example, we close by adding the edges and . Each of the edges , , appears exactly twice in these cycles. This completes the proof.
Let us return to the original problem. As we have shown, there exists a number and a family of Hamiltonian cycles such that each edge appears in exactly of them. As we have seen, for odd and for even . The total length of these cycles is , and therefore the average length of such a cycle is
Hence, there exists at least one cycle whose length is less than or equal to this value.
Here we comment on a very interesting problem I encountered recently. It appeared in the 2025 Middle European Mathematical Olympiad, in the team competition. The right idea is elusive, but once found, the problem can be solved with almost no computation.
Suppose you have a complete graph with points; that is, any two points are connected by an edge. Each edge is labeled with a non-negative real number. What is the maximum number of edges one can mark so that, for each vertex, the sum of the labels of the marked edges incident with that vertex does not exceed of the sum of the labels of all edges incident with that vertex? Of course, one may replace with any .
Intuitively, we should mark the edges with small labels in order to be able to mark more edges. One might guess, without thinking too deeply, that we could simply arrange the edges incident with each vertex in increasing order of their labels and take the first of them. The main difficulty is that the label of an edge may be the smallest among all edges incident with and at the same time the largest among all edges incident with . Here is the problem.
Problem (MEMO 2025 T-4). Let be a positive integer. In the province of Laplandia there are cities, each two connected by a direct road and each of these roads has a toll station collecting a positive amount of toll revenue. For each road, the revenue of its toll station is split equally between the two cities at the ends of the road (meaning that each of the two cities receives half of the income). For each city, the total toll revenue is given by the sum of the revenues it receives from the toll stations on its roads. According to a new law, the revenues of some of the toll stations will be collected by the federal government instead of by the adjacent cities. The governor of Laplandia is allowed to choose those toll stations. The mayors of the cities demand that for each city, the sum of the remaining revenues it receives from the other toll stations after this change is at least of its former total toll revenue.
Find the largest positive integer depending on such that the governor can always choose toll stations for the federal government to collect the toll revenue, while satisfying the demand of the city mayors. (Proposed by Paulius Aleknavičius, Lithuania)
We reformulate the problem in a clearer way.
Graph-theoretic version. Each edge in a complete graph with vertices () is labeled with a non-negative real number. What is the maximum number of edges that can be marked so that, for each vertex , the sum of the labels of the marked edges incident with does not exceed of the sum of the labels of all edges incident with ?
Let be the corresponding complete graph. The answer can be easily guessed. In the case where all the labels are equal, there exists a subgraph of , containing all vertices in , such that the degree of any vertex in is . It is easy to check that if we mark the edges of , then the requirement is satisfied. The number of edges in is . Moreover, for this specific example, it is not possible to mark more than edges while still complying with the requirement. Indeed, in that case, there would be more than marked edges incident to a vertex , but the sum of the labels of these edges would exceed of the sum of the labels of all edges incident to .
Thus, the main question is: can we mark at least edges, regardless of the labels, and still comply with the requirement?
Here is a lower bound, which is slightly smaller but very close to . This is not the exact value, but I hope I could receive partial credit for the idea 🙂 . The precise estimate can be found at the end.
A Nearly Sharp Estimate
For each edge let be it’s toll tax (label). The idea is that to assign a variable to each edge that has the value if this edge is chosen and the value if it is not. But to avoid some of the difficulties that this discrete configuration requires, we allow the variables to have values between and . We’ll see that it can be arranged so that most of the variables have the value and only a small portion of them be positive but less than .
We assign a variable to each edge . These variables must satisfy the following condition:
We want to maximize Note that satisfies (1) and for these values, . This means that .
Let be the values that maximize and for which is minimal. We will prove
Suppose on the contrary and let . Consider the system of equations with respect to : We have a system with at most equations and at least variables. So, it has non-zero solution . Let us set . Consider the values . These values satisfy for small . Since is a linear function, it will be non-decreasing either for or for . Therefore, by choosing an appropriate , we can make at least one , , either or . In this way, , but decreases, which contradicts the extremality of .
Now, since and the number of non-zero values that are less than is at most , we obtain
So, we can mark the edges corresponding to and satisfy the demands of the mayors.
The Sharp Result
Let us choose a partition of the vertices into groups that minimizes the sum of the labels of the edges with endpoints in the same group. We will prove that if we mark the edges with endpoints in the same group, the given requirement is satisfied.
Suppose on the contrary there is a vertex that belongs to a group, say such that
where denotes the value of the label of the edge This means that there exists a group such that
But if we remove from the group and put it into the group we will decrease the sum of the labels of edges inside the groups, which contradicts the extremal choice of the partitioning, contradiction.
Thus, it remains to estimate the number of inner edges inside the groups. It can be easily checked, by smoothing or using the Jensen inequality, that the minimal number of edges is attained when all the groups have the same size, that is, each of them contains vertices. In this case, the number of marked edges is
Here is a pleasant problem from the recently held Bulgarian Autumn Tournament. Although the underlying idea is not new, it serves as an instructive example of how to use an averaging argument.
Problem 10.3
Problem (Autumn Tournament, p10.3). In the plane, points are given. The sum of all pairwise distances between them is Prove that there exists a closed broken line passing through each point exactly once whose total length does not exceed
A closed cycle that passes through each point exactly once is called a Hamiltonian cycle. Let us write instead of , and let denote the total sum of all distances between the given points. We will prove that there exists a Hamiltonian cycle whose length is at most .
We present several solutions. The first one is the official solution which is based on taking an average value. The second uses the same idea but wrapped in a probabilistic formulation. I include it for a reason: two contestants attempted to use probabilistic arguments, but their solutions were unfortunately quite vague. They tried to use expectation without properly defining the sample space or the random variables involved. In my view, the probabilistic method is very appealing to students, but many use it intuitively rather than with rigorous justification. This is not acceptable, even if it happens to lead to the correct answer. Here we present the method properly.
Thus, the first two solutions are non-constructive: you prove that such a cycle exists by computing the average length of all Hamiltonian cycles. If this average length is, say, , then some cycle has length at most , but you do not know which one. To actually find a cycle with the desired property, you would need to compute the lengths of all possible cycles.
The third proof, however, can be turned into an algorithm that finds such a cycle using operations.
First solution – Taking the Average Length
The idea is to consider all possible Hamiltonian cycles and compute their average length. Then there must exist at least one cycle whose length is at most this average value.
The number of all Hamiltonian cycles among these vertices is Indeed, if we label the points each Hamiltonian cycle corresponds to a permutation of these numbers. Since there are permutations corresponding to the same cycle, we divide by .
Fix a given segment and let us count how many Hamiltonian cycles contain this segment. By symmetry, this number is the same for every segment. We have cycles, each containing segments, so the total number of segments (counted with multiplicity) is Since the total number of distinct segments is , we conclude that each segment is contained in exactly Hamiltonian cycles.
Now, let’s calculate the average length of a Hamiltonian cycle. The total length of all cycles is , so the average length is . Therefore, there exists a Hamiltonian cycle with length at most
Second solution – The Probabilistic Method in Action
Let be the set of the given points. We define the sample space as the set of all Hamiltonian cycles in . We assign the same probability to each of them. Taking a random cycle let be the random variable equal to the length of that is, the sum of the distances of edges taking part in the Hamiltonian cycle. Our goal is calculate
For any vertices we denote by the distance between and , and by we denote the indicator random variable that takes the value if a random cycle contains the segment , and otherwise. Let us calculate By symmetry this probability does not depend on A heuristic argument is as follows. Since a random cycle contains segments out of possible, this probability must be A more rigorous argument is as follows.
By the calculations made in the first solution, this ratio is Hence
Further,
Note that for the length of a randomly chosen cycle we have
Using the linearity of expectation, we get
So, if the expected length of a cycle is , then there exists a cycle with length at most .
Third solution
We will prove by induction on that for points there exists a Hamiltonian cycle of length at most , where is the sum of all pairwise distances between the points. The base case is trivial.
Assume this holds for any points, where . Take any points. Fix one of them, call it . For the remaining points, we apply the induction hypothesis. That is, there exists a cycle with total length , where is the sum of distances between every two points from . Let . We have
In two recent blog posts (see [1] and [2]), we explored the longest path method in graph theory. We reviewed its main properties and applied it to four problems from recent prestigious mathematical contests. Here’s another problem—from the 2015 Chinese Team Selection Test (TST) (see [3])—that can be approached with the same idea. This time, we’re looking at directed graphs and directed paths.
Problem (China TST 2015, p3 ). There are some players in a Ping Pong tournament, where every players play against each other at most once. Given:
Each player defeats at least players and loses to at least players, where .
For any two players , there exist some players () (where , ), such that defeats for all .
Prove that there exist distinct players such that defeats for all .
Solution
We represent the competition as a directed graph , where the vertices correspond to the players. If player defeats player , we draw a directed edge from to . Conversely, if loses to , we draw a directed edge from to . This way, each vertex has at least outgoing edges (out-edges) and at least incoming edges (in-edges). The main idea is to look at a longest directed path and show that it contains at least vertices.
Let be a longest directed path. If we are done, so suppose . Observe that all out-edges from (at least of them) must go to vertices among ; otherwise, there would be a longer path. Similarly, all in-edges of (at least of them) must come from vertices among .
In what follows denotes the set . Define
Thus and . Let , . Since , it follows that .
There are other directed paths of length whose vertices lie among (see, for example, (1) and (2) below). Let be the set of all such directed paths.
Claim. There exists a vertex , , which is the starting vertex of one directed path in and also the ending vertex of another directed path in .
Proof. First consider the case . In this case is a directed cycle. Hence, each vertex , , is both the starting vertex of a directed path in and the ending vertex of another directed path in . Assume now that . Consider the path
This path lies in and its endpoint is . Thus is both the endpoint of one path in and the starting point of another path in , so we are done. We proceed in the same way in the cases and . Next, assume and . Consider the two sets
For any , the following path lies in and starts at :
(Note how important it is that ) Similarly, for any there is a path that starts at and ends at . Hence it suffices to show that . Since and , we have
Using (3) and (4), we obtain
Thus,
On the other hand, , and the set contains exactly indices. Therefore , as desired.
By the Claim, there exists a vertex , , that is the starting point of one path in and the endpoint of another path in . Hence, the other ends of all out-edges and all in-edges incident with must lie among , . Since there are at least such edges, we have , a contradiction. Therefore, the longest directed path in has at least vertices.
Remark. It turns out that the second condition in the problem statement is redundant
Here we continue with the generating function method discussed in the previous blog-post (see [1]). The problem we will discuss was in the IMO 2006 Shortlist, problem A2. The natural way to solve it does not use this method because it involves techniques outside the high school curriculum. However, it may be of interest, so I decided to include it here.
Problem (IMO SL 2006, A2). The sequence of real numbers is defined recursively by
Show that for all (Mariusz Skalba, Poland)
Here is a quote from a comment from the official shortlist brochure:
Students familiar with the technique of generating functions will immediately recognize as the power series expansion of (with value at ). But this can be a trap; attempts along these lines lead to unpleasant differential equations and integrals hard to handle. Using only tools from real analysis(e.g. computing the coefficients from the derivatives) seems very difficult.
So, apparently this approach was considered by the Program Selection Committee (PSC), but there is no solution in the official document using this technique. I saw a solution using generating functions in [2], post #8. Here we use the same idea, but with a different implementation.
Solution
The idea is to introduce the generating function of the sequence Let . This is a formal series, but it is not hard to see (since does not grow too quickly) that it converges in some open disk in centered at . Thus, as defined, is holomorphic in a neighborhood of zero. Using the recursive formula to which the sequence is subject, it immediately follows:
Since , we obtain
We view the right-hand side of (1) as the analytic continuation of .
It is easy to see that
Using the binomial expansion, this can be analytically extended in as
Next, we use the Residue Theorem to write
where .
Substituting (1) and (2), we get
In the third equality we again applied the Residue Theorem. It remains to note that
Chances are, I’ll need to give a lecture or two on generating functions sometime soon. I’m not really a big fan of the technique myself, but it’s useful now and then in Olympiad math, so students should at least be aware of it.
So, I started looking around for problems that show how generating functions can be applied. For instance, problem A2 from the 2006 IMO Shortlist can be solved this way (see [1]), though it’s probably a bit too complicated for high school students.
Instead, I’ll share a problem from the Bulgarian National Olympiad 2025 (regional round). Conventional approaches require a bit of grinding, so it’s not exactly a “pleasant” one, but it’s also not something you can just brute-force. The official solution uses some clever tricks, but there are lots of other possible approaches. To be fair, it’s not the perfect example of what generating functions can do, but I haven’t seen a solution using this method. Furthermore, this approach is applicable to a broader class of problems like this one. It offers a technique for these problems similar to “shut up and calculate”. Let’s dive into the problem.
Problem (Bulgarian NMO 2025, 2nd round, p9.4). For each four-digit number, we write the sum of its digits on a separate card. We randomly choose of these cards. What is the smallest value of for which we can be sure that two of the selected numbers have different residues modulo ? (proposed by Ivaylo Kortezov)
Solution
We can replace each of the written numbers with its residue modulo 7. So, each card shows a number from the set . Let denotes the number of cards on which is written the number Then
Thus, it boils down to finding the maximum of the numbers Consider
If we represent then is equal to the number of the four-digit numbers with the sum of the digits exactly . For a polynomial let us denote
We want to calculate Next, we reduce the powers of modulo and in what follows we work with
Denoting , we write
Observe that
The numbers: are all equal.
For any the numbers are equal.
for any two polynomials
That said, if we represent the expression in (2) as we have that are equal. It remains to calculate where
A direct calculation shows that
Thus
Summing up the last two rows, we get
To summarize. Denoting we obtain
Let’s now calculate the value of . The sum of coefficients of is equal to
Imagine you have a graph with vertices, but the edges are invisible. You can pick two vertices and ask whether they are connected or not. You get a correct answer. How many questions does it take to know for sure whether the graph is connected or not? This is a known problem that appeared in Tournament of towns 2016 math competition, see [1]. Surprisingly, you have to ask all possible questions to be sure.
This spring we needed a good combinatorial problem for a popular Bulgarian competition, and somehow this problem came to mind. I wondered what happens if we want to establish something weaker — whether two fixed vertices, say and are connected, that is, whether there is a path between and . This question is weaker than the original one, since the graph may not be connected, but there may still be a path between and I knew this was a different problem, but I thought that the same technique used in the aforementioned one might help. To my surprise, it couldn’t. Nevertheless, I sent the problem to the person responsible for the competiton. He wrote to me: ‘Very good problem, send me the solution!’ to which I replied: ‘Ok, but I have to solve it first’.
The deadline was short and another problem had to be chosen. The right approach came to me later and this problem was given at the recent International Festival of Young Mathematicians (IFYM) in Bulgaria. It was a team competition and I don’t think any team solved the problem. At least no team presented it to the jury. I think it would be difficult to grade a problem like that, it is prone to fake solutions. Here is the wording.
Problem (2025 IFYM, p8). There are cities in Wonderland. Some pairs of cities are connected by highways, and one can travel directly from one city to another only if a highway exists between them. Alice arrives in city , while the treasure is located in a different city . Alice’s mission is to determine whether she can reach the treasure, i.e., whether it is possible to travel from city to city by following the highways. She does not have a map of the country, but the White Rabbit, who is traveling with her, possesses the highway plan. Alice is allowed to ask the Rabbit consecutive questions—in each question she names two cities, and the White Rabbit answers whether there is a direct highway between them or not.
Determine the smallest such that Alice can be certain to complete her mission by asking questions, regardless of how the highways are designed.
Solution.
Answer: . Let us replace with . The White Rabbit answers honestly, but we are allowed to provide him with any highway plan we choose. That is, the rabbit can answer arbitrarily, as long as there exists a highway plan consistent with all of his answers.
We will present an algorithm for the White Rabbit that ensures Alice cannot determine the information she is interested in unless she asks all possible questions. We construct the algorithm inductively on . For , the situation is straightforward. Suppose the rabbit has an algorithm for a graph with vertices (), and let be a graph with vertices, with two fixed vertices and .
The algorithm operates as follows. If Alice’s first question is about the edge between and , the rabbit answers negatively. At the latest on the second question, the rabbit will be asked about an edge between two vertices such that . The rabbit answers positively and connects these two vertices with an edge. He then constructs a new graph with vertices: one vertex is , and the remaining vertices are all other vertices of except and . Let us denote them by .
If both vertices and are among , we define and . If one of these vertices is among , assume for definiteness , then we define and . The graph initially has no edges, while in the edge between and is present, and possibly also the edge between and (answered negatively). The algorithm continues as follows:
Alice asks about two vertices in . First, assume neither vertex is among , and let them be , . The rabbit applies algorithm to graph (with vertices ) for the question about , and then returns to Alice the answer obtained from . Next, suppose one of the vertices coincides with or , say , and the other is , . The rabbit answers negatively directly, without consulting , but notes these two vertices. Later, if asked about and , he consults for and , and returns the same answer for .
Thus, we have constructed the algorithm using . Two observations follow: 1) If an edge exists in that has not been asked about, then the corresponding edge also exists in . 2) At any moment, if there is a path between and in , then there is also a path between and in , and vice versa.
We will now prove that works, i.e., Alice cannot determine whether a path exists between and in before asking about every pair of vertices. Suppose the contrary. If she finds a path between and , then there would also be a path between and in without having asked all relevant questions, which contradicts the correctness of algorithm . If she concludes that and cannot be connected in before all possible questions are asked, then and cannot be connected in , again contradicting the correctness of .
This very useful idea in graph theory was reviewed in a recent blogpost [1] and applied to several problems from prestigious competitions. I believed the longest path approach held no surprises for me, but I was mistaken. Here, we exploit another useful property of the longest path and apply it to a problem from the 2025 Saint Petersburg Olympiad [2].
The Property We Exploit
Suppose we have a graph and let be a longest path in . This means that no other path in has more vertices (edges) than . Let be a vertex that does not belong to , that is, for . Here, we assume that is not a Hamiltonian path, so there exists a vertex not covered by
Definition. We say that a path starting from and ending at hits at the vertex if none of the vertices belongs to (On Fig.1 the red path and blue path hit at and respectively).
Property 1. Let be a longest path in a graph and Then two paths in starting from cannot hit in two consecutive vertices.
Proof. Suppose on the contrary, the paths and hit in two consecutive vertices and
Figure 1
Then the path
has more edges than contradiction. The expression ”along and ” means that instead along the edge we reach from moving along some of the edges of and – the bolded edges on Fig. 1
Now we use this property to solve the following problem from 2025 Saint Petersburg Olympiad. Another property that will be used is that in a graph with minimum degree there exists a path with at least vertices. One can see a proof of this simple property in [1].
2025 Saint Petersburg Olympiad, Problem 11.6.
Problem. A connected graph has more than vertices and remains connected even if any vertices are removed from it. Prove that there is a path in this graph such that the graph remains connected after removing these vertices. (Some pairs of non-adjacent vertices in the path may also be adjacent.)
Solution. Here is a slight modification of the solution given in post #2 of [2]. Let be the given graph and be a longest pat in Fix any vertex that is not in . If no such vertex exists—that is, when is a Hamiltonian path—we are done. Observe that is connected to through a path that starts at and first meets at a point . We choose such a path that minimizes .
Let us delete . Since the graph remains connected, there is a path connecting with ; that is, there is a path starting from and first meeting at some point with . Let be such a path with the minimum possible . It is not possible that , since otherwise we would obtain a path longer than (by Property 1 in the above section). Next, we delete and apply the same argument again.
Thus, we obtain the vertices all of which belong to , with . This implies that , so . Indeed, we cannot exhaust the path before counting to , because otherwise there would exist a path that first meets at its endpoint, contradicting its maximality. As a bonus, we proved that the longest path in contains at least vertices.
So, we have shown that any vertex not in is connected to a vertex of with index . Hence, we can delete the first vertices of , and the resulting graph will still be connected.