Nonhomogeneous LODEs with constant coefficients
In Section 13.2 we solved the homogeneous equation with constant coefficients, i.e. Eq. (13.18) through the associated characteristic equation. Here, we look at solutions to the nonhomogeneous equation given by Eq. (13.1). This section focuses on the method of undetermined coefficients (MUC), which applies to the case where in Eq. (13.1) are replaced by constants, and when has a finite number of linearly independent derivatives (see Subsec. 13.3.2 for details). The nonhomogeneous equation with constant coefficients is given by Eq. (13.62),
Before we proceed to see how to use the MUC to solve (13.62), let us look at the structure of the general solution to the nonhomogeneous ODE given by (13.1) without requiring that and are constants and without the restriction of finite linearly independent derivatives of .
Nonhomogeneous equations: general solution
The general solution to the nonhomogeneous ODE (13.1) is given as
where is the solution to the homogeneous ODE given by (13.2) and is any particular solution to the nonhomogeneous ODE (13.1). This general solution structure is true for any linear nonhomogeneous ODE.
Proof
Here, we show that given by (13.63) is a solution to Eq. (13.1). We start off by assuming that is a solution to the nonhomogeneous ODE so it satisfies Eq. (13.1). We also assume that whatever is, it should also satisfy Eq. (13.1) such that,
Now, take Eq. (13.64) and subtract it from (13.1):
Equation (13.65) looks like the homogeneous equation given by (13.2). This implies that must be a solution to the homogeneous ODE which, in turn, implies that the difference, must equal to (the solution to the homogeneous equation):
which is,
So, is a solution to the nonhomogeneous equation and it is made up of and as shown in Eq. (13.67). When solving the ODE (13.1), we need to first solve the homogeneous ODE (13.2) to obtain , and then find a particular solution so we can put it together with and form the general solution to the nonhomogeneous problem.
The method of undetermined coefficients
We are now ready to look for solutions to Eq. (13.62), where and are constants and . Note that sometimes the term is referred to as the forcing term.
When does the method work?
Before we introduce the method let us just state when it can be used. The MUC can only be used when:
- the ODE is linear (works for higher order LODEs as well);
- the coefficients of the derivatives of the function are constant (i.e. for second order, and are constants);
- consists of the following classes of functions:
(a) exponentials;
(b) sines & cosines;
(c) polynomials.
Sums and products of these functions work as well. These types of functions are the only ones that work with this method and the underlying reason has to do with linear independence. What all of the above classes of functions have in common is that they have a finite number of linearly independent derivatives. We refer to these functions as 'elementary' in these notes. For example, take the function and differentiate wrt a few times:
The functions and are linearly independent. The next order derivative i.e is linearly dependent to the original function. As an additional example consider the polynomial ; the first three derivatives are:
Each function produced by the next derivative is linearly independent to the previous ones; however the addition of the fourth derivative, which is equal to 0 , renders the set linearly dependent. Recall that you can check for linear independence using the Wronskian determinant (see Section 13.1.2). To contrast the above, consider the functions and ; these functions have an infinite number of linearly independent derivatives: as you differentiate them wrt , you obtain higher and higher powers of in the denominator.
The only functions that have the property of having a finite number of linearly independent derivatives are the three classes specified above. In what follows, we will look at examples where the forcing term, i.e. , is made up of exponentials, sines and cosines, or polynomials.
Exponentials
Consider the nonhomogeneous ODE,
We know that the general solution to a nonhomogeneous ODE is made up of the solution to the homogeneous version of Eq. (13.68), i.e.
together with a particular solution to (13.68). The solution to (13.69) is:
Next, we move on to obtaining a particular solution to the nonhomogeneous ODE using the MUC. The method really boils down to having an educated guess for . We obtain a first guess by looking at the forcing term, and choosing to have a similar form. So, in this case, since , our guess for a particular solution is
where is the undetermined coefficient that we need to determine. Note that the exponent in matches the one in the exponential function in . All we are left to do is determine and, if everything works out smoothly, Eq. (13.71) should give us a particular solution to (13.68).
We proceed as follows. We want to determine in such a way that satisfies (13.68). If is to satisfy the nonhomogeneous equation, then we expect the following equation to hold true,
From Eq. (13.71), we obtain and
Next, we substitute Eqs. (13.71), (13.73) and (13.74) in (13.72):
Finally, comparing coefficients of on both sides of (13.75), we get . Substituting in Eq. (13.71) we have
as the desired particular solution. Putting together the homogeneous solution and the particular solution just found, we obtain the general solution to (13.68) as,
Failure of first guess
The method of undetermined coefficients is a relatively simple 'guessing' method which seems to work well, albeit for a small class of functions. However, there are situations where the method will fail to allow us to determine the undetermined coefficient(s). More specifically, this will happen when contains a function which already appears in the homogeneous solution.
For example, if we were looking for a particular solution satisfying
and started off with a guess then, it follows (and it is easily verified) that substituting in , yields zero; this isn't surprising since we already know that is one of the fundamental solutions satisfying the homogeneous equation. With the LHS of (13.77) being zero though, the undetermined coefficient, , vanishes and we are left with no way of determining it. As a general rule, if clashes with one of the fundamental solutions in , we multiply our initial guess of with (or higher powers of if needed ). For instance, in the ODE given by (13.77), our first initial guess of does not work since this is the same solution as one of the fundamental solutions (ignoring constants). Our 'educated' guess therefore for becomes . If we now proceed to determine as before, we find that and our desired particular solution is
Sines & cosines
Now, consider the same ODE as before [Eq. (13.68)] with the RHS replaced by a sine term,
The homogeneous solution is given by (13.70). The RHS of (13.78) is and we note that does not contain any terms that belong in the homogeneous solution. So, in this case we can go ahead and guess a form of that is similar to ,
So, we have assumed a form of which we hope it works and again, all we are left to determine is . Upon differentiating and substituting in Eq. (13.78), we have,
Note we have included the term on the RHS of (13.80) to easily compare coefficients of and on both sides. It is obvious that we cannot determine since the two equations we are left with, i.e.
leave us with no choice of that satisfies both of them.
This can happen when also clashes with the functions comprising the homogeneous solution. We need to rethink our guess of . To determine correctly, we must include all the linearly independent derivatives of . In this case, the set of linearly independent functions is . A better guess therefore would be to start off with a that includes both sine and cosine terms
where and are the undetermined coefficients. Differentiating (13.82) to get and substituting back in (13.78) gives us:
Comparing coefficients of and , we have and . The desired particular solution is therefore,
and the general solution is,
Polynomials
For our final example we consider
where .
Again, the homogeneous solution is given by (13.70). Though it would make sense to choose to match , for the same reasons discussed in Subsec. 13.3.4, we choose a form for that contains as well as all its linearly independent derivatives. Ignoring coefficients, the set of linearly independent functions is . So, our chosen form for is:
where , and are to be determined. Proceeding in the same way as for the previous examples, we take (13.87), differentiate wrt for and and substitute in (13.86). This gives,
Comparing coefficients of and the constants on both sides (note on the RHS the only term is which means that coefficients of and the constants, are 0 ):
From Eqs. (13.89), we have , and . Hence, the desired particular solution is,
Putting and together, gives the general solution to (13.86) as:
Example 13.5 Find the general solution to the following nonhomogeneous ODE:
Solution The solution is where is the homogeneous solution with characteristic equation
with roots and yielding
Next we solve for using the MUC. We break the RHS of (13.92) into two functions, one made up of the polynomials, i.e. and another made up of the exponential, . For the particular solution corresponding to , we have
while for ,
Putting the two guesses together we have
where , and are constants to be determined. Since the functions in do not clash with , we can proceed using (13.94) to obtain the particular solution.
Products of exponentials, polynomials & sines and cosines
As mentioned earlier, the MUC can be used when the forcing function is made up of products of elementary functions. We carry out an example where the forcing term is made up of a product of the simple forms of discussed above. Consider,
In this case, the homogeneous solution is given by . The forcing term is which is the product of a polynomial (degree 1 ) and the cosine function. A reasonable guess for would therefore be to start from the product of a polynomial guess and the cosine/sine guess. The correct form of the trial solution for should be a linear combination of all the linearly independent derivatives. Let us see what this means with the example in (13.95). Since then,
We observe that the third derivative, does not generate any linearly independent derivatives to the functions included in and . The set of linearly independent functions we need to consider are:
It follows that a good first guess for is,
where and are the coefficients we need to determine.
Independent coefficients
We note that the undetermined coefficients multiplying each linearly independent function in need to be independent from each other. A common mistake is to start from the following as a guess for the solution to (13.95):
Now, while we still get 4 unknown coefficients, - in (13.97), they are not independent. Given any 3, we can determine the fourth one. We can see this by expanding Eq. (13.97),
From (13.98), the four unknown coefficients are , and . They are not independent however since, given any 3 , say , and , we can determine .
Summary
Given a second order linear, nonhomogeneous equation
its general solution is given by
where is the solution to the homogeneous ODE (when ) and is a particular solution to the nonhomogeneous equation. We use the MUC to obtain a particular solution to (13.99) when the coefficients and are constants and when takes an exponential function, sines and/or cosines, polynomials or any sums and products of the aforementioned classes of functions. A key point to remember is that the form of is a linear combination of all linearly independent functions that are generated by repeated differentiation of .
Trial particular solutions
Table 13.1 summarises basic forms of that work with the method and the corresponding guess for . Finally, note that if contains a term that belongs to the homogeneous solution, then the guess for included in Table 13.1, needs to be multiplied by (or, if needed, higher powers of ).