Solving f(f(n)) = n + 2 on the positive integers
Statement
Find all functions (positive integers) such that for all .
Hint
Apply to both sides to show that . Then everything is determined by and .
Show solutionHide solution
Solution
Step 1: a recursion. Apply to and use the equation with replaced by :
Let and . Then for :
Step 2: using the equation at . .
- If is odd, , then ; setting this equal to gives , which is not odd. Contradiction.
- So is even, , and gives , so .
Step 3: two candidates.
- , : and , i.e. .
- , : and , i.e. for odd and for even .
Step 4: verification. For : . For the second function, if is odd then is even, so ; if is even then is odd (and ), so .
Answer. Exactly two functions: , and for odd , for even .
Lesson. Reduce to a recursion by applying again, then use the small values to pin down the free parameters, and always check whether more than one solution survives.