Find all $f:\mathbb{Z} ^2 \to \mathbb{Z}$, such that $\forall p(x) \in P[\mathbb{Z}]: \forall a,b \in \mathbb{Z}: f(p(a),p(b)) = p(f(a,b))$
This question was given in a contest-math context, where we had 20 minutes two solve 3 (easy, first stage) problems in teams of 4. Here is my solution (I hope it's correct):
Consider $p(x)=a$, then:
$f(p(a),p(b))= p(f(a,b)) \to $
$$\to \forall a\in \mathbb{Z}:f(a,a)=a$$
Consider $p(x)=x-b$, then:
$f(p(a),p(b))= p(f(a,b))\to f(a-b,0)=f(a,b)-b \to $
$$\to \forall a,b \in \mathbb{Z}: f(a,b)=b + f(a-b,0)$$
So now we will try to find $\forall y \in \mathbb{Z} : f(y,0) = ?$
Consider $p(x) = x^2 - y x$:
and we will choose (y,0): $f(p(y),p(0))= p(f(y,0))\to f(0,0)=f(y,0)\cdot f(y,0)-y \cdot f(y,0) \to f(y,0)\cdot (f(y,0)-y) =0\to$
$$\to\forall y\in \mathbb{Z}: f(y,0)=0 \lor f(y,0)=y$$
let's assume by contradiction that there are $a \ne0,b\ne 0$ that $f(a,0)=a$ and $f(b,0)=0$
(I did not include 0 because $f(0,0)=0$)
Consider $p(x)=bx$, then:
$f(p(a),p(0))= p(f(a,0))\to f(ba,0)=bf(a,0) \to f(ba,0)=ba$
Consider $p(x) = ax$, then:
$f(p(b),p(0))= p(f(b,0))\to f(ba,0)=af(b,0) \to f(ba,0)=0$
Therefore $0=f(ba,0)=ba \to ba=0 \to $ contradiction ($a\ne 0, b\ne 0$)
so for every function $f$ that fits the criteria of the question, either $\forall y \in \mathbb{Z}: f(y,0) = 0$ or (EXCULISIVE) $\forall y \in \mathbb{Z}: f(y,0)=y$
Let's split it into 2 case:
1. $\forall y \in \mathbb{Z}: f(y,0)=y$. Then, $f(a,b) = f(a-b,0)+b \to f(a,b) = a$
Let's see if all of those functions fit the criteria of the question:
$\forall p(x) \in P[\mathbb{Z}]: \forall a,b \in \mathbb{Z}: f(p(a),p(b)) = p(f(a,b)) \iff p(a)=p(a) \iff True$
2. $\forall y \in \mathbb{Z}: f(y,0)=0$. Then, $f(a,b) = f(a-b,0)+b \to f(a,b) = b$
Let's see if all of those functions fit the criteria of the question:
$\forall p(x) \in P[\mathbb{Z}]: \forall a,b \in \mathbb{Z}: f(p(a),p(b)) = p(f(a,b)) \iff p(b)=p(b) \iff True$
So we found that the only 2 functions that fit the criteria are $f(a,b)=a$ and $f(a,b)=b$
Given the context of the question, I am sure that there must be a simpler solution. Can you think of any?
P.S: I would love to give credit to the creator of the question, but I don't know who he is.