# Prove periodic solution of an ODE

Consider the differential equation $x'=x+cos(t)$

a) find the general solution of this equation

b) prove there is a unique periodic solution for this equation

c) compute the Poincaré map $p:{t=0} \to {t=2\pi}$ for this equation and use this to verify again that there is a unique periodic solution.

I solved part a) and found $x(t)=\frac{1}{2}sin(t)-\frac{1}{2}cos(t)+ce^t$ but I'm unsure how to prove the solution is periodic or how to do the map.

b) Intuitively it is clear that the solution is periodic if and only if $c=0$, that is when $$x(t) = \frac{1}{2}\sin(t) - \frac{1}{2}\cos(t).$$ However, one can still provide a somewhat more rigorous argument in support to this claim.
A periodic solution is a solution of the equation with the property that there exists a positive real number $T>0$ such that $x(t+T) = x(t)$ for all $t \in \mathbb{R}$. Let's write this condition explicitly: \begin{align} x(t+T) &= \frac{1}{2}\sin(t+T) - \frac{1}{2}\cos(t+T) + c\, e^{t+T}\\ &= \frac{1}{2}\sin(t) - \frac{1}{2}\cos(t) + c\, e^{t} = x(t). \end{align} In other words, for any $t \in \mathbb{R}$ we apply some trigonometric formulas and group together the terms: \begin{align} 0 &= x(t+T) - x(t) \\ &= \frac{1}{2}\sin(t+T) - \frac{1}{2}\cos(t+T) + c\, e^{t+T} - \frac{1}{2}\sin(t) + \frac{1}{2}\cos(t) + c\, e^{t} \\ &= \frac{1}{2}\cos(T)\sin(t) + \frac{1}{2}\sin(T)\cos(t) \\ &- \frac{1}{2}\cos(T)\cos(t) + \frac{1}{2}\sin(T)\sin(t) \\ &+ c\, e^T\, e^{t} - \frac{1}{2}\sin(t) + \frac{1}{2}\cos(t) + c e^{t} \\ &= \left(\frac{1}{2}\cos(T) + \frac{1}{2}\sin(T) - \frac{1}{2}\right)\sin(t) + \left(\frac{1}{2}\sin(T) - \frac{1}{2}\cos(T) + \frac{1}{2}\right)\sin(t) + \left(c\,e^T - c\right)\, e^t \end{align} The the three functions $\,\,\sin(t), \,\,\cos(t)$ and $e^t$ are lineraly independent which means that \begin{align} \left(\frac{1}{2}\cos(T) + \frac{1}{2}\sin(T) - \frac{1}{2}\right)\sin(t) + \left(\frac{1}{2}\sin(T) - \frac{1}{2}\cos(T) + \frac{1}{2}\right)\sin(t) + \left(c\,e^T - c\right)\, e^t = 0 \end{align} for all $t \in \mathbb{R}$ the coefficients in front of each of them are zero, i.e. \begin{align} \frac{1}{2}\cos(T) + \frac{1}{2}\sin(T) - \frac{1}{2}&=0\\ \frac{1}{2}\sin(T) - \frac{1}{2}\cos(T) + \frac{1}{2} &= 0\\ c\,e^T - c& = 0 \end{align} which is the same as \begin{align} \cos(T) + \sin(T) &= 1\\ \sin(T) - \cos(T) &= - 1\\ c\,e^T &= c \end{align} To simplify, add the first two equations and then subtract them to obtain the equivalent system \begin{align} \sin(T) &= 0\\ \cos(T) &= 1\\ c\,e^T &= c \end{align} If $c=0$, then the system has solutions in the form of $T_k = 2\pi k$ for $k \in \mathbb{Z}$. The period $T$ should be the smallest positive number, so $T = 2\pi$. If $c \neq 0$ then the third equation becomes $e^T=1$ which holds if and only if $T=0$. In this case, $T$ is not a period as it is not positive. Therefore the only possible case is $c=0$ which means $$x(t) = \frac{1}{2}\sin(t) - \frac{1}{2}\cos(t).$$
c) Let $x \in \mathbb{R}$. The Poincare map $P : \mathbb{R} \to \mathbb{R}$ is defined as follows: take a solution $x(t)$ of your equation such that $x(0)=x$. Then $P(x) = x(2\pi)$, which is the period of the equation.
Now, $$x = x(0) = \frac{1}{2}\sin(0) - \frac{1}{2}\cos(0) + c\, e^{0}= -\frac{1}{2} + c$$, so $c = x + \frac{1}{2}$. Therefore the solution that satisfies $x(0)=x$ is $$x(t) = \frac{1}{2}\sin(t) - \frac{1}{2}\cos(t) + \left(\frac{1}{2} + x\right)\, e^{t}.$$ Therefore $$P(x) = x(2\pi) = \frac{1}{2}\sin(2\pi) - \frac{1}{2}\cos(2\pi) + \left(\frac{1}{2} + x\right)\, e^{2\pi}$$ which yields $$P(x) = e^{2\pi}\, x + \frac{1}{2}e^{2\pi} - \frac{1}{2}.$$ This is a linear function in $x$ so a periodic solution of period $2\pi$ corresponds to a fixed point of $P$, i.t. $P(x) = x$. Solve the latter equation and you get that $x_0 = -\frac{1}{2}$ is the only fixed point.
Therefore the solutions $x(t)$ with the property that $x(0) = -\frac{1}{2}$ is the only periodic solution with that period which is exactly $$x(t) = \frac{1}{2}\sin(t) - \frac{1}{2}\cos(t).$$