Finding the general solution of the differential equation $\,\,y''+y=f(x)$
I am stuck with the following problem:
I have to show that the general solution of the differential equation $$y''+y=f(x)\,\, ,x \in (-\infty,\infty)$$, where $f$ is continuous real valued function on $(-\infty,\infty)$ is $$y(x)=A \cos x+B \sin x + \displaystyle \int_{0}^{x} f(t) \sin (x-t) dt\,\, $$ where $A,B$ are constants.
C.F. part of the reduced differential equation $y''+y=0$ is : $A \cos x+B \sin x$. But I am having trouble to get the P.I.(particular integral) which can be obtained by solving $$\frac {1}{D^2+1} f(x)$$,where $D \equiv \frac {d}{dx}$. This is where I am stuck.
Am I going in the right direction? Can someone help?
Thanks and regards to all.
Solution 1:
Recalling the Laplace transform of a function $f$
$$ F(s) = \int_{0}^{\infty}f(x)\,e^{-sx}dx $$
Taking the Laplace transform of the ode
$$ y''+y=f(x) $$
yields
$$ s^2Y(s)+Y(s)-s \,y(0)-y'(0)=F(s) $$
$$ \implies Y(s)=\frac{y'(0)}{s^2+1}+\frac{y(0)s}{s^2+1}+\frac{F(s)}{s^2+1} $$
Now, we take the inverse Laplace transform of the above equation to get
$$ y(x) = A\sin(x)+B\cos(x)+ \int_{0}^{x} \sin(x-t)f(t)dt. $$
Notes:
1) $$ \mathcal{L}\,y^{(n)}(x) = s^n F(s) - \sum_{k=1}^{n} s^{k-1} f^{(n-k)}(0). $$
2) $$\mathcal{L} (\sin(x))=\frac{1}{s^2+1},\quad \mathcal{L} (\cos(x))=\frac{s}{s^2+1}$$
3) $$ \mathcal{L}^{-1}(F(s)G(s))=(f*g)(x). $$
Solution 2:
Observe that the solutions to the corresponding homogenous equation are sin x and cos x . Using variation of parameters will give you the required result. Wronskian of $\cos x $ and $\sin x$ is therefore $$ \begin{align} y_p&= \cos x\int_{0}^x f(t) (-\sin t) dt+\sin x\int_{0}^x f(t)\cos t dt \\ y_p&= \int_{0}^x f(t)[\sin x\cos t-\cos x\sin t]dt \\ y_p&=\int_{0}^x f(t)\sin (x-t) dt\\ \end{align} $$