Problem :
Let $P(x, y)$ be a polynomial respect to $x, y$.
Find a condition about $P$ where functional equation of $f$
$$f(x+y)=f(x)+f(y)+P(x,y)$$
has a solution. (Where $f\colon \mathbb{R}\to\mathbb{R}$ be a differentiable function.)
This problem came from some functional equation problems below :
P1 :
Find a differentiable $f$ which satisfies $$f(x+y)=f(x)+f(y)+2xy$$
S1 :
Set $x=y=0$ then we get $f(0)=0$.
From definition of derivative,
$$f'(x)=\lim_{y\to 0}\frac{f(x+y)-f(x)}{y} = \lim_{y\to 0} \frac{f(y)+2xy}{y} = 2x+f'(0)$$
This implies $$f(x)=x^2 + cx$$
for some constant $c$.
Plugging this to original functional equation,
$$\text{LHS} = x^2 + 2xy + y^2 + cx + cy$$ $$\text{RHS} = x^2 + y^2 + cx + cy + 2xy$$
which are same, so we find a solution of original functional equation.
P2 :
Find a differentiable $f$ which satisfies $$f(x+y)=f(x)+f(y)+3x^2y$$
S2 :
Similar way, $f(0)=0$ and from definition of derivative,
$$f'(x)=f'(0)+3x^2$$
which implies $$f(x)=x^3 + cx$$
for some constant c. However If we plug this to original functional equation
$$\text{LHS} = x^3 + 3x^2y + 3xy^2 + y^3 + cx + cy$$ $$\text{RHS} = x^3 + 3x^2y + y^3 +cx + cy$$
which are not same.
So, I want to know a condition of $P(x, y)$ which makes a functional equation of $f$ (which likes below form) has a solution :
$$f(x+y)=f(x)+f(y)+P(x,y)$$
Where $f$ is a differentiable function.
I find that WLOG $P(0, 0) = 0$
Because, if $P(0, 0) = a \neq 0$, add $a$ both side then we can write as
$$(f(x+y)+a) = (f(x)+a) + (f(y)+a) + Q(x, y)$$
Where $Q(x, y)$ is a polynomial respect to $x, y$ which satisfies $Q(0, 0) = 0$.
Substitution $g(x) = f(x)+a$ changes this equation to :
$$g(x+y)=g(x)+g(y)+Q(x, y)$$
So I can assume that WLOG $P(0,0)=0$.
Added
Conjecture :
$P(x,y)$ must be constant or middle term(Cross -terms) of binomial expansion, i.e.
$$ (x+y)^2 = x^2 + y^2 + \mathbf{2xy}$$ or $$(x+y)^3 = x^3 + y^3 + \mathbf{3x^2y + 3xy^2}$$
I don't have a proof but I made some try and common thing of $P(x,y)$ is this.
Thanks for your help!
The complete description of the required polynomials $P(x,y)$ is provided by the following simple theorem.
Theorem. Let $P(x, y)\in \mathbb R[x,y]$ be a polynomial and $f\colon \mathbb{R}\to\mathbb{R}$ be a differentiable function such that $f(x+y)=f(x)+f(y)+P(x,y)$ for each $x,y\in\mathbb R$. Then $f$ is a polynomial.
Proof. For each $x,y\in \mathbb R$, $y\ne 0$ we have $\frac{f(x+y)-f(x)}{y}=\frac{f(y)+P(x,y)}{y}$. Since there exists $f'(x)=\lim_{y\to 0}\frac{f(x+y)-f(x)}{y}$, we have that $f(0)+P(x,0)=0$ and $f'(x)=f'(0)+P_y(x,0)$. Since the latter expression is a polynomial with respect to $x$, so are $f'(x)$ and $f(x)$. $\square$