TITLE: $f''+f \ge 0$ implies $f(x)+f(x+\pi) \ge 0$
QUESTION [6 upvotes]: Let $f: \mathbb{R} \to \mathbb{R}$ be a function of class $C^2$ satisfying $f''(t)+f(t) \ge 0$ for all $t \in \mathbb{R}$. Show that $f(t)+f(t+\pi) \ge 0$.

What I did:
Set $f''(t)+f(t)=g(t)$. This is an LDE of order 2, and we denote this equation by (E), and the corresponding homegoneous equation by (H). and $f$ is of the form $A\cos(t)+B\sin(t)+y_0(t)$ where $y_0(t)$ is a particular solution of (E), $A,B$ are constants. The trigonometric part cancels in the evaluation of $f(t)+f(t+\pi)$, so the problem boils down to finding a $y_0(t)$ which is always nonnegative. 
Well let's search for such a $y_0(t)$ using the technique of reductin of order, i.e let's set $y_0(t)=\lambda y_h(t)$ where $y_h(t)$ is a particular solution of $(H)$. All solutions of $(H)$ are sinusoidal so if this method is going to work we might as well set $y_0(t)=\lambda \sin(t)$. Substituting, we find
$\sin(t)\lambda''+2\cos(t)\lambda'=g$.
So if $\sin(t)=0$, $\lambda'=g(t)/2$. Let $I_{2k}=(2k\pi,(2k+1)\pi)$, $I_{2k+1}=((2k+1)\pi,(2k+2)\pi)$. Define $L_I=2k\pi$ if $I=I_{2k}$, $L_I=(2k+1)*\pi$ if $I=I_{2k+1}$. If $I \in \{I_{2k},I_{2k+1}\}$ we have
$(\frac{d}{dt} [\lambda'\sin(t)])/\sin^2(t)=g$ for all $t \in I$
$\lambda'\sin^2(t)=\int^t_{L_I} g(u)\sin(u)\,du+C_I$ for all $t \in I$
where $C_I$ is a constant of integration.Note that the integral is well-defined since $gsin(u)$ is continuous, and the integral is therefore itself continuous. Note that if $I=I_{2k}$, then the integrand is positive, and $\sin^2(t)$  is always positive, so if we choose $C_I$ correctly then $\lambda'$ is positive. The opposite holds if $I=I_{2k+1}$. This is good because we want $\lambda$ positive on $I_{2k}$ and negative on $I_{2k+1}$. 
Now note that $\lambda'$ is continuous on all the $I$'s. However if we impose that $\lambda'$ be continuous on $\mathbb{R}$ then we run into a problem because 
$\lim_{t \to L_I, t>L_I}RHS=C_I$, which must be equal to $\lambda'(L_I)\sin^2(L_I)=0$, for all $I$. But then 
$\lim_{t \to L_I, t<L_I}RHS=\int^{L_I}_{L_I'} g(u)\sin(u)\,du=0$, where $I'$ is the interval that precedes $I$. Of course in general $g$ doesn't have to satisfy this.
So this method kind of breaks down when we consider continuity but I believe it gives a function $f$ which is continuous and differentiable everywhere (and nonnegative, if we choose $C_I=0$) except for the points $L_I$.
Edit: Can you please tell me whether my method could work, or is the only possible solution the magical invaraint one given by achille?

REPLY [9 votes]: Method 1 - unmotivated magic.
For any fixed $x$, we have 
$$\frac{d}{dt}\left[\sin(t-x)f'(t) - \cos(t-x)f(t)\right] = \sin(t-x)(f''(t) + f(t))$$
Integrate both sides for $t$ over $[x,x+\pi]$, one find
$$
f(x)+f(x+\pi) 
= \left[\sin(t-x)f'(t) - \cos(t-x)f(t)\right]_x^{x+\pi}\\
= \int_x^{x+\pi}\sin(t-x)(f''(t) + f(t)) dt
\ge 0
$$
because both factors in the integrand: $\sin(t-x)$ and $f''(t) + f(t)$ are non-negative over $[x,x+\pi]$.

Method 2 - a slightly more constructive approach.
Since OP complains about method 1 is too unmotivated, following is an alternate
approach which is more constructive. The basic idea is let $f'' + f = g$
and attempt to express $f$ in terms of $g$. 
For simplicity of presentation, we will assume $x = 0$. 
Notice LHS of $f''(t) + f(t) = g(t)$ can be rewritten as
$$\left(\frac{d}{dt} + i\right)\left(\frac{d}{dt} -i\right)f(t)
= \left(e^{-it} \frac{d}{dt} e^{it}\right)\left(e^{it} \frac{d}{dt} e^{-it}\right)f(t)
=  e^{-it}\frac{d}{dt}\left[ e^{2it} \frac{d}{dt} \left(e^{it}f(t)\right)\right]
$$
Multiply both sides by $e^{it}$, integrate once and matching derivatives at $t = 0$, we get
$$e^{2it}\frac{d}{dt}( e^{-it}f(t) ) = f'(0) - if(0) + \int_0^t g(v) e^{iv} dv
$$ 
Mutiply both sides by $e^{-2it}$, integrate and matching derivatives at $t = 0$ again, we get
$$\begin{align}e^{-it}f(t) 
&= f(0) + \int_0^t \left[ f'(0) - if(0) +
\int_0^u g(v) e^{iv} dv \right] e^{-2iu} du\\
&= f(0) + (f'(0) - if(0))e^{-it}\sin(t)
+ \int_0^t g(v) e^{iv} \left( \int_v^t e^{-2iu} du \right) dv\\
&= f(0) + e^{-it}\left[ (f'(0) - if(0))\sin(t)
+ \int_0^t g(v) \sin(t-v) dv\right]\\
\implies\quad
f(t) &= f(0)\cos(t) + f'(0)\sin(t) + \int_0^t g(v)\sin(t-v) dv\tag{*1}
\end{align}
$$
Setting $t = \pi$, this leads to
$$f(\pi) + f(0) = \int_0^\pi  g(v) \sin(\pi - v) dv = \int_0^\pi  g(v) \sin v dv \ge 0$$
because $g(v)$ and $\sin v$ are non-negative on $[0,\pi]$.
Notes
Please note that the appearance of the function 
$$G(t,v) \stackrel{def}{=} \begin{cases}\sin(t-v), &t > v\\
0, &t < v\end{cases}$$
in the integral of $(*1)$ is not accidental.
It is the Green's function for the linear differential operator $\frac{d^2}{dt^2} + 1$. In certain sense,
one can think of $G$ as the right inverse of this differential operator.