Prove that there is a periodic solution $x(t)$ with $p
Consider the differential equation $x'=f(t,x)$, where $f(t,x)$ is continuously differentiable in $t$ and $x$.
Suppose that $f(t+T,x)=f(t,x)$ for all $t$ . Suppose there are constants $p$, $q$ such that $f(t,p)>0,f(t,q)<0$ for all $t$. Prove that there is a periodic solution $x(t)$ for this equation with $p<x(0)<q$
What I have to show is that $ x(t+T) = x(t) $, that is $x(t)$ is periodic. I tried this
$\int_{0}^{t}{x'} = x(t)-x(0) = \int_{0}^{t}{f(s,x(s))}ds  $
But I don't know how to continue...
 A: The Poincaré map is defined in the following way:

For $\xi \in \mathbb{R}$, $P(\xi)$ is defined as the value at time $T$ of the (unique) solution of the IVP $$\begin{cases} x'= f(t,x), \\ x(0) = \xi. \end{cases}$$ 

It is easy to see that fixed points of the Poincaré map are in a one-to-one correspondence with the values at time $t = 0$ of $T$-periodic solutions of the ODE $x' = f(t, x)$ (here $T$ need not be the prime period).
Let $\varphi$ (resp. $\psi$) stand for the nonextendible solution of the ODE satisfying $\varphi(0) = p$ (resp. $\psi(0) = q$).  It follows from the uniqueness property that 
$$
\varphi(t) < \psi(t)
$$
for all $t \ge 0$ for which both $\varphi(t)$ and $\psi(t)$ exist.  
Denote by $(\alpha, \beta)$ the domain of $\varphi$.  We claim that $\varphi(t) > p$ for all $t \in (0, \beta)$.  Observe that $\varphi(t) > p$ for $t > 0$ sufficiently small.  Suppose to the contrary that $\tau$ is the first moment in $(0, \beta)$ such that $\varphi(\tau) = p$.  But $\varphi'(\tau) = f(\tau, p) > 0$, a contradiction.  In a similar way we prove that $\psi(t) < q$ for all $t > 0$ for which $\psi(t)$ exists.
Note that, by uniqueness, for any $x \in [p, q]$ the solution of the ODE starting at $x$ takes, for positive times, the values in the compact set $[p, q]$ (as long as it is defined).  Consequently, the domain of such a solution contains $[0, \infty)$.
To sum up, we have proved that the continuous (indeed, $C^1$) Poincaré map maps $[p, q]$ into $[P(p), P(q)] \subset (p, q)$.  By the Darboux property of continuous functions applied to 
$$
[p, q] \ni x \mapsto P(x) - x
$$
there exists $x_0 \in (p, q)$ such that $P(x_0) = x_0$.  So, the solution of the ODE starting at $x_0$ has period $T$.
