TITLE: $f \colon \mathbb{R} \rightarrow \mathbb{R}$, $f$ is continuous , and $f(x+1)+f(x)=x^2$
QUESTION [7 upvotes]: I would appreciate if somebody could help me with the following problem:

Find $f(x)$ ($f(x)$ is not Polynomial function), given that:
$f \colon \mathbb{R} \rightarrow  \mathbb{R}$, $f$ is continuous, and $f(x+1)+f(x)=x^2$

I tried  but couldn't get it that way.

REPLY [2 votes]: Let's first consider the function on $\mathbb{Z}$.
$$
\begin{align}
\sum_{k=0}^{n-1}(-1)^k(f(k+1)+f(k))
&=\sum_{k=1}^n(-1)^{k-1}f(k)+\sum_{k=0}^{n-1}(-1)^kf(k)\\
&=(-1)^{n-1}f(n)+f(0)\tag{1}
\end{align}
$$
Furthermore,
$$
\begin{align}
\sum_{k=0}^{n-1}(-1)^kk^2\tag{2}
&=(-1)^{n-1}\frac{n(n-1)}2
\end{align}
$$
Combining $(1)$ and $(2)$ yields
$$
f(n)=\frac{n(n-1)}2+(-1)^nf(0)\tag{3}
$$
If we set $f(0)=0$, we get
$$
\bbox[5px,border:2px solid #FFC000]{f(x)=\frac{x(x-1)}2}\tag{4}
$$
Checking, we get
$$
f(x+1)+f(x)=x^2\tag{5}
$$
This gives us one solution. Suppose we have two solutions, $f$ and $g$. Then
$$
(f-g)(x+1)+(f-g)(x)=0\tag{6}
$$
That is, $(f-g)(x+1)=-(f-g)(x)$. Thus, the general solution is
$$
\bbox[5px,border:2px solid #FFC000]{f(x)=\frac{x(x-1)}2+h(x)}\tag{7}
$$
where $h$ is any continuous function where $h(x+1)=-h(x)$.
An example of such an $h(x)$ would be $a\cos(\pi x)+b\sin(\pi x)$.