# Particular solution to a non-homogenous differential equation

Consider the following ODE:

$$\frac{d^2 x}{dt^2} + kx = f(t)$$

where $$f(t) = \frac{1}{2} -2 \pi \sum_{n = 1}^{\infty}{n\sin\left(\frac{n \pi t}{2}\right)}$$ was derived using fourier series.

What is the particular solution to this? The sum symbol on the right hand side confuses me and I don't know how to handle a sum in this case.

I thought to try this for a guess:

$$x(t) = A_2t + A_0 - Bcos(\frac{n \pi t}{2}) - Csin(\frac{n \pi t}{2})$$

• I think you mean $\frac{d^{2}x}{dt^{2}}$ – mattos Dec 12 '15 at 14:38
• @Mattos Yes! Thank you :) – DoubleOseven Dec 12 '15 at 14:38
• Do you know how to find the particular solution to ODEs? – mattos Dec 12 '15 at 14:41
• @Mattos Yes, i do! I thought to try $x(t) = A_2t + A_0 - Bcos(\frac{n \pi t}{2}) - Csin(\frac{n \pi t}{2})$ but I am not sure if that is the correct guess because the sum symbol on the right hand side confuses me – DoubleOseven Dec 12 '15 at 14:43

My personal favorite method for finding particular solutions, because it's more or less algorithmic, is variation of parameters. You can look up the details, but basically if $x_1(t)$ and $x_2(t)$ are the two elementary solutions to the associated homogeneous equation, then the particular solution may be written $$x_p(t) = \left(-\int\frac{x_2(t)f(t)}{W(t)}dt\right)x_1 + \left(\int\frac{x_1(t)f(t)}{W(t)}dt\right)x_2$$ where $W(t) = x_1x'_2 - x'_1x_2$ is the Wronskian of the two solutions. For this problem, the elementary solutions are by inspection $x_1(t) = \sin(\sqrt{k}t)$ and $x_2(t) = \cos(\sqrt{k}t)$. So the first term in the formula I gave would be $$-\frac{1}{\sqrt{k}}\int\cos(\sqrt{k}t)dt\left( \frac{1}{2} - 2\pi\sum_{n=0}^\infty n\sin\left(\frac{n\pi t}{2}\right) \right)dt$$ $$=-\frac{1}{2\sqrt{k}}\int\cos(\sqrt{k}t)dt+\frac{2\pi}{\sqrt{k}}\sum_{n=0}^\infty n\int\cos(\sqrt{k}t)\sin\left( \frac{n\pi t}{2} \right)dt$$
Which you can integrate explicitly. An exactly similar calculation follows from the second term in $x_p(t)$.