Homework Help: Inhomogeneous differential equations

1. Sep 27, 2014

Maylis

1. The problem statement, all variables and given/known data
Solve the following ordinary differential equations, where $\alpha$, $\beta$, and $\lambda$ are constants.

$$\frac {dy}{dx} + \beta y = 0$$

$$\frac {dy}{dx} + \beta y + \alpha = 0$$

$$\frac {d^2y}{dx^2} - \lambda^2 y = 0$$

$$\frac {d^2y}{dx^2} + \lambda^2 y = 0$$

$$\frac {d^2y}{dx^2} - \lambda^2 y + \alpha = 0$$

2. Relevant equations

3. The attempt at a solution
It has been about two years since I've had to solve anything other than non-homogeneous, separable differential equations, so I am pretty rusty on this. I know I put 5 questions in one thread, but since this is an exercise just to make me remember some stuff I learned a couple years ago and long forgot, I am consolidating them here as to not have to post a few threads.

1.
$$\frac {dy}{dx} + \beta y = 0$$
$$\int \frac {dy}{y} = \int -\beta dx$$
$$ln |y| = -\beta x + C$$
Assume y > 0
$y = e^{-\beta x + c}$
$y = Ce^{-\beta x}$

2.
$$\frac {dy}{dx} + \beta y + \alpha = 0$$
for this one, I'm not sure since it is non-homogeneous.

3.
$$\frac {d^2y}{dx^2} - \lambda^2 y = 0$$
For this one,
$$\frac {d^2y}{dx^2} = \lambda^2y$$
$$\frac {d}{dx} \frac {dy}{dx} = \lambda^2y$$
From here I have an idea but I'm unsure this is legitimate math operations. How would I go about this one? I can see some similarity with problem 1

4.
$$\frac {d^2y}{dx^2} + \lambda^2 y = 0$$
I believe this one has some sort of known solution, although I wouldn't know how to get it
$y = Acos(\lambda x) + Bsin(\lambda x)$

5.
$$\frac {d^2y}{dx^2} - \lambda^2 y + \alpha = 0$$
once again non-homogeneous, and 2nd order nonetheless, so not sure what to do

Last edited: Sep 27, 2014
2. Sep 27, 2014

HallsofIvy

(2) is a separable equation. It can be written as $dy/dx= -\beta y- \alpha$ and then
$$\frac{dy}{\beta y+ \alpha}= dx$$
Integrate both sides.

None of (3), (4), or (5) are first order equations so none of the methods you seem to want to use will apply. They are, however, second order linear equations. Most introductory differential equations courses devote most of the time to those. Do you know what the "characteristic equation" is? Do you know how to find a "particular solution" to a linear non-homogeneous equation.

3. Sep 27, 2014

LCKurtz

@Maylis: These are all examples of constant coefficient linear differential equations, and can all be solved with the same technique. There are many online writeups about these DE's. One place to look is:
http://www.math.wisc.edu/~dummit/docs/diffeq_2_linear_differential_equations.pdf [Broken]

In particular look at sections 1.3 and 1.4.

Last edited by a moderator: May 7, 2017
4. Sep 28, 2014

Maylis

Thanks guys. I remember the terms characteristic equations and particular solutions, but it's just been too long for me to actually remember how to do it. I will look at that PDF. I had a feeling number with (2) that I could do what HallsOfIvy was saying

So for (2)

$$\int \frac{dy}{-\beta y - \alpha} = \int dx$$

$$\frac {-1}{\beta} ln|-\beta y - \alpha | = x + C$$

Assume $-\beta y - \alpha \gt 0$.

$$\frac {-1}{\beta} ln(-\beta y - \alpha) = x + C$$

$$-\beta y - \alpha = e^{-\beta x + C}$$

$$y = \frac {\alpha + Ce^{-\beta x}}{-\beta}$$

Last edited: Sep 28, 2014
5. Sep 28, 2014

Maylis

Hey LCKurtz,

Thanks a lot for the PDF, it is very helpful. However, I have a doubt, but before that I will post my solutions to the (3) and (4)
(3)
$$y'' - \lambda^2 y = 0$$
$$r^2 - \lambda^2 = 0$$
$$(r + \lambda)(r - \lambda) = 0$$
Solving for the roots of the characteristic equation,
$r_{1} = -\lambda$ and $r_{2} = \lambda$.

Therefore, the solution to this differential equation is
$$y = c_{1}e^{\lambda x}+c_{2}e^{-\lambda x}$$

For (4)
$$y'' + \lambda^2 y = 0$$
$$r^2 + \lambda^2 = 0$$
The roots of the characteristic equation are
$r_{1} = \lambda i$ and $r_{2} = -\lambda i$.

Using Euler's formula
$e^{r_{1}x} = cos(\lambda x) + i \hspace{0.05 in} sin(\lambda x)$
$e^{r_{2}x} = cos(\lambda x) - i \hspace{0.05 in} sin(\lambda x)$

yields

$$y = c_{1}cos(\lambda x) + c_{2}sin(\lambda x)$$

Okay, so hoping that those are right, now I look at a specific example in the PDF

$$y'' + 4y = 0$$

Okay, first of all, is it just me or does it seem that the characteristic equation for $y'' + 4y = 0$ and $y'' + 4 = 0$ are identical? Or am I missing something. Anyways,

they go on and find $r_{1} = 2i$ and $r_{2} = -2i$, then they say

$$e^{r_{1}x} = cos(2x) + i \hspace{0.05 in} sin(2x)$$
$$e^{r_{2}x} = cos(2x) - i \hspace{0.05 in} sin(2x)$$

Then conclude that the solution is
$$y = c_{1}cos(2x) + c_{2}sin(2x)$$

Now I assume this is exactly like before, where the solution would be $y = c_{1}e^{r_{1}x} + c_{2}e^{r_{2}x}$. But if do this,

$$y = c_{1}(cos(2x) + i \hspace{0.05 in} sin(2x)) + c_{2}(cos(2x) - i \hspace{0.05 in} sin(2x))$$

How does that simplify to the solution given??

Last edited: Sep 28, 2014
6. Sep 28, 2014

Maylis

For (5),

$$y'' - \lambda^2 y + \alpha = 0$$
I get
$$y'' - \lambda^2 y = -\alpha$$
Using the result from (3), the general solution is
$$y_{g} = c_{1}e^{\lambda x} + c_{2}e^{-\lambda x}$$

Now I have to use my brain to guess for the particular solution (undetermined coefficients), and I come up with this
$y_{p} = A$
$y'_{p} = 0$
$y''_{p} = 0$

Then plug back into the original differential equation
$$0 -\lambda^2 A = -\alpha$$
and conclude that $A = \frac {\alpha}{\lambda^2}$. Combining the general and particular solution, I get

$$y = c_{1}e^{\lambda x} + c_{2}e^{-\lambda x} + \frac {\alpha}{\lambda^2}$$

7. Sep 28, 2014

pasmith

Let $C_1 = c_1 + c_2$ and $C_2 = i(c_1 - c_2)$. Then $$c_1(\cos(2x) + i\sin(2x)) + c_2(\cos(2x) - i\sin(2x)) = C_1 \cos(2x) + C_2\sin(2x).$$ If you want $y$ to be real, then you need $c_1$ and $c_2$ to be complex conjugates, so that $c_1 = A + iB$ and $c_2 = A - iB$ for real $A$ and $B$. Then $$C_1 = c_1 +c_2 = 2A \in \mathbb{R}, \\ C_2 = i(c_1 - c_2) = -2B \in \mathbb{R}.$$

8. Sep 28, 2014

Maylis

Hello pasmith,

Thanks for addressing that, it was not so obvious how they could equate the two. Are my solutions all good now? :)

9. Sep 28, 2014

vela

Staff Emeritus
The first DE is homogenous. The second one isn't because you move the 4 to the other side as it doesn't contain a $y$ or its derivatives. The characteristic equation therefore turns out to be just $r^2=0$.

I wouldn't call this the general solution. It's the homogeneous solution. The general solution is the sum of the homogeneous and particular solutions.

Last edited: Sep 29, 2014
10. Sep 28, 2014

LCKurtz

$y''+4=0$ is the same as $y''=-4$ and is a nonhomogeneous equation. The characteristic equation is $r^2=0$ giving $y_c = Ax + B$ for the homogeneous equation. Then you look for a particular solution for the NH equation (easy by inspection).

I think someone else already answered that. Also, in the case of distinct real roots, you may sometimes see the function pair $\{\cosh(\lambda x),\sinh(\lambda x)\}$ used instead of $\{e^{\lambda x},e^{-\lambda x}\}$.

Last edited: Sep 28, 2014
11. Sep 29, 2014

Maylis

Hello Vela,

I guess I should have used a different word (i.e. I moved alpha over) if you see the end of post #6, it is clear what my solution is. I believe you mistook that as my solution just doing one step of algebra

12. Sep 29, 2014

vela

Staff Emeritus
No, I just messed up the quote. I fixed it above. I was just correcting your terminology. Your solution looked fine.