# Second Order Inhomogeneous ODE.

1. May 6, 2010

### Je m'appelle

1. The problem statement, all variables and given/known data
Solve the following equation

$$f'' - 3f' + 2f = 3$$

For

$$f(0) = 0,\ and\ f'(0) = 1$$

2. Relevant equations

None.

3. The attempt at a solution
Ok, so, I know how to solve inhomogeneous ODEs when it's on this form

$$af'' + bf' + cf = g$$

Where $$g$$ is a given function.

But how do I proceed when I find a constant instead of a function on the right hand side of the equation?

I'm really confused here.

2. May 6, 2010

### LCKurtz

If you really must have an x on the right side, think of your function as 3 + 0x.

In other words, work it the same way.

3. May 6, 2010

### Je m'appelle

Ok, so I saw this example in the book

$$f'' + f' - 2f = x^2$$

And then the particular solution $$f_p$$ was found by the following process

$$As\ g(x) = x^2\ is\ a\ second\ degree\ polynomial\ we'll\ look\ for\ a\ solution\ like$$

$$f_p = Ax^2 + Bx + C$$

Then

$$\frac{df_p}{dx} = 2Ax + B,\ \frac{d^2 f_p}{dx^2} = 2A$$

We'll plug-in the derivatives of $$f_p$$ in the original equation

$$f'' + f' - 2f = x^2$$

$$(2A) + (2Ax + B) - 2(Ax^2 + Bx + C) = x^2$$

$$-2Ax^2 + x(2A - 2B) + (2A + B - 2C) = x^2 + 0x + 0$$

Then

$$A = \frac{-1}{2},\ B = \frac{-1}{2},\ C = \frac{-3}{4}$$

So,

$$f_p = \frac{-x^2}{2} - \frac{x}{2} - \frac{3}{4}$$

And I tried this same method in my original post, by using $$3 = 3x^0$$, but it did not work.

4. May 6, 2010

### Staff: Mentor

You are making this much more complicated than it needs to be. Try yp = C. Don't forget that you need to solve the homogeneous problem f'' - 3f' + 2f = 0. The solution to the homogeneous problem, plus the particular solution, will be your general solution.

5. May 6, 2010

### Je m'appelle

Ok, so, by considering $$f_p = C$$ just as you said, I got $$f_p = \frac{3}{2}$$, and it worked!

Then the general solution will be:

$$f(x) = A_1e^{x} + A_2e^{2x} + f_p$$

$$f(x) = A_1e^{x} + A_2e^{2x} + \frac{3}{2}$$

I won't bother you folks showing all the work done to find $$A_1$$ and $$A_2$$, but I eventually got to

$$A_1 = -4,\ and\ A_2 = \frac{5}{2}$$

$$f(x) = -4e^{x} + \frac{5}{2}e^{2x} + \frac{3}{2}$$

Let's verify it by plugging-in the above function in the original equation,

$$f'' - 3f' + 2f = 3$$

Where,

$$\frac{df(x)}{dx} = -4e^x + 5e^{2x}$$

$$\frac{d^2 f(x)}{dx^2} = -4e^x + 10e^{2x}$$

$$(-4e^x + 10e^{2x}) - 3(-4e^x + 5e^{2x}) + 2(-4e^{x} + \frac{5}{2}e^{2x} + \frac{3}{2}) = 3$$

$$-4e^x + 10e^{2x} + 12e^x - 15e^{2x} - 8e^x + 5e^{2x} + 3 = 3$$

$$(-4e^x + 12e^x - 8e^x) + (10e^{2x} - 15e^{2x} + 5e^{2x}) + 3 = 3$$

Indeed, $$3 = 3$$

This is pathetically easy, my god.. I don't even know how or why I complicated it so much.

Thank you very much for your time $$LCKurtz$$ and $$Mark44$$.

6. May 6, 2010

### Staff: Mentor

They can get much more complicated in a hurry. The best practice is to solve the homogeneous problem first, since the homogeneous solutions can impact your choices for your particular solution.

For example, if the equation had been y'' - y' = 3, your particular solution would NOT have been a constant.