Skip to main content
Logo image

Section 3.9 Nonhomogeneous systems

Note: 3 lectures (may have to skip a little), somewhat different from §5.7 in [EP], §7.9 in [BD]

Subsection 3.9.1 First order constant coefficient

Subsubsection 3.9.1.1 Integrating factor

Let us first focus on the nonhomogeneous first order equation
x(t)=Ax(t)+f(t),
where A is a constant matrix. The first method we look at is the integrating factor method. For simplicity we rewrite the equation as
x(t)+Px(t)=f(t),
where P=A. We multiply both sides of the equation by etP (being mindful that we are dealing with matrices that may not commute) to obtain
etPx(t)+etPPx(t)=etPf(t).
We notice that PetP=etPP. This fact follows by writing down the series definition of etP:
PetP=P(I+tP+12(tP)2+)=P+tP2+12t2P3+==(I+tP+12(tP)2+)P=etPP.
So ddt(etP)=PetP=etPP. The product rule says
ddt(etPx(t))=etPx(t)+etPPx(t),
and so
ddt(etPx(t))=etPf(t).
We can now integrate. That is, we integrate each component of the vector separately
etPx(t)=etPf(t)dt+c.
Recall from Exercise 3.8.7 that (etP)1=etP. Therefore, we obtain
x(t)=etPetPf(t)dt+etPc.
Perhaps it is better understood as a definite integral. In this case it will be easy to also solve for the initial conditions. Consider the equation with initial conditions
x(t)+Px(t)=f(t),x(0)=b.
The solution can then be written as
(3.6)  x(t)=etP0tesPf(s)ds+etPb.  
Again, the integration means that each component of the vector esPf(s) is integrated separately. It is not hard to see that (3.6) really does satisfy the initial condition x(0)=b.
x(0)=e0P00esPf(s)ds+e0Pb=Ib=b.
Example 3.9.1.
Suppose that we have the system
x1+5x13x2=et,x2+3x1x2=0,
with initial conditions x1(0)=1,x2(0)=0.
Let us write the system as
x+[5331]x=[et0],x(0)=[10].
The matrix P=[5331] has a doubled eigenvalue 2 with defect 1, and we leave it as an exercise to double check we computed etP correctly. Once we have etP, we find etP, simply by negating t.
etP=[(1+3t)e2t3te2t3te2t(13t)e2t],etP=[(13t)e2t3te2t3te2t(1+3t)e2t].
Instead of computing the whole formula at once, let us do it in stages. First
0tesPf(s)ds=0t[(1+3s)e2s3se2s3se2s(13s)e2s][es0]ds=0t[(1+3s)e3s3se3s]ds=[0t(1+3s)e3sds0t3se3sds]=[te3t(3t1)e3t+13](used integration by parts).
Then
x(t)=etP0tesPf(s)ds+etPb=[(13t)e2t3te2t3te2t(1+3t)e2t][te3t(3t1)e3t+13]+[(13t)e2t3te2t3te2t(1+3t)e2t][10]=[te2tet3+(13+t)e2t]+[(13t)e2t3te2t]=[(12t)e2tet3+(132t)e2t].
Phew!
Let us check that this really works.
x1+5x13x2=(4te2t4e2t)+5(12t)e2t+et(16t)e2t=et.
Similarly (exercise) x2+3x1x2=0. The initial conditions are also satisfied (exercise).
For systems, the integrating factor method only works if P does not depend on t, that is, P is constant. The problem is that in general
ddt[eP(t)dt]P(t)eP(t)dt,
because matrix multiplication is not commutative.

Subsubsection 3.9.1.2 Eigenvector decomposition

For the next method, note that eigenvectors of a matrix give the directions in which the matrix acts like a scalar. If we solve the system along these directions, the computations are simpler as we treat the matrix as a scalar. We then put those solutions together to get the general solution for the system.
Take the equation
(3.7)x(t)=Ax(t)+f(t).
Assume A has n linearly independent eigenvectors v1,v2,,vn. Write
(3.8)x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t).
That is, we wish to write our solution as a linear combination of eigenvectors of A. If we solve for the scalar functions ξ1 through ξn, we have our solution x. Let us decompose f in terms of the eigenvectors as well. We wish to write
(3.9)f(t)=v1g1(t)+v2g2(t)++vngn(t).
That is, we wish to find g1 through gn that satisfy (3.9). Since all the eigenvectors are independent, the matrix E=[v1v2vn] is invertible. Write the equation (3.9) as f=Eg, where the components of g are the functions g1 through gn. Then g=E1f. Hence it is always possible to find g when there are n linearly independent eigenvectors.
We plug (3.8) into (3.7), and note that Avk=λkvk:
v1ξ1+v2ξ2++vnξnx=A(v1ξ1+v2ξ2++vnξn)Ax+v1g1+v2g2++vngnf=Av1ξ1+Av2ξ2++Avnξn+v1g1+v2g2++vngn=v1λ1ξ1+v2λ2ξ2++vnλnξn+v1g1+v2g2++vngn=v1(λ1ξ1+g1)+v2(λ2ξ2+g2)++vn(λnξn+gn).
If we identify the coefficients of the vectors v1 through vn, we get the equations
ξ1=λ1ξ1+g1,ξ2=λ2ξ2+g2,  ξn=λnξn+gn.
Each one of these equations is independent of the others. They are all linear first order equations and can easily be solved by the standard integrating factor method for single equations. That is, for the kth equation we write
ξk(t)λkξk(t)=gk(t).
We use the integrating factor eλkt to find that
ddt[ξk(t)eλkt]=eλktgk(t).
We integrate and solve for ξk to get
ξk(t)=eλkteλktgk(t)dt+Ckeλkt.
If we are looking for just any particular solution, we can set Ck to be zero. If we leave these constants in, we get the general solution. Write x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t), and we are done.
As always, it is perhaps better to write these integrals as definite integrals. Suppose that we have an initial condition x(0)=b. Take a=E1b to find b=v1a1+v2a2++vnan, just like before. Then if we write
  ξk(t)=eλkt0teλksgk(s)ds+akeλkt,  
we get the particular solution x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t) satisfying x(0)=b, because ξk(0)=ak.
We remark that the technique we just outlined is the eigenvalue method applied to nonhomogeneous systems. If a system is homogeneous, that is, if f=0, then the equations we get are ξk=λkξk, and so ξk=Ckeλkt are the solutions and that is precisely what we got in Section 3.4.
Example 3.9.2.
Let A=[1331]. Solve x=Ax+f where f(t)=[2et2t] for x(0)=[3/165/16].
The eigenvalues of A are 2 and 4 and corresponding eigenvectors are [11] and [11] respectively. This calculation is left as an exercise. We write down the matrix E of the eigenvectors and compute its inverse (using the inverse formula for 2×2 matrices)
E=[1111],E1=12[1111].
We are looking for a solution of the form x=[11]ξ1+[11]ξ2. We first need to write f in terms of the eigenvectors. That is we wish to write f=[2et2t]=[11]g1+[11]g2. Thus
[g1g2]=E1[2et2t]=12[1111][2et2t]=[ettet+t].
So g1=ett and g2=et+t.
We further need to write x(0) in terms of the eigenvectors. That is, we wish to write x(0)=[3/165/16]=[11]a1+[11]a2. Hence
[a1a2]=E1[3/165/16]=[1/41/16].
So a1=1/4 and a2=1/16. We plug our x into the equation and get
[11]ξ1+[11]ξ2x=A[11]ξ1+A[11]ξ2Ax+[11]g1+[11]g2f=[11](2ξ1)+[11]4ξ2+[11](ett)+[11](et+t).
We get the two equations
ξ1=2ξ1+ett,where ξ1(0)=a1=14,ξ2=4ξ2+et+t,where ξ2(0)=a2=116.
We solve with integrating factor. Computation of the integral is left as an exercise to the student. You will need integration by parts.
ξ1=e2te2t(ett)dt+C1e2t=et3t2+14+C1e2t.
C1 is the constant of integration. As ξ1(0)=1/4, then 1/4=1/3+1/4+C1 and hence C1=1/3. Similarly
ξ2=e4te4t(et+t)dt+C2e4t=et3t4116+C2e4t.
As ξ2(0)=1/16 we have 1/16=1/31/16+C2 and hence C2=1/3. The solution is
x(t)=[11](ete2t3+12t4)ξ1+[11](e4tet34t+116)ξ2=[e4te2t3+312t16e2t+e4t2et3+4t516].
That is, x1=e4te2t3+312t16 and x2=e2t+e4t2et3+4t516.
Exercise 3.9.1.
Check that x1 and x2 solve the problem. Check both that they satisfy the differential equation and that they satisfy the initial conditions.

