I have a first-order linear ODE:

$$u'=-2u+y\sin(x)$$ where $$u(0)=y^2$$ basically it is the PDE $$u_x=-2u+y\sin(x)$$ Where we are looking on it as an ODE

What I have done is to solve the homogenous equation using $$y_h=e^{-\int p(x)dx}$$ and then looking at the particular solution:

$$y_p=c(x)e^{-\int p(x)dx}$$

Deriving it, plug it in back to the ODE and got a correct solution using superposition and initial condition.

In the book they wrote right away that the particular solution is $$y_p=A\sin x+B\cos x$$

Why/How can they do it?

  • 1
    $\begingroup$ If you do not show us the differential equation problem, there is no way anyone could tell you how. $\endgroup$ – Rebellos Nov 26 '19 at 16:19
  • $\begingroup$ @Rebellos Added the ODE $\endgroup$ – newhere Nov 26 '19 at 16:26
  • $\begingroup$ If $u$ is a linear combination of $\sin x$ and $\cos x$, then so is $u'$. But $\sin x,\cos x$ are not solutions to $u'+2u$, so $u'+2u$ is not zero. Hence $u'+2u=A'\cos x+B'\sin x$ where $A',B'$ are linear functions of $A,B$. So now one just determines which $A,B$ give $A'=0$ and $B'=y$. (Note that this logic would work for $u'+p u = q \sin x$ as well, so long as $p\neq 1$.) $\endgroup$ – Semiclassical Nov 26 '19 at 16:36

$$y'+p(x)y=q(x)$$ When you have on the right side $( q(x))$ a cosine or a sine you try as a particular solution a combinaison of both $A\cos(x)+B\sin(x)$. This is true as long as cosine and sine aren't solution of the homogeneous equation. If they are solution you have to multiply by $x$ the particular solution for a first order DE.This method is known as Method of Undetermined Coefficients ( link https://www.efunda.com/math/ode/linearode_undeterminedcoeff.cfm )

Here I integrate both side. $$u_x=-2u+y\sin(x)$$ $$u_x+2u=y\sin(x)$$ Integrating factor is $\mu(x) = e^{2x}$ $$(ue^{2x})'=y\sin(x)e^{2x}$$ Integrate $$ue^{2x}=y\int \sin(x)e^{2x}dx$$ Evaluate the integral by part $$I=-\frac 1 5e^{2x}(\cos(x)-2\sin(x))+C(y)$$ $$ue^{2x}=-\frac y 5e^{2x}(\cos(x)-2\sin(x))+C(y)$$ $$u=\frac y 5(-\cos(x)+2\sin(x))+C(y)e^{-2x}$$


Rewrite the ODE as


by which the homogeneous equation is


solving the characteristic equation produces the root of $r=-2$. So, the homogeneous solution is


To find the particular solution, you need to analyze the nonhomogenuous equation


where the right hand side of this equation contains a $y$ multiplied by the sine function. Since you have constant coefficients on the left hand side, and the sine function on the right hand side, you can apply the Method of Undertermined Coefficients. The initial guess is


which is linearly independent with the homogenuous solution of $e^{-2x}$, so you don't need to multiply by an additional power of $x$.

The reason why you can make the guess $A\cos(x)+B\sin(x)$ is because the the left hand side of


contains constant coefficients (one times $u'$ and two times $u$) and the right hand side contains $y$ multiplied by the sine function. If the right hand side contains either sine or cosine, then you need to guess a constant times sine and a different constant times cosine. We are able to use the Method of Undetermined Coefficients because our ODE matches the form



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.