Show that the equation $y'=f(x,y)$ has a periodic solution 
Given information: Let $f$ be a continuous function defined for all $(x,y) \in \mathbb{R}^2$. Let $f$ also satisfy a Lipschitz condition with respect to $y$. Let $f$ be periodic with respect to $x$ of period $w$, and let $y_1, y_2$ be such values that $f(x,y_1)f(x,y_2) \lt 0$ for all $x$.
Question: Show that the equation $y'=f(x,y)$ has at least one periodic solution of period $w$. Then apply this result to the equation $y'+p(x)y = q(x)$ where $p(x) \not = 0$ and $q(x)$ are continuous period functions of period $w$.

I'm given a hint that is:
Consider the map
$$p: \mathbb{R} \to \mathbb{R}, y_0 \mapsto p(y_0):=y_w$$
where $y_{w}=y(w)$ with $y$ being the solution of the initial value problem
$$y'=f(x,y), y(0)=y_0$$
The map $p$ is a Poincaré map, which maps the $y$-value $y_0$ of the solution curve through the point $(x,y)=(0,y_0)$ to the $y$-value of this solution curve $x=w$.
A periodic solution of $y'=f(x,y), $ corresponds to a fixed Poincare map, i.e. the existence of a $y^* \in \mathbb{R}$ with $p(y^{*})=y^*$
Random thoughts: I have to prove the existence of a fixed point by noting that the Poincare map is continuous as follows from a theorem.
Please help !
 A: Assume $y_1<y_2$ and $f(x,y_1)>0$, $\ f(x,y_2)<0$ for all $x$. By general principles about ODE's any solution $x\mapsto \phi_\eta(x)$ starting at a point $(0,\eta)$, $\ y_1\leq\eta\leq y_2$, will finally leave the rectangle $R:=[0,w]\times[y_1,y_2]$. But it cannot do so along the horizontal edges of this rectangle. It follows that the solution $\phi_\eta$ will pass through a point $(w,\eta')$, $\ y_1\leq\eta'\leq y_2$, on the right edge of $R$. In this way a so-called Poincaré map
$$\Phi:\quad [y_1,y_2]\to[y_1,y_2],\qquad \eta\mapsto \eta'=:\Phi(\eta)$$
is defined. Again by general principles this $\Phi$ is continuous. By Brouwer's fixed point theorem (or using the intermediate value theorem) it follows that $\Phi$ has a fixed point $\eta_*\in[y_1,y_2]$. The solution $\phi_{\eta_*}$ starting at $(0,\eta_*)$ is then periodic.
If instead of the initial assumption on $f$ we have $f(x,y_1)<0$, $\ f(x,y_2)>0$ we start the argument at $x=w$ and proceed to the left.
In the example $y'+p(x) y=q(x)$ we have
$$f(x,y)=p(x)\left({q(x)\over p(x)} -y\right)\ .$$
As $p$ and $q$ are periodic and continuous, and $p(x)\ne0$ for all $x$ there is an $M>0$ such that
$$-M<{q(x)\over p(x)}<M\qquad\forall x\ .$$
It follows that by choosing $y_1:=-M$, $\ y_2:=M$ we can fulfill the assumptions of the "theorem".
A: Draw a rectangle with sides $(0, w) $ and $(y_1, y_2)$ and pay close attention to the condition $ f(x, y_1)f(x,y_2)<0$ for all $x$. Let me assume WLOG that $f(x, y_1)<0$ and $y_1 < y_2$. Draw the integral curves of the vector field $ f(x,y)$. You'll notice that they all point upwards at the upper side of the rectangle and downwards at the bottom. Since integral curves cannot cross, this implies that your map  contains the interval $(y_1, y_2)$ in the image and moreover that it is monotone on $p^{-1}((y_1,y_2)) \subset (y_1,y_2)$.
This is the big intuitive picture. Can you make it rigorous now?