Subsubsection 3.9.1.3 Undetermined coefficients

The method of undetermined coefficients also works for systems. The only difference is that we use unknown vectors rather than just numbers. Same caveats apply to undetermined coefficients for systems as for single equations. This method does not always work. Furthermore, if the right-hand side is complicated, we have to solve for lots of variables. Each element of an unknown vector is an unknown number. In system of 3 equations with say 4 unknown vectors (this would not be uncommon), we already have 12 unknown numbers to solve for. The method can turn into a lot of tedious work if done by hand. As the method is essentially the same as for single equations, let us just do an example.
Example 3.9.3.
Let A=[1021]. Find a particular solution of x=Ax+f where f(t)=[ett].
Note that we can solve this system in an easier way (can you see how?), but for the purposes of the example, let us use the eigenvalue method plus undetermined coefficients. The eigenvalues of A are 1 and 1 and corresponding eigenvectors are [11] and [01] respectively. Hence our complementary solution is
xc=α1[11]et+α2[01]et,
for some arbitrary constants α1 and α2.
We would want to guess a particular solution of
x=aet+bt+c.
However, something of the form aet appears in the complementary solution. Because we do not yet know if the vector a is a multiple of [01], we do not know if a conflict arises. It is possible that there is no conflict, but to be safe we should also try btet. Here we find the crux of the difference between a single equation and systems. We try both terms aet and btet in the solution, not just the term btet. Therefore, we try
x=aet+btet+ct+d.
Thus we have 8 unknowns. We write a=[a1a2], b=[b1b2], c=[c1c2], and d=[d1d2]. We plug x into the equation. First let us compute x.
x=(a+b)et+btet+c=[a1+b1a2+b2]et+[b1b2]tet+[c1c2].
Now x must equal Ax+f, which is
Ax+f=Aaet+Abtet+Act+Ad+f=[a12a1+a2]et+[b12b1+b2]tet+[c12c1+c2]t+[d12d1+d2]+[10]et+[01]t=[a1+12a1+a2]et+[b12b1+b2]tet+[c12c1+c2+1]t+[d12d1+d2].
We identify the coefficients of et, tet, t and any constant vectors in x and in Ax+f to find the equations:
a1+b1=a1+1,0=c1,a2+b2=2a1+a2,0=2c1+c2+1,b1=b1,c1=d1,b2=2b1+b2,c2=2d1+d2.
We could write the 8×9 augmented matrix and start row reduction, but it is easier to just solve the equations in an ad hoc manner. Immediately we see that b1=0, c1=0, d1=0. Plugging these back in, we get that c2=1 and d2=1. The remaining equations that tell us something are
a1=a1+1,a2+b2=2a1+a2.
So a1=1/2 and b2=1. Finally, a2 can be arbitrary and still satisfy the equations. We are looking for just a single solution so presumably the simplest one is when a2=0. Therefore,
x=aet+btet+ct+d=[1/20]et+[01]tet+[01]t+[01]=[12ettett1].
That is, x1=12et, x2=tett1. We would add this to the complementary solution to get the general solution of the problem. Notice that both aet and btet were really needed.
Exercise 3.9.2.
Check that x1 and x2 solve the problem. Try setting a2=1 and check we get a solution as well. What is the difference between the two solutions we obtained (one with a2=0 and one with a2=1)?
As you can see, other than the handling of conflicts, undetermined coefficients works exactly the same as it did for single equations. However, the computations can get out of hand pretty quickly for systems. The equation we considered was pretty simple.

Subsection 3.9.2 First order variable coefficient

Subsubsection 3.9.2.1 Variation of parameters

