# Solve differential equation dy/dx+ycos(x)= 4cos(x), y(0)=6

Solve differential equation $\frac{dy}{dx}+y\mathrm{cos}\left(x\right)=4\mathrm{cos}\left(x\right)$, y(0)=6

You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Alannej

$\frac{dy}{dx}+y\mathrm{cos}x=4\mathrm{cos}x$
That is $\frac{dy}{dx}+\left(\mathrm{cos}x\right)y=4\mathrm{cos}x$
$\frac{dy}{dx}+P\left(x\right)=Q\left(x\right)$
So $P\left(x\right)=\mathrm{cos}x$, $Q\left(x\right)=4\mathrm{cos}x$
Integrating factor is
$I.F.={e}^{\left(\int P\left(x\right)dx\right)}$
$={e}^{\int \mathrm{cos}xdx}$
$={e}^{\mathrm{sin}x}$
$y\cdot I.F.=\int Q\left(x\right)\cdot I.F.dx+c$
$y{e}^{\mathrm{sin}x}=\int 4\mathrm{cos}x{e}^{\mathrm{sin}x}dx+c$
$=4\int {e}^{\mathrm{sin}x}\mathrm{cos}xdx+c$
$=4\int {e}^{t}dt+c$ (by subtitution)
$=4{e}^{t}+c$
$y{e}^{\mathrm{sin}x}=4{e}^{\mathrm{sin}x}+c$
$y\left(x\right)=4{e}^{\mathrm{sin}x}+c$
Now apply the initial condition y(0)=6 in the general solution
$4{e}^{\mathrm{sin}\left(0\right)}+c=6$
$4{e}^{0}+c=6=>4+c=6$
c=6-4=2 Now substitute 2 for c in general solution
Thus,the particular solution is $y\left(x\right)=4{e}^{\mathrm{sin}x}+2$