I need help and explanation with this differential equation. Actually I really don't know how to solve just this type of equations. So the problem: $$y'' - y + 2\sin(x)=0$$ In my opinion first of all we solve homogeneous equation $y''-y=0$ and the solution of this is $y=c_1e^x+c_2e^{-x}$. And after that to solve it with $2\sin(x)$. From this point I need help.

  • $\begingroup$ Have you heard of the method of variation of parameters? $\endgroup$ May 7, 2019 at 8:49
  • $\begingroup$ Yes, I heard about this method. But I miss it at uni and now don't understand it. @KaviRamaMurthy $\endgroup$
    – Bambeil
    May 7, 2019 at 9:06
  • $\begingroup$ The idea is to pretend that $c_1$ and $c_2$ are functions, plugin $y=c_1e^{x}+c_2e^{-x}$ in to the given equation and try to get a first order DE. $\endgroup$ May 7, 2019 at 9:09
  • $\begingroup$ See sosmath.com/diffeq/second/variation/variation.html $\endgroup$ May 7, 2019 at 9:12

4 Answers 4


In this case there is a simple answer. You can just guess that $\sin\, x$ is a a particular solution so the general solution is $c_1e^{x}+c_2e^{-x}+\sin\, x$. In general you have to use the method of variation of parameters. (A search on Wikipedia will be useful).


Let $u=y+k\sin x$. Then $u''=y''-k\sin x$.

So, $y''-y+2\sin x=u''+k\sin x-u+k\sin x+2\sin x=0$

In particular, if $k=-1$, then $u''-u=0$.



You can use that $\sin x\propto e^{ix}-e^{-ix},$ and for any function $y=ae^{bx}$,



The given differential equation is

$y'' - y + 2\sin\ x=0$ $\implies y'' - y =- 2\sin x \implies (D^2 -1)y=- 2\sin x$

where $D \equiv \frac{d}{dx} $

I think you have an idea about how to find the Complementary Function (i.e., C.F.), (for your case, which is nothing but the solution of the homogeneous differential equation $y'' - y =0$).

Here C.F. is $c_1e^{x}+c_2e^{-x}$.

Now for the Particular Integral (i.e., P.I.) there are some general rules

If $f(D)$ can be expressed as $\phi(D^2)$ and $\phi(-a^2)\neq 0$, then

$1.$ $\frac{1}{f(D)} \sin ax=\frac{1}{\phi(D^2)} \sin ax = \frac{1}{\phi(-a^2)} \sin ax$

$2.$ $\frac{1}{f(D)} \cos ax=\frac{1}{\phi(D^2)} \cos ax = \frac{1}{\phi(-a^2)} \cos ax$

Note: If $f(D)$ can be expressed as $\phi(D^2)=D^2+a^2$, then $\phi(-a^2)= 0$.

$1.$ $\frac{1}{f(D)} \sin ax =\frac{1}{\phi(D^2)} \sin ax=x\frac{1}{\phi'(D^2)} \sin ax= x \frac{1}{2D} \sin ax= -\frac{x}{2a} \cos ax$.

$2.$ $\frac{1}{f(D)} \cos ax =\frac{1}{\phi(D^2)} \cos ax=x\frac{1}{\phi'(D^2)} \cos ax= x \frac{1}{2D} \cos ax= \frac{x}{2a} \sin ax$.

where $\phi'(D^2)\equiv\frac{d}{dD}\phi(D^2)$

So for your problem, P.I. is $\frac{1}{D^2 -1} (-2\sin x)=-2[\frac{1}{-1^2 -1} \sin x]= \sin x$

Hence the general solution is $y=$ C.F. $+$ P.I. $ = c_1e^{x}+c_2e^{-x}+\sin\, x$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .