# Homework Help: Non-homogenous differential equation

1. Jun 27, 2010

### James889

Hi,

My memory ran away, i completely forgot how to do this =/

I need to solve
$$y'' + 4y = tsint,~~y(0) = 0,~y'(0) = 1$$

with the general solution $$C_1sin(2t) + C_2cos(2t)$$

$$y = Atsin(t) +Btcos(t)$$

$$y' = Asin(t) + Atcos(t) +Bcos(t) -Btcos(t)$$

$$y'' = Acos(t) + Acos(t) -Atsin(t) - Bsin(t) -Bsin(t) -Btsin(t)$$

substitute back into the first equation:

$$2Acos(t) - 2Bsin(t) + 3Atsin(t) + 3Btcos(t)$$

So if i let A be $$1/3$$ i get $$2/3cos(t) + tsin(t)$$

How did you determine the $$C_1$$ and $$C_2$$ constants ?

2. Jun 27, 2010

### Staff: Mentor

Your particular solution needs two more terms:
yp = Asin(t) + Bcos(t) + Ctsin(t) + Dtcos(t)
From the initial conditions.

3. Jun 27, 2010

### James889

ARGH!

I struggled with this all day trying to figure out what i did wrong..

4. Jun 27, 2010

### James889

Right

$$y = ASin(t) + BCos(t) +CtSin(t) + DtCos(t)$$

$$y' = ACos(t) - BSin(t) + CSin(t) + CtCos(t) + DCos(t) -DtSin(t)$$

$$y'' = -ASin(t) -BCos(t) + CCos(t) +CCos(t) -CtSin(t) - DSin(t) - DSin(t) -DtCos(t)$$

$$= -ASin(t) - BCos(t) +2CCos(t) -2DSin(t) -CtSin(t) -DtCos(t)$$

$$3ASin(t) + 3BCos(t) - 2DSin(t) + 2CCos(t) + 3CtSin(t) + 3DtCos(t)$$

So $$C = 1/3$$
and $$B = -2/9$$

But this does not satisfy y(0) = 0

5. Jun 27, 2010

### Staff: Mentor

This is your particular solution. The general solution is the solution to the homogeneous problem (you miscalled it the general solution) plus the particular solution. Use the general solution and the initial conditions to find C1 and C2.

6. Jun 27, 2010

### gomunkul51

James889:

If you have problem finding the particular solution using Undetermined Coefficients method,
you can always try using the inginiuos Variation of Parameters by Lagrange ;)

y1(x), y2(x) : are two linearly independent homogeneous solutions.
g(x) : the particular expression, in your case = x*sin(x).

u'1(x)*y1(x) + u'2(x)*y2(x) = 0
u'1'(x)*y'1(x) + u'2(x)*y'2(x) = g(x)

solve the system of equations and find u1(x) and u2(x) by integration.
the particular part of the answer will be:

Y(x) = u1(x)*y1(x) + u2(x)*y2(x).

the complete answer for the ODE (A,B are constants):

y(x) = [A*y1(x)] + [B*y1(x)] + [u1(x)*y1(x) + u2(x)*y2(x)].

*Lagrange was a genius !

7. Jun 29, 2010

### James889

Hm,
So if i put
$$y =\frac{t}{3}sin~t - \frac{2}{9}cos~t + C_1sin(2t) + C_2cos(2t)$$

for the condition y(0) = 0 $$C_2 = \frac{2}{9}$$

then i have
$$y' = \frac{t}{3}cos~t + \frac{2}{9}sin~t + 2C_1cos(2t) -2C_2sin(2t)$$

and for
$$y'(0) = 1$$

$$\frac{1}{3} + 2C_1 = 1, \rightarrow C_1 = \frac{2}{6}$$

Is this correct?

8. Jun 29, 2010

### Staff: Mentor

Check it for yourself. You have y = (1/3) tsin(t) - (2/9) cos(t) + (1/3) sin(2t) + (2/9) cos(2t).

This is the solution if
1) it satisfies the initial conditions y(0) = 0 and y'(0) = 1, and
2) it satisfies the diff. equation y'' + 4y = tsin(t).