# [SOLVED]Checking some linear ODE solutions

#### dwsmith

##### Well-known member
$y''+y = e^{it}+e^{3it}$

Solution

$y = Ae^{it}-\dfrac{1}{8}e^{3it}-\dfrac{it}{2}e^{it}$

and

$y''+4y=1+\sin t+\sin 2t$

Solution

$y=A\cos 2t + B\sin 2t + \dfrac{1}{4} + \dfrac{1}{3}\sin t - \dfrac{t}{4}\cos 2t$

Correct?

#### Sudharaka

##### Well-known member
MHB Math Helper
Hi dwsmith,

$y''+y = e^{it}+e^{3it}$

Solution

$y = Ae^{it}-\dfrac{1}{8}e^{3it}-\dfrac{it}{2}e^{it}$

This seem to be incorrect. There should be two arbitrary constants since that is a second order differential equation. The correct solution can be found here.

$y''+4y=1+\sin t+\sin 2t$

Solution

$y=A\cos 2t + B\sin 2t + \dfrac{1}{4} + \dfrac{1}{3}\sin t - \dfrac{t}{4}\cos 2t$

Correct?
This seems correct. See this.

Kind Regards,
Sudharaka.

#### CaptainBlack

##### Well-known member
$y''+y = e^{it}+e^{3it}$

Solution

$y = Ae^{it}-\dfrac{1}{8}e^{3it}-\dfrac{it}{2}e^{it}$
When you solve inhomogeneous linear constant coefficient ODE's you start with the general solution to the homogeneous equation, which in this case is:

$$y''+y=0$$

You use a trial solution $$y=e^{\lambda t}$$ and get the charateristic equation $$\lambda^2+1=0$$, which has roots $$\lambda=\pm i$$.

So the general solution to the homogeneous equation is $$y=Ae^{it}+Be^{-it}$$, and you get the general solution to the inhomogeneous equation by adding a particular integral of the equation to this.

Note this solution could also be expressed in terms of trig functions like your next example.

(Also it would be helpful if you posted the full question/s with the original wording).

CB

#### dwsmith

##### Well-known member
Online Mathematica says the solution is $y=A\cos t + B\sin t -\dfrac{it}{2}e^{it} + \dfrac{1}{4}e^{it} - \dfrac{1}{8}e^{3it}$.

However, I can't obtain it.

So $y_c = Ce^{\pm it} = A\cos t + B\sin t$

If we re-write the problem, we have
$$y''+y=\cos t + \sin t + e^{3it}$$
Then the form of $y_p = c_1t\cos t + c_2t\sin t + c_3e^{3it}$

$y''_p=-2c_1\sin t + 2c_2\cos t - c_1t\cos t -c_2t\sin t - 9c_3e^{3it}$

Then
$$y''+y = -2c_1\sin t +2c_2\cos t -8c_3e^{3it}$$
So $c_1 = \dfrac{-1}{2}$, $c_2 = \dfrac{1}{2}$, and $c_3 = -\dfrac{1}{8}$

Therefore, $y_p = \dfrac{-t}{2}\cos t + \dfrac{t}{2}\sin t - \dfrac{1}{8}e^{3it}$

So
$$y=y_c+y_p=A\cos t + B\sin t-\dfrac{t}{2}\cos t + \dfrac{t}{2}\sin t - \dfrac{1}{8}e^{3it}$$

So what is going wrong?

#### Sudharaka

##### Well-known member
MHB Math Helper
If we re-write the problem, we have
$y''+y=\cos t + \sin t + e^{3it}$
Hi dwsmith,

This is incorrect. You are missing an $$i$$. The correct expression is,

$y''+y=\cos t + i\sin t + e^{3it}$

Kind Regards,
Sudharaka.

#### CaptainBlack

##### Well-known member
Online Mathematica says the solution is $y=A\cos t + B\sin t -\dfrac{it}{2}e^{it} + \dfrac{1}{4}e^{it} - \dfrac{1}{8}e^{3it}$.
That is the same thing as:

