Solve by using fourier series :$y'(t)+y(t-1)=\cos^{2}\pi t$ We have to solve
$y'(t)+y(t-1)=\cos^{2}\pi t$ by using fourier series ,$y(t) \displaystyle\sim \sum _{n=-\infty}^{\infty} y_ne^{i \pi nt}$
My try:I can solve it directly but unable to solve by using fourier series.Thank you.
 A: $$\begin{align}y'(t)+y(t-1) &= \sum_{n=-\infty}^{\infty} y_n(in\pi + e^{-i\pi n})e^{i\pi n t}\\
&=\sum_{n=-\infty}^{\infty} y_n(in\pi + (-1)^n)e^{i\pi n t}
\end{align}$$
$$\cos^2\pi t =\frac{1}{2}(\cos 2\pi t + 1) = \frac{1}{4}\left(e^{i2\pi t}+e^{-i2\pi t}+2\right)$$
So $y_n = 0$ unless $n=0,2,-2$. 
Now solve for $y_0,y_2,y_{-2}$, and you are done.
A: The function $g(t) := \cos^2 \pi t$ is $2$-periodic. Since $p$-periodicity is preserved under differentiation and translation, it is therefore natural to seek a $2$-periodic solution to the given differential equation.
Let's suppose the solution $y$ is in $C^3[0,2]$. Then by Dirichlet's theorem
$$
y(t) = \sum_{n=-\infty}^{\infty} y_n e^{i \pi n t}
$$
with uniform convergence, where $y_n$ are the Fourier coefficients of $y$. Also repeated integration by parts shows $|y_n| \leq A/|n|^3$ so that Weierstrass' M-test and a standard theorem on the uniform convergence of series of functions give
$$
y'(t) = \sum_{n=-\infty}^{\infty} i \pi n y_n e^{i \pi n t}
$$
with uniform convergence.
Now, note that
\begin{align}
g(t) &= \frac{1}{2} + \frac{1}{2} \cos 2 \pi t \\
     &= \sum_{n=-\infty}^{\infty} g_n e^{i \pi n t}
\end{align}
with uniform convergence where the Fourier coefficients $g_n$ of $g$ are given by
$$
g_n = \begin{cases}
      1/2 & n = 0 \\
      1/4 & n = 2 \\
      1/4 & n = -2 \\
      0   & \text{otherwise}
      \end{cases}
$$
Substituting in the differential equation, we get
\begin{align}
y'(t) + y(t-1) = \cos^2 \pi t &\iff \sum_{n=-\infty}^{\infty} i \pi n y_n e^{i \pi n t} + \sum_{n=-\infty}^{\infty} y_n e^{i \pi n (t-1)} = \sum_{n=-\infty}^{\infty} g_n e^{i \pi n t} \\
&\iff \sum_{n=-\infty}^{\infty} (i \pi n y_n + (-1)^n y_n) e^{i \pi n t} = \sum_{n=-\infty}^{\infty} g_n e^{i \pi n t}
\end{align}
Multiplying by $e^{-i \pi k t}$ and integrating both sides with respect to $t$ from $0$ to $2$ shows, after interchanging the order of series and integral (which can be done because of uniform convergence), that corresponding coefficients must be equal. That is,
$$
i \pi n y_n + (-1)^n y_n = g_n \quad \forall n \in \mathbb{Z}
$$
One readily solves for $y_n$ and obtains
\begin{align}
y_0 &= g_0 = \frac{1}{2} \\
y_2 &= \frac{g_2}{2 \pi i + 1} = \frac{4}{16 + 64 \pi^2} - \frac{8 \pi}{16 + 64 \pi^2} i \\
y_{-2} &= \frac{g_{-2}}{-2 \pi i + 1} = \overline{y_2} = \frac{4}{16 + 64 \pi^2} + \frac{8 \pi}{16 + 64 \pi^2} i\\
y_n &= 0 \quad \text{otherwise}
\end{align}
The resulting $y$ is
$$
y(t) = \frac{1}{2} + \frac{8}{16 + 64 \pi^2} \cos 2 \pi t + \frac{16 \pi}{16 + 64 \pi^2} \sin 2 \pi t \tag{$\star$}
$$
which is indeed in $C^3[0,2]$.
Conclusion: if there is a $C^3$ $2$-periodic solution to the given differential equation, then it is the one given by $(\star)$.
Finally, one easily verifies that the function given by $(\star)$ satisfies the differential equation, so that it is indeed the solution.
Note: In fact if one just wants to find a solution to the differential equation, then justifying all the steps leading to $(\star)$ isn't necessary (and is probably a loss of time in an exam).