Just as for a single equation, there is the method of variation of parameters. For constant coefficient systems, it is essentially the same thing as the integrating factor method we discussed earlier. However, this method works for any linear system, even if it is not constant coefficient, provided we somehow solve the associated homogeneous problem.
Suppose we have the equation
(3.10)x=A(t)x+f(t).
Further, suppose we solved the associated homogeneous equation x=A(t)x and found a fundamental matrix solution X(t). The general solution to the associated homogeneous equation is X(t)c for a constant vector c. Just like for variation of parameters for single equation we try the solution to the nonhomogeneous equation of the form
xp=X(t)u(t),
where u(t) is a vector-valued function instead of a constant. We substitute xp into (3.10) to obtain
X(t)u(t)+X(t)u(t)xp(t)=A(t)X(t)u(t)A(t)xp(t)+f(t).
But X(t) is a fundamental matrix solution to the homogeneous problem. So X(t)=A(t)X(t), and
X(t)u(t)+X(t)u(t)=X(t)u(t)+f(t).
Hence X(t)u(t)=f(t). If we compute [X(t)]1, then u(t)=[X(t)]1f(t). We integrate to obtain u and we have the particular solution xp=X(t)u(t). Let us write this as a formula
  xp=X(t)[X(t)]1f(t)dt.  
If A is a constant matrix and X(t)=etA, then [X(t)]1=etA. We obtain a solution xp=etAetAf(t)dt, which is precisely what we got using the integrating factor method.
Example 3.9.4.
Find a particular solution to
(3.11)x=1t2+1[t11t]x+[t1](t2+1).
Here A=1t2+1[t11t] is most definitely not constant. Perhaps by a lucky guess, we find that X=[1tt1] solves X(t)=A(t)X(t). Once we know the complementary solution we can easily find a solution to (3.11). First we find
[X(t)]1=1t2+1[1tt1].
Next we know a particular solution to (3.11) is
xp=X(t)[X(t)]1f(t)dt=[1tt1]1t2+1[1tt1][t1](t2+1)dt=[1tt1][2tt2+1]dt=[1tt1][t213t3+t]=[13t423t3+t].
Adding the complementary solution we find the general solution to (3.11):
x=[1tt1][c1c2]+[13t423t3+t]=[c1c2t+13t4c2+(c1+1)t+23t3].
Exercise 3.9.3.
Check that x1=13t4 and x2=23t3+t really solve (3.11).
In the variation of parameters, just like in the integrating factor method we can obtain the general solution by adding in constants of integration. That is, we will add X(t)c for a vector of arbitrary constants. But that is precisely the complementary solution.

Subsection 3.9.3 Second order constant coefficients

Subsubsection 3.9.3.1 Undetermined coefficients

We have already seen a simple example of the method of undetermined coefficients for second order systems in Section 3.6. This method is essentially the same as undetermined coefficients for first order systems. There are some simplifications that we can make, as we did in Section 3.6. Let the equation be
x=Ax+F(t),
where A is a constant matrix. If F(t) is of the form F0cos(ωt), then as two derivatives of cosine is again cosine we can try a solution of the form
xp=ccos(ωt),
and we do not need to introduce sines.
If the F is a sum of cosines, note that we still have the superposition principle. If F(t)=F0cos(ω0t)+F1cos(ω1t), then we would try acos(ω0t) for the problem x=Ax+F0cos(ω0t), and we would try bcos(ω1t) for the problem x=Ax+F1cos(ω1t). Then we sum the solutions.
However, if there is duplication with the complementary solution, or the equation is of the form x=Ax+Bx+F(t), then we need to do the same thing as we do for first order systems.
You will never go wrong with putting in more terms than needed into your guess. You will find that the extra coefficients will turn out to be zero. But it is useful to save some time and effort.

Subsubsection 3.9.3.2 Eigenvector decomposition

If we have the system
x=Ax+f(t),
we can do eigenvector decomposition, just like for first order systems.
Let λ1,λ2,,λn be the eigenvalues and v1,v2,,vn be eigenvectors. Again form the matrix E=[v1v2vn]. Write
x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t).
Decompose f in terms of the eigenvectors
f(t)=v1g1(t)+v2g2(t)++vngn(t),
where, again, g=E1f.
We plug in and as before we obtain
v1ξ1+v2ξ2++vnξnx=A(v1ξ1+v2ξ2++vnξn)Ax+v1g1+v2g2++vngnf=Av1ξ1+Av2ξ2++Avnξn+v1g1+v2g2++vngn=v1λ1ξ1+v2λ2ξ2++vnλnξn+v1g1+v2g2++vngn=v1(λ1ξ1+g1)+v2(λ2ξ2+g2)++vn(λnξn+gn).
We identify the coefficients of the eigenvectors to get the equations
ξ1=λ1ξ1+g1,ξ2=λ2ξ2+g2,  ξn=λnξn+gn.
Each one of these equations is independent of the others. We solve each equation using the methods of Chapter 2. We write x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t), and we are done; we have a particular solution. We find the general solutions for ξ1 through ξn, and again x(t)=v1ξ1(t)+v2ξ2(t)++vnξn(t) is the general solution (and not just a particular solution).
Example 3.9.5.
Let us do the example from Section 3.6 using this method. The equation is
x=[3122]x+[02]cos(3t).
The eigenvalues are 1 and 4, with eigenvectors [12] and [11]. Therefore E=[1121] and E1=13[1121]. Therefore,
[g1g2]=E1f(t)=13[1121][02cos(3t)]=[23cos(3t)23cos(3t)].
So after the whole song and dance of plugging in, the equations we get are
ξ1=ξ1+23cos(3t),ξ2=4ξ223cos(3t).
For each equation we use the method of undetermined coefficients. We try C1cos(3t) for the first equation and C2cos(3t) for the second equation. We plug in to get
9C1cos(3t)=C1cos(3t)+23cos(3t),9C2cos(3t)=4C2cos(3t)23cos(3t).
We solve each of these equations separately. We get 9C1=C1+2/3 and 9C2=4C22/3. And hence C1=1/12 and C2=2/15. So our particular solution is
x=[12](112cos(3t))+[11](215cos(3t))=[1/203/10]cos(3t).
This solution matches what we got previously in Section 3.6.

Exercises 3.9.4 Exercises

3.9.4.

Find a particular solution to x=x+2y+2t, y=3x+2y4,
  1. using integrating factor method,
  2. using eigenvector decomposition,
  3. using undetermined coefficients.

3.9.5.

Find the general solution to x=4x+y1, y=x+4yet,
  1. using integrating factor method,
  2. using eigenvector decomposition,
  3. using undetermined coefficients.

3.9.6.

Find the general solution to x1=6x1+3x2+cos(t), x2=2x17x2+3cos(t),
  1. using eigenvector decomposition,
  2. using undetermined coefficients.

3.9.7.

Find the general solution to x1=6x1+3x2+cos(2t), x2=2x17x2+3cos(2t),
  1. using eigenvector decomposition,
  2. using undetermined coefficients.

3.9.8.

Take the equation x=[1t111t]x+[t2t].
  1. Check that xc=c1[tsinttcost]+c2[tcosttsint] is the complementary solution.
  2. Use variation of parameters to find a particular solution.

3.9.101.

Find a particular solution to x=5x+4y+t, y=x+8yt,
  1. using integrating factor method,
  2. using eigenvector decomposition,
  3. using undetermined coefficients.
Answer.
The general solution is (particular solutions should agree with one of these):
x(t)=C1e9t+4C2e4tt/35/54,     y(t)=C1e9tC2e4t+t/6+7/216

3.9.102.

Find a particular solution to x=y+et, y=x+et,
  1. using integrating factor method,
  2. using eigenvector decomposition,
  3. using undetermined coefficients.
Answer.
The general solution is (particular solutions should agree with one of these):
x(t)=C1et+C2et+tet,     y(t)=C1etC2et+tet

3.9.103.

Solve x1=x2+t, x2=x1+t with initial conditions x1(0)=1, x2(0)=2, using eigenvector decomposition.
Answer.
x=[11](52ett1)+[11]12et

3.9.104.

Solve x1=3x1+x2+t, x2=9x1+5x2+cos(t) with initial conditions x1(0)=0, x2(0)=0, x1(0)=0, x2(0)=0, using eigenvector decomposition.
Answer.
x=[19]((1140+11206)e6t+(1140+11206)e6tt60cos(t)70)
+[11](980sin(2t)+130cos(2t)+9t40cos(t)30)
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf