TITLE: Find all the functions $f:\mathbb{Z}^+ \to \mathbb{Z}^+$ such that $f(f(x)) = 15x-2f(x)+48$.
QUESTION [12 upvotes]: Find all the functions $f:\mathbb{Z}^+ \to \mathbb{Z}^+$ such that $f(f(x)) = 15x-2f(x)+48$.

If $f$ is a polynomial of degree $n$, we have that $\deg(f(f(x))) = n^2$ and $\deg(15x-2f(x)+48)=n$. Therefore, the only possible polynomials that satisfy the condition have degree $0$ or $1$.
Let $f:\mathbb{Z}^+ \to \mathbb{Z}^+$ be a function that holds the condition of the problem given by $f(x)=ax+b$ for some constants $a$ and $b$. Since $$f(f(x)) = f(ax+b) = a(ax+b)+b = a^2x + (a+1)b$$ and $$15x-2f(x)+48 = 15x-2(ax+b)+48 = (15-2a)x+(48-2b),$$ it follows that
$$a^2+2a-15=0 \quad\text{and}\quad (a+1)b=48-2b.$$ From the first equation, we get that $a=-5$ or $a=3$. If $a=-5$, from the second equation we get that $b=-24$, and it contradicts that $f[\mathbb{Z}^+]\subseteq \mathbb{Z}^+$. If $a=3$, then $b=8$. Therefore, $f(x)=3x+8$ is the only polynomial that satisfies the condition of the problem.  I guess that this is the only solution, but I do not know how to prove it.
Edit: I was trying to prove that the iterations of any function $f$ that satisfies the problem have the same behaviour. For instance, by iterating $f$ we have that $2f^3(x)+f^4(x)-15f^2(x)=48$, so this functions are almost the same except for constant terms. Is this usefull this idea to complete the problem?

REPLY [8 votes]: Put $a_0=a \in \mathbb{Z}^{+}$ arbitrary and $a_n=f(a_{n-1})$ for $n \geq 1$. The functional equation gives a non-homogenous linear recurrence
$$
a_{n}=-2a_{n-1}+15a_{n-2}+48.
$$
Homogenizing it by substitution $b_n=a_n+4$ we get
$$
b_n=-2b_{n-1}+15b_{n-2}.
$$
The characteristic equation is $x^2+2x-15=(x+5)(x-3)$, hence by the standard result for linear recurrences we have some constants $A,B$ such that
$$
a_n=A3^n+B(-5)^n-4.
$$
If $B\neq 0$, the term $(-5)^n$ will dominate over $3^n$ in $a_n$ for sufficiently large $n$, regardless of value of $A$. Hence $a_n$ will be arbitrary large negative or positive value, based on the parity of $n$. However, we know $a_n=f(a_{n-1})$ must be positive for $n \geq 1$, thus $B=0$. Also from $n=0$ we find $A=a+4$, and overall
$$
a_n=3^n(a+4)-4.
$$
Finally, from $n=1$ we obtain $f(a)=a_1=3(a+4)-4=3a+8$. Since $a$ was arbitrarily chosen, we have $f(x)\equiv 3x+8$. Plugging back to the functional equation verifies it is indeed a solution and by the above construction also the only one.