Published
- 9 min read
Math Puzzle: Titu's function
I quoted a random tweet about a Math puzzle.
Posed by the Legend himself, Titu Andreescu and Nikolai Nikolov, functional equation that will surprise you on every step towards the final solution. Enjoy! ✨ pic.twitter.com/6ErQR8wlY1
— Andrzej Kukla (@Mathinity_)
November 2, 2025
What made it interesting is the problem solving structure.
In order to test ChatGPT capabilities as well, I asked it to solve it without prior guidance. However, it failed to find the solution, unless I give it more hints.
So this puzzle is an example that LLM AI still can’t solve puzzles like this autonomously.
Problem Statement.
We have a function with relations with respect to its own values at different points:
Given parameters with constraints , we want to find a family of such function.
Let’s compare human vs AI approach.
As a human, the first thing we intuitively wants to check is, “what happened if ?”.
So, if we define the function , at it will have value .
Why AI stuck
ChatGPT can find that solution just fine, but it failed to consider the possible function family.
It assumed that the only possible values is just constant function . Which is hilariously correct, but we want to know non-trivial solution. The solution where the function does affected by the parameter .
Even when I said the non-constant solution exists, ChatGPT insists constant solution is the only solution.
Problem Solving with AI help
Personally, I immediately realized, that we can explore the relation by finding symmetries.
Notice that the relation is invariant to the cycling of the variables. In other words, if we swap with , or with , it doesn’t change the equation.
Hence, we can reduce the degree of freedom.
Simplest way is if we set , then the only possible symmetries is if and . So that
The functional relation becomes
At this point, you have an option to feed the AI prompt to just the result of applying symmetries above.
Or…
You could give it a prompt that guides the AI to arrive at that solution (by specifying what the symmetry is).
I prefer to do the second one. Because LLM will then generate the step by step context by itself to arrive at that conclusion. It’s easier than having us typed all the steps ourselves.
The AI still can’t find solution. So we guide it further.
To have a cleaner relation, notice that above relation is a recursive one. It relates the value of the function at something into the value at another . In essence, if we define the value of just one at specific point, we can figure out the next value iteratively via recursive relation.
But let’s make the relation easier to compute/understand.
We want to relate the value of . So let’s change . Meaning .
The relation becomes
The AI still can’t figure out what to do.
However at this stage, we can ask the AI to try some kind of functional form that might solve the relations.
Noticed that the input of the function is transformed using a transform function .
If we annotate as the initial values, then the next sequence
The second sequence as expressed by is something like this
So, from our perspectives, it makes sense if the function has similar form with this transformation.
So we can choose the form similar to what is usually called the Mobius transform
From here, I prompted the AI and it is able to find the solution and acknowledge its previous error.
Perhaps you can try doing the same using your favorite AI model
The derivation of the solution
Insert the general form to the relational equation so that we can find the constant .
So we got 3 systems of equation.
For the coefficient of
For the coefficient of
Lastly for the constants, or
Looking at all of them, the constant rarely appears, so lets just substitute this. From coffecient, solve for
Substitute to
Surprisingly the solution is quite neat from just one substitution. In order for the product to be 0, it needs either
Case A:
or Case B:
Case A
From (5), substitute to (4)
From (5) and (7), substitute to (2). We replace into , and replace into .
It turns out above equation just eliminates all variables to 0, so any value of and is valid. If we go back to the function form:
This just means if we let , then the only solution for this case is a constant function .
Case B
From (6), substitute to (4)
From (6) and (8), substitute to (2). We replace into , and replace .
Above equation also eliminates all variables. So that means the free parameter is just and . If we go back to the function form:
It turns out we can replace a new constant, to become:
That’s the non-trivial solution.
Visualizing the solution
Here’s an interactive plot of the function. You can adjust the k value to see how it affects the graph:
Here’s an interesting thing to try:
- If you click any point . The graph will also show you the “dual point”, or the other pair of point
- If you try any value and . The graph curving down.
- If you try any value greater than . The graph curving up.
- Choosing the same curve up/curve down, for different values, the graph will still looks like exactly the same. What is different is just the scale of range, if we keep the scale of range.
- Changing the to span to negative values will show you that the graph has vertical asymptote in , and horizontal asymptote in
This can be explained by rewriting the function
The first derivative
And the second derivative
Notice that the sign of the second derivative flips at . The second derivative controls the concavity of the curve.
Meanwhile, the reason why the shape of the curve looks the same is because can be seen as a hyperbola equation in the form , which is a conic hyperbole, rotated 45 degrees.
Basically and is the asymptote.
Addendum: ChatGPT Chat History Screenshot
As a lesson learned. Let’s see the screenshot of how ChatGPT responds
In the first prompt, I directly paste a screenshot of the tweet

It can parse the problem statement just fine.
But the answer it provide is obviously wrong.

A simple counter example is when , , and . Input it directly to the function, and it failed.
So I asked to consider logarithmic function to “warm up” its brain.
Why logarithmic? It’s because it is a monotonic increasing function. So cycling the input won’t affect the addition. Also, it can turn addition into product input. We might have more clues.

But it uses the wrong steps and arrive in conclusion that is a constant.
In the next prompt, I give it ideas to rewrote the parameter, so it might be able to solve “simpler” statements.

Things looks good, because it finally found the functional relation using just a single parameter.

However, it insists there is only constant solution.

No more hints I give changed its mind. Even if I said “there is non-constant solution”.
Finally, it only changed its mind after I give an example of non-constant solution.

Then I used that opportunity to slightly questioned its previous answer.

It then able to proceed to guess Mobius Transform/fraction.

HOWEVER, after I look closely at the equation and derivation it found above. It wrote the wrong equation. But somehow the end result is correct.
In the below example, see equation III jumped to A, but with the wrong algebra applied

Or maybe it was some case of invalid rendering? Because when I first saw it, it wrote .
Anyway, it then arrive to the same conclusion

But, again, sometimes the calculation is wrong. For example above derivation for and is incorrect!
Remarks
As you can see above, using ChatGPT for Math problems to do some proving or problem solving, is still far from perfect. Things works well if you do it like this:
- Gave candidate solution, ask it to verify
- Perform algebra that is cumbersome to calculate/rewrite by hand, but give example/counter example to validate its anwer
- Use numerical (like Python numpy or matplotlib) or programmatical (like Lean prover) to validate its own answer. Ask them to generate the proof themselves.