# How can one solve this differential equation?

We're give the following differential equation: $$mx''(t)+kx(t)=f(t)$$where $m$ and $k$ are constants and $f(t)$ is a periodic function of period $2L$.

$\textbf{My attempt:}$

First, I solved the homogeneous differential equation $$mx''(t)+kx(t)=0$$ and got the familiar solution $$x_c(t)=A\cos\bigg(\sqrt{\dfrac{k}{m}}t\bigg)+B\sin\bigg(\sqrt{\dfrac{k}{m}}t\bigg)$$

Then I went to find the particular solution, and since the only given about $f(t)$ is its periodicity, it seemed I have to use Fourier series.

The Fourier expansion of $f(t)$ is $$f(t)=\sum_{n=-\infty}^{+\infty}c_ne^{jn\dfrac{\pi}{L}t}$$ where $j\equiv\sqrt{-1}$ and $c_n$ is a function of $n$. Thus the particular solution has to be of the form $$x_p(t)=\sum_{n=-\infty}^{+\infty}b_ne^{jn\dfrac{\pi}{L}t}$$ where $b_n$ is some other function of $n$.

Calculating the derivatives, then substituting in the equation and solving for $b_n$ I got $$b_n=\dfrac{c_n}{k-m\Big(\dfrac{n\pi}{L}\Big)^2}.$$ This solution is okay as long as denominator is different from zero for all $n$. However, if $\sqrt{\dfrac{k}{m}}$ is a multiple of $\dfrac{\pi}{L}$, then there will be some $n$ that will set the denominator to zero, and the particular solution will cease to exist. How to solve the equation in this case? I tried hard but I couldn't.

• Then you'll have a resonance solution looking like $t\cdot\cos t$ or something. – Ivan Neretin Dec 29 '17 at 17:55
• We only get this solution if $f(t)$ was sinusoidal, not any periodic function. – Tofi Dec 29 '17 at 19:05
• The general solution is $x(t)=\cos(\sqrt{\frac{k}{m}}t)x(0)+\sqrt{\frac{m}{k}}\sin(\sqrt{\frac{k}{m}}t) x'(0)+\frac{1}{\sqrt{mk}}\int_0^t{\sin\left(\sqrt{\frac{k}{m}}(t-s)\right)f(s)ds }$. You need the specific form of $f$ in order to calculate the integral. – RTJ Dec 29 '17 at 19:17
• @CTNT Great, can you refer me to the full solution please? – Tofi Dec 29 '17 at 19:41
• If $f$ is any periodic function, go expand it to Fourier series and do what you are already doing. All terms will be fine, except maybe one. I told you what to do with that one. Alternatively, do as CTNT says. It must end up the same. – Ivan Neretin Dec 29 '17 at 20:03

There is a solution for the case where $\sqrt{k/m}=N\pi/L$ for some integer $N$ iff $f$ is orthogonal in the $L^2$ sense to the homogeneous solutions $\sin(\sqrt{k/m}t)$, $\cos(\sqrt{k/m}t)$. You can see that this is necessary because $mx''+kx$ annihilates these elements. But it's also sufficient, which you can see by constructing the solution using the Fourier series.