$y=Ce^{it}+De^{-it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}=Ee^{it}+De^{-it}+\frac{1}{4}e^{it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

To show this write the first two exponentials on the left in Cartesian form, and remember that the coefficients are arbitrary so (most) any transformation you need applied to them still leave you with arbitrary coefficients (also note that they may be complex).

CB

#### dwsmith

##### Well-known member
I don't see how the term with the 1/4 appears at all.

Writing the equation as $y''+y = \cos t + i\sin t + e^{3it}$ didn't produce anything promising.

Then $y_p = c_1t\cos t + c_2it\sin t + c_3e^{3it}$ so $y''_p = -2c_1\sin t - c_1t\cos t +2c_2i\cos t - c_2it\sin t -9c_3e^{3it}$.

$y''_p+y_p = 2c_2i\cos t - 2c_1\sin t - 8c_3e^{3it}$

So $c_1 = -1/2$, $c_2 = -i/2$, and $c_3 = -1/8$.

$$y_p = -1/2t\cos t + 1/2t\sin t -1/8e^{3it}$$

#### Sudharaka

##### Well-known member
MHB Math Helper
I don't see how the term with the 1/4 appears at all.

Writing the equation as $y''+y = \cos t + i\sin t + e^{3it}$ didn't produce anything promising.

Then $y_p = c_1t\cos t + c_2it\sin t + c_3e^{3it}$ so $y''_p = -2c_1\sin t - c_1t\cos t +2c_2i\cos t - c_2it\sin t -9c_3e^{3it}$.

$y''_p+y_p = 2c_2i\cos t - 2c_1\sin t - 8c_3e^{3it}$

So $c_1 = -1/2$, $c_2 = -i/2$, and $c_3 = -1/8$.

$$y_p = -1/2t\cos t + 1/2t\sin t -1/8e^{3it}$$
The coefficient $$c_{1}$$ is incorrect. It should be, $$c_{1}=-\dfrac{i}{2}$$. Then you will get,

$y_p = -\frac{it}{2}\cos t + \frac{t}{2}\sin t -\frac{1}{8}e^{3it}$

$y_p = -\frac{it}{2}e^{it} -\frac{1}{8}e^{3it}$

The general solution is,

$y=Ce^{it}+De^{-it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

This can be written as,

$y=\left(C-\frac{1}{4}+\frac{1}{4}\right)e^{it}+De^{-it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

$\therefore y=\left(C-\frac{1}{4}\right)e^{it}+De^{-it}+\frac{1}{4}e^{it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

Let $$\displaystyle E=\left(C-\frac{1}{4}\right)$$. Then,

$y=Ee^{it}+De^{-it}+\frac{1}{4}e^{it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

#### dwsmith

##### Well-known member
The coefficient $$c_{1}$$ is incorrect. It should be, $$c_{1}=-\dfrac{i}{2}$$. Then you will get,

$y_p = -\frac{it}{2}\cos t + \frac{t}{2}\sin t -\frac{1}{8}e^{3it}$

$y_p = -\frac{it}{2}e^{it} -\frac{1}{8}e^{3it}$

The general solution is,

$y=Ce^{it}+De^{-it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

This can be written as,

$y=\left(C-\frac{1}{4}+\frac{1}{4}\right)e^{it}+De^{-it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

$\therefore y=\left(C-\frac{1}{4}\right)e^{it}+De^{-it}+\frac{1}{4}e^{it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

Let $$\displaystyle E=\left(C-\frac{1}{4}\right)$$. Then,

$y=Ee^{it}+De^{-it}+\frac{1}{4}e^{it}-\frac{1}{8}e^{3it}-\frac{it}{2}e^{it}$

So the only thing wrong with my original solution was that it was missing $Be^{-it}$ then. Why didn't you all say that to begin with?