5
$\begingroup$

Solve $y''+y=\cos x$.

After first solving the homogeneous equation we know that the solution to it is $y=c_1\cos x+c_2\sin x$.

We can guess that the private solution to non-homogeneous equation will be of form: $y_p=x(A_1\cos x+A_2\sin x)$.

Then: $$ y_p'=A_1\cos x-A_1x\sin x+A_2\sin x+A_2x\cos x\\ y_p''=-2A_1\sin x-A_1x\cos x+2A_2\cos x-A_2x\sin x $$ If we plug these into the original equation we get: $$ \cos x(A_1+A_2x-A_1x+2A_2)+\sin x(A_2-A_1-2A_2-A_2x)=\cos x \quad\ast $$ We can try to solve the system: $$ \begin{cases} x(A_2-A_1)+A_1+2A_2=1\\ x(-A_1-A_2)+A_2-2A_1=0 \end{cases} $$ But there're 3 unknowns in the system so I don't see how to find out the values of $A_1$ and $A_2$.

The solution says that we get $2(A_2\cos x-A_1\sin x)=\cos x$ from which is follows that $A_1=0$ and $A_2=0.5$. But how do we get to this conclusion? Is there some trick I missed?

I checked my calculations in Wolfram Alpha and they match.

$\endgroup$
7
  • 2
    $\begingroup$ There are two unknowns, $A_{1}$ and $A_{2}$. $x$ is the parameter of your function. It's not an unknown, because it doesn't have a definite value. $\endgroup$ Commented Aug 4, 2017 at 13:39
  • 2
    $\begingroup$ try it with $$A\cos(x)+Bx\sin(x)$$ $\endgroup$ Commented Aug 4, 2017 at 13:39
  • $\begingroup$ @T.Linnell does this fact let me solve the system? $\endgroup$
    – Yos
    Commented Aug 4, 2017 at 13:41
  • 1
    $\begingroup$ Yes. You have two independent equations and two unknowns, so you can find both. However, I'm not sure $x$ should even be in those equations. You should treat the $\cos{x}$, $x\cos{x}$, $\sin{x}$, and $x\sin{x}$ terms all differently, which would give you 4 equations. And looking at those 4 equations, it looks like something's gone wrong in your calculations. I think you've written $y''+y'=\cos{x}$, but isn't the original ODE $y''+y=\cos{x}$? $\endgroup$ Commented Aug 4, 2017 at 13:42
  • 1
    $\begingroup$ Just as an aside, it is a lot easier to identify $y$ here as $Re(z)$ where $z''+z=e^{ix}$. $\endgroup$
    – Ian
    Commented Aug 4, 2017 at 14:36

3 Answers 3

3
$\begingroup$

So the corresponding auxiliary equation to $y''+y=\cos x$ is $m^2+1=0$, so $$y_c=c_1 \cos x + c_2 \sin x,$$ so things are fine so far. Now since our RHS is $\cos x$, like you said, we assume that the particular solution is of the form $A \sin x+B \cos x$. But since $A\sin x$ is already accounted for in $y_c$, we take $Ax \sin x+Bx \cos x$. Thus,

\begin{cases} y_p=Ax \sin x+Bx \cos x \\ {y_p}'=Ax \cos x+B \cos x-Bx \sin x +A \sin x \\ {y_p}''= -Bx \cos x+2A \cos x-Ax\sin x-2B \sin x \end{cases}

$\implies \left( -Bx \cos x+2A \cos x-Ax\sin x-2B \sin x \right) + \left( Ax \sin x+Bx \cos x \right) = \cos x$

$\implies 2A \cos x - 2B \sin x = \cos x \implies \begin{cases} A=\frac{1}{2} \\ B =0 \end{cases}$

Therefore our solution $y=y_c + y_p$ is $$y=c_1 \cos x + c_2 \sin x+\frac{1}{2}x \sin x.$$

$\endgroup$
2
$\begingroup$

Rewrite your last equation

$$2(A_2\cos x-A_1\sin x)=\cos x$$

as

$$2A_2 \cos x - 2 A_1 \sin x = 1 \cdot \cos x + 0 \cdot \sin x$$

From here equate coefficients of like terms on both sides: $2 A_2 = 1$ and $-2A_1 = 0$.

$\endgroup$
2
  • $\begingroup$ OP is asking how to derive your first equation. $\endgroup$ Commented Aug 4, 2017 at 14:35
  • $\begingroup$ What is the equation you're referring to, the one with the asterisk? My mistake was calculating $y''+y'=\cos x$ instead of calculating $y''+y=\cos x$, please mention this in your answer. $\endgroup$
    – Yos
    Commented Aug 4, 2017 at 14:35
1
$\begingroup$

Your starred equation is not correct. You plugged in the terms from $y'_p$ instead of $y_p$. If you plug into the original equation, you should get $$x(A_1\cos x + A_2 \sin x)-2A_1\sin x-A_1x\cos x+2A_2\cos x-A_2x\sin x=\cos x$$ from which the terms proportional to $x$ cancel, leaving $$-2A_1 \sin x+2A_2\cos x =\cos x$$ as desired.

$\endgroup$

You must log in to answer this question.

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