Particular solution for a first-order linear ODE

ordinary differential equationspartial differential equations

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?

Best Answer

$$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}$$

Related Question