How to solve this functional equation: $2f(x) = f(x-1)+f(x+1)$? After some calculations, I came up with this functional equation: $f(x-1)+f(x+1)=2f(x)$. I found linear function is one possible answer, but don't know how to derive it.

I don't know much about the techniques to solve this kind of equation. Can anyone help?

Edited: $f$ is a probability function, that is $0 \leq f \leq 1$, and $f$ is continuous.
You have $f(x+1)-f(x)=f(x)-f(x-1)$ and so $f(x+2)-f(x+1)$ is equal to the same value, and similarly $$f(x+n) - f(x+n-1)=f(x)-f(x-1)$$ for all integer $n$.  This gives $$f(x+n) = (n+1)f(x)-nf(x-1)=n(f(x)-f(x-1)) + f(x)$$ which is linear in integer $n$, though not necessarily linear in real $x$.

If you fix the values of $f(y)$ on $[-1,1)$ then you can give a general solution using rounding and $$f(y) = \lfloor y \rfloor\left(f(y-\lfloor y \rfloor)- f(y-\lfloor y \rfloor-1)\right) + f(y-\lfloor y \rfloor)$$
For integer $x=n$, this is an ordinary linear recurrence,

$$f_{n+1}=2f_n-f_{n-1},$$ with characteristic equation $(r-1)^2=0$, so that the general solution is

$$f_n=Cn+C'.$$

(Or simply, you have a second order finite difference which is zero, so that the sequence must be linear.)

But as $f$ is bounded, the term $Cn$ cannot exist and the solution is constant.

This conclusion is valid for all sets of points one unit apart. For the whole real domain, we can conclude that the solution is any continuous and periodic function of period $1$ with range in $[0,1]$.

If $f$ is a CDF, then the function must also be non-decreasing, so that the only possibility is a constant.

$$\color{green}{f(x)=p}$$ with $p\in[0,1]$.