What Makes the Undetermined Coefficients Method Fail with Sinusoidal Input?

• zenterix
zenterix
Homework Statement
Consider the non-homogeneous 2nd order linear differential equation with constant coefficients and sinusoidal input

$$y''+py'+qy=a_1\sin{bx}+a_2\cos{bx}$$
Relevant Equations
Note that the characteristic equation for the homogeneous equation is

$$r^2+pr+q=0\tag{1}$$

with discriminant

$$\Delta = p^2-4q\tag{2}$$
If ##p^2-4q<0## then we know that the homogeneous equation has a general solution

$$y_g(x)=c_1\sin{kx}+c_2\cos{kx}\tag{3}$$

where

$$k=\frac{1}{2}\sqrt{-\Delta}=\frac{\sqrt{4q-p^2}}{2}\tag{4}$$

Suppose we guess at a solution ##y_p## to the non-homogeneous equation

$$y_p(x)=A\sin{bx}+B\cos{bx}\tag{5}$$

If

$$b=k=\frac{\sqrt{4q-p^2}}{2}\tag{6}$$

then as far as I can tell, this guess should not work since subbing it into the nonhomogeneous equation should make the left-hand side identically zero, which is not equal to the sinusoidal input for all ##x##.

My question is if the reasoning above is correct. In particular, if (6) is indeed the condition that makes the above guess of ##y_p## fail.

I am asking because I have tried subbing (5) into the homogeneous equation the left-hand side doesn't seem to come out to zero.

Here is what I mean

Now, I straight up subbed in ##y_p## into the original differential equation without imposing any conditions.

However, in the final expression above, namely (11), it isn't clear at all what is required to make the expression zero.

Last edited:
zenterix said:
If ##p^2-4q<0## then we know that the homogeneous equation has a general solution

$$y_g(x)=c_1\sin{kx}+c_2\cos{kx}\tag{3}$$

where

$$k=\frac{1}{2}\sqrt{-\Delta}=\frac{\sqrt{4q-p^2}}{2}\tag{4}$$
Do we?

zenterix
Orodruin said:
Do we?
I think I forgot an exponential factor

$$y_g(x)=e^{-px/2}(c_1\sin{kx}+c_2\cos{kx})$$

Now the calculation seems correct.

zenterix said:
I think I forgot an exponential factor $$y_g(x)=e^{-px/2}(c_1\sin{kx}+c_2\cos{kx})$$
That's not one I would have chosen.

Since the solution to the homogeneous DE is ##y_h = c_1\sin(kx) + c_2\cos(kx)##, where ##k = \frac{\sqrt{4q - p^2}}2##, I would try to solve for A and B to get a particular solution of the form ##y_p = Ax\sin(kx) + Bx\cos(kx)##.

As a simpler but related example, suppose that the DE is y'' + y = sin(x).
The solution to the homogeneous equation is ##y_h = c_1\sin(x) + c_2\cos(x)##.
Suppose that a particular solution to the nonhomogeneous equation is ##y_p = Ax \sin(x) + Bx \cos(x)##.

I've worked this out (and checked it) to find that ##y_p = -\frac 1 2 x\cos(x)##. IOW, that ##y_p## satisfies ##y_p'' + y_p = \sin(x)##.

In the work you showed in Mathematica (or whatever software you used), I don't see anywhere that you stated that ##4q - p^2 \ge 0##. I don't see why multiplying by ##e^{-px/2}## would be a reasonable approach.

Mark44 said:
In the work you showed in Mathematica (or whatever software you used), I don't see anywhere that you stated that 4q−p2≥0. I don't see why multiplying by e−px/2 would be a reasonable approach.
Indeed, it has been bothering me as well that the result was zero without actually assuming that the discriminant is smaller than zero. Nonetheless, the software (Maple) does give zero.

I am here trying to figure out why.

To summarize the issue: it seems that a damped sinusoidal in which the angular frequency is ##\frac{\sqrt{-\Delta}}{2}## is a solution to the homogeneous equation even when the discriminant is positive.

Note that in this case the argument of the sine and cosine functions is complex. The following example illustrates all this.

The differential equation ##x''+8x'+7x=0## has positive discriminant ##\Delta =36## and thus two distinct real roots ##-1## and ##-7##.

If we let ##b=\frac{\sqrt{-\Delta}}{2}=\frac{\sqrt{-36}}{2}=3i## then

$$x(t)=e^{-pt/2}(A\sin{bt}+B\cos{bt})$$

is a solution.

Last edited:
zenterix said:
The differential equation ##x''+8x'+7x=0## has positive discriminant ##\Delta =36## and thus two distinct real roots ##-1## and ##-7##.
So far, so good. The general solution of this homogeneous, constant coefficient ODE is ##x(t) = c_1e^{-t} + c_2e^{-7t}##.
It's very easy to confirm that this indeed is the solution.
zenterix said:
If we let ##b=\frac{\sqrt{-\Delta}}{2}=\frac{\sqrt{-36}}{2}=3i## then
$$x(t)=A\sin{bt}+B\cos{bt}$$
is a solution.
That's not what your Maple output shows, which is ##x(t) = e^{-4t}(A\sinh(3t) + B\cosh(3t)##.

Notice that you omitted the ##e^{-4t}## factor above, as well as the hyperbolic trig functions.

Mark44 said:
That's not one I would have chosen.

Since the solution to the homogeneous DE is ##y_h = c_1\sin(kx) + c_2\cos(kx)##
But that’s the point. This isn’t a homogeneous solution. You need the exponential factor. Once it is there you will not get zero when you insert a constant amplitude sine as the particular solution. You solve for its phase and amplitude and then all is well (assuming ##p\neq0##). This is just a damped harmonic oscillator and if you drive it with a sine you get a constant amplitude sine as the long time solution.

Mark44 said:
I would try to solve for A and B to get a particular solution of the form ##y_p = Ax\sin(kx) + Bx\cos(kx)##.
This will not work. See above.

Mark44 said:
As a simpler but related example, suppose that the DE is y'' + y = sin(x).
The solution to the homogeneous equation is ##y_h = c_1\sin(x) + c_2\cos(x)##.
Suppose that a particular solution to the nonhomogeneous equation is ##y_p = Ax \sin(x) + Bx \cos(x)##.
This is an undamped HO. It is a particular case for which there is no exponential damping. This is why the amplitude of the long time solution grows, but for ##p \neq 0##, it will not.

Mark44 said:
So far, so good. The general solution of this homogeneous, constant coefficient ODE is ##x(t) = c_1e^{-t} + c_2e^{-7t}##.
It's very easy to confirm that this indeed is the solution.
That's not what your Maple output shows, which is ##x(t) = e^{-4t}(A\sinh(3t) + B\cosh(3t)##.

Notice that you omitted the ##e^{-4t}## factor above, as well as the hyperbolic trig functions.
Indeed I forgot the exponential again.

As for your comment on hyperbolic trig functions, note that the command in question subs into the original DE the proposed solution ##x(t)=e^{-4t}(A\sin{3it}+B\cos{3it})##.

Maple outputs a long output that includes hyperbolic trig functions but when I ask it to simplify the output it is simply 0.

So I didn't omit any hyperbolic trig functions. Those are only there because that is how Maple is choosing to represent the expression after the substitution of the ##x(t)## which does not contain hyperbolic trig functions.

Last edited:
Orodruin said:
But that’s the point. This isn’t a homogeneous solution.
You're right. I saw that forcing function on the right side and went on autopilot, thinking that the homogeneous equation was one of undamped harmonic behavior. The last time I taught a class in DE was about 25 years ago, so I'm a bit rusty.

@zenterix, sorry for the confusing comments...

Looking back at everything I wrote, it seems I have been very confused and basically wrong in all the previous posts above.

Let me try to reason about everything again.

We have a 2nd order linear differential equation with sinusoidal input

$$y''+py'+qy=a_1\sin{bx}+a_2\cos{bx}\tag{1}$$

To find a particular solution, we can use the method of undetermined coefficients and guess a solution

$$y_p(x)=A\sin{bx}+B\cos{bx}$$

My original underlying question was: when does this guess not work?

It doesn't work if the guess is a solution to the homogeneous equation. And when does this happen?

Let's see. The guess is a sinusoid. A sinusoid is a solution to the homogeneous equation when the latter is represents a simple harmonic oscillator. That is, when ##p=0## in (1).

In this case the solution sinusoid is

$$c_1\sin{(\sqrt{q}x)}+c_2\cos{(\sqrt{q}x)}$$

Thus, if the angular frequency of the input, namely ##b##, is such that ##b=\sqrt{q}## then our guess will be

$$y_p(x)=A\sin{bx}+B\cos{bx}=A\sin{(\sqrt{q}x)}+B\cos{(\sqrt{q}x)}$$

which is a solution to the homogeneous equation.

zenterix said:
My original underlying question was: when does this guess not work?
When ##p = 0##. The reason, as @Mark44 hinted at, is that you then have an undamped harmonic oscillator. If you solve for ##p \neq 0## and take the limit, this will manifest itself as a diverging amplitude as p goes to zero.

Clearly the method fails when the right hand side is a homogenous solution, since varying the coefficients just gives you another homogenous solution.

zenterix said:
The differential equation ##x''+8x'+7x=0## has positive discriminant ##\Delta =36## and thus two distinct real roots ##-1## and ##-7##.

If we let ##b=\frac{\sqrt{-\Delta}}{2}=\frac{\sqrt{-36}}{2}=3i## then
##x(t)=e^{-pt/2}(A\sin{bt}+B\cos{bt})## is a solution.
To fill in what you left out in this example, the basic assumption in this type of ODE (linear, constant coefficient, homogeneous) is that ##x(t) = e^{rt}## is a solution. Substituting this function into the given DE brings us to ##(r^2 + 8r + 7)e^{rt} = 0##. Since the left side must be zero for all t, it must be the case that ##r^2 + 8r + 7 = 0##. Factoring the quadratic gives us the two basis functions ##x_1(t) = e^{-t}## and ##x_2(t) = e^{-7t}##. The general solution of the DE here is all linear combinations of these two basis functions.

An example of an ODE that is closer to the one you started the thread with than my previous example is this: x'' - 2x' + 2x = 0.
The characteristic equation here is ##r^2 - 2r + 2 = 0##, for which the roots are ##r = 1 \pm i##. From these roots, the two basis functions are ##x(t) = e^{(1 \pm i)t}##. These can be rewritten as ##x(t) = e^te^{\pm it}##. Euler's formula allows us to rewrite this as ##x(t) = e^t (\cos(t) \pm i\sin(t))##. By choosing appropriate multiples of these two functions, we can end up with two basis functions of ##x_1(t) = e^t\cos(t)## and ##x_2(t) = e^t\sin(t)##.

• Calculus and Beyond Homework Help
Replies
7
Views
690
• Calculus and Beyond Homework Help
Replies
3
Views
991
• Calculus and Beyond Homework Help
Replies
7
Views
965
• Calculus and Beyond Homework Help
Replies
15
Views
2K
• Calculus and Beyond Homework Help
Replies
1
Views
540
• Calculus and Beyond Homework Help
Replies
7
Views
2K
• Calculus and Beyond Homework Help
Replies
4
Views
2K
• Calculus and Beyond Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
8
Views
503
• Calculus and Beyond Homework Help
Replies
4
Views
1K