$f:\mathbb{R}\rightarrow\mathbb{R}$ and $f(x+1)+f(x+2)=f(x-1)+f(x)$ and $f(-x)=-f(x)$. Then find value of $f(2)$. $f:\mathbb{R}\rightarrow\mathbb{R}$ and $f(x+1)+f(x+2)=f(x-1)+f(x)$ and $f(-x)=-f(x)$. Then find value of $f(2)$.
My Attempt
$f(0)=0$ since $f(-x)=-f(x)$
By putting $x=0$ in the functional equation I am able to obtain $f(2)=-2f(1)$
Then putting $x=2,3,4...$ I am getting $f(n)=(-1)^{n+1}nf(1)$
But then what can we say about $f(1)$.
Also, I observe that $f(x)=\sin (\pi x)$ satisfies the given functional equation. Can there be more of such functions.
 A: With the help of @aqualubix in the comments, I was able to follow up on my own hunch. I thank them profusely.

The point is to use the idea of independence in functional value : if I look at $f(x)$, to get it I either need :

*

*The values of all of $f(x+2),f(x+1),f(x-1)$, or

*The value of $f(-x)$.

There is something about these determination patterns that is really pleasing to the eye. In fact, there is a theory that I read about in some book that I can't recall, which discusses problems like these.
Basically, the key idea is of creating dependencies : to find all solutions of a particular functional equation, you should find all possible ways in which any bunch of values can be found from another value.
For example , say you know $f(1)$. You already know $f(0)=0$ , and you can find $f(-1)$. Then you know $f(2),f(3)$ and so on, and then $f(-2),f(-3)$ etc. All in all, you know the value at every integer.
This has already been determined by the OP : once you know $f(1)$ then you can show that $f(n) = (-1)^{n+1}nf(1)$ for all $n \geq 0$, and $f(-n0 = f(n)$. All we need to find is the set of values that $f(1)$ can take.

A little look at the recurrence relation tells you that no non-integer value can influence the value of $f(1)$. Why? If you think about it, to "know" $f(1)$, you have to know either $f(-1)$ or all of $f(2),f(3),f(4)$. However, to know, for example $f(4)$, you need to know either $f(-4)$ or all of $f(3),f(5),f(6)$, and then ... you get the point : one has to know at least one integer value , otherwise you cannot do anything.
For example, if I start from say $f(\frac 12)$, I can know $f(-\frac 12)$. But then, that's it : I cannot know anymore. However, if I give you a little more information , say I give you both $f(\frac 12)$ and $f(\frac 32)$, then you can figure out $f(-\frac 12), f(-\frac 32)$ but also $f(\frac 52), f(\frac 72)$ and so on : but you can't get out of the "$+1$" mode.
How one rigorously proves this is using the idea of equivalence classes. I will go the whole hog to perhaps demonstrate the more general principle at hand, but let me say for now that the question of OP is extremely easy to solve keeping this "independence" in mind.

Indeed, given $a \in \mathbb R$, just define $f_a: \mathbb R \to \mathbb R$,

*

*$f_a(n) = (-1)^{n+1} na$, $n \in \mathbb Z , n \geq 0$, and $f_a(-n) = -f_a(n)$.


*$f_a(r) = 0$ for $r \notin \mathbb Z$.
I claim that $f_a$ solves the functional equation. Let's check both conditions.

*

*The easier one first : if $x \in \mathbb Z$ then $-x \in \mathbb Z$ so $f_a(-x)=-f_a(x)$ by definition. If $x \notin \mathbb Z$ then $-x \notin \mathbb Z$ so obviously $f_a(-x) = -f_a(x) = 0$.


*The slightly harder one now : suppose that $x \in \mathbb Z$, then all of $x+1,x-1,x+2 \in \mathbb Z$. Suppose that $x \geq 1$, then all of these numbers are non-negative $$
f_a(x+1) + f_a(x+2) = (-1)^{x+2}(x+1)a + (-1)^{x+3}(x+2)a = (-1)^{x+3}a \\
f_a(x-1)+f_a(x) = (-1)^{x}(x-1)a + (-1)^{x+1}xa = (-1)^{x+1}a = (-1)^{x+3}a
$$
so the equality follows. One can similarly check the case where $x \leq -2$ so that all of those numbers are negative, and the case $x = -1,x=0$ can be checked individually. On the other hand, if $x \notin \mathbb Z$ then $x+1,x+2,x-1 \notin \mathbb Z$ so $f_a(x)=f_a(x+1)=f_a(x-1)=f_a(x+2) = 0$.
Thus, both conditions are verified, and $f_a$ is a solution of the equation.
The value of $f(2)$ is then $-2a$, which can be any real number. Hence, the range of $f(2)$ is $\mathbb R$, as expected.

Independence was utilized above in separating the integer and non-integer behaviour. A more curious question is : can we use independence to actually completely characterize the set of all solutions of this equation?
The answer to that is a resounding yes. Indeed, I leave a user to prove the following.

*

*Given $f(1)$, we proved that one can find all $f(n), n \in \mathbb Z$.


*Suppose that $r \in (0,1)$. Given the values at $f(r),f(r+1)$, we can find the value at $f(r+n), n \in \mathbb Z$.


*However, there is still one issue : say you're given $f(\frac 34), f(\frac 74)$, say. Then you can find $f(-\frac 34), f(-\frac 74)$. Note that $f(\frac 14) + f(\frac 54) = f(-\frac 34) + f(-\frac 74)$. Therefore, for any $r \in (0,1), r \neq \frac 12$, there is a relation between the values of $f(r+n), n \in \mathbb Z$ and $f((1-r)+n), n \in \mathbb Z$. On the other hand, doing the same thing for $f(\frac 12)$ tells you that $f(\frac 12) + f(\frac 32) = 0$.
Therefore, I believe at this point that all solutions should be completely characterized by :

*

*A value $a = f(1)$.


*For each $r \in (0,\frac 12)$, a value $b_{1r} = f(r), b_{2r} = f(r+1)$.


*For $r=\frac 12$, a value $b_{\frac 12} = f(\frac 12)$.
These can be arbitrary real numbers, and it should not be difficult (provided I haven't missed anything) to prove that the set of all functions satisfying the relations in the original post is in one-one correspondence with a pair of values $a,b_{\frac 12}$ and a pair of values for each $r \in (0,\frac 12)$ given by $(b_{1r},b_{2r})$.
