4.5: Inhomogeneous ODEs
( \newcommand{\kernel}{\mathrm{null}\,}\)
We now consider the general inhomogeneous linear second-order ode (4.1):
..x+p(t).x+q(t)x=g(t), with initial conditions x(t0)=x0 and .x(t0)=u0. There is a three-step solution method when the inhomogeneous term g(t)≠0. (i) Find the general solution of the homogeneous equation ..x+p(t).x+q(t)x=0.
Let us denote the homogeneous solution by xh(t)=c1X1(t)+c2X2(t), where X1 and X2 are linearly independent solutions of (???), and c1 and c2 are as yet undetermined constants. (ii) Find any particular solution xp of the inhomogeneous equation (???). A particular solution is readily found when p(t) and q(t) are constants, and when g(t) is a combination of polynomials, exponentials, sines and cosines. (iii) Write the general solution of (???) as the sum of the homogeneous and particular solutions, x(t)=xh(t)+xp(t), and apply the initial conditions to determine the constants c1 and c2. Note that because of the linearity of (???), ..x+p.x+qx=d2dt2(xh+xp)+pddt(xh+xp)+q(xh+xp)=(..xh+p.xh+qxh)+(..xp+p.xp+qxp)=0+g=g, so that (???) solves (???), and the two free constants in xh can be used to satisfy the initial conditions.
We will consider here only the constant coefficient case. We now illustrate the solution method by an example.
Solve ..x−3.x−4x=3e2t with x(0)=1 and .x(0)=0.
Solution
First, we solve the homogeneous equation. The characteristic equation is r2−3r−4=(r−4)(r+1)=0, so that xh(t)=c1e4t+c2e−t.
Second, we find a particular solution of the inhomogeneous equation. The form of the particular solution is chosen such that the exponential will cancel out of both sides of the ode. The ansatz we choose is x(t)=Ae2t, where A is a yet undetermined coefficient. Upon substituting x into the ode, differentiating using the chain rule, and canceling the exponential, we obtain 4A−6A−4A=3, from which we determine A=−1/2. Obtaining a solution for A independent of t justifies the ansatz (???). Third, we write the general solution to the ode as the sum of the homogeneous and particular solutions, and determine c1 and c2 that satisfy the initial conditions. We have x(t)=c1e4t+c2e−t−12e2t; and taking the derivative, .x(t)=4c1e4t−c2e−t−e2t.
Applying the initial conditions, c1+c2−12=1,4c1−c2−1=0; or c1+c2=32,4c1−c2=1.
This system of linear equations can be solved for c1 by adding the equations to obtain c1=1/2, after which c2=1 can be determined from the first equation. Therefore, the solution for x(t) that satisfies both the ode and the initial conditions is given by x(t)=12e4t−12e2t+e−t=12e4t(1−e−2t+2e−5t), where we have grouped the terms in the solution to better display the asymptotic behavior for large t.
We now find particular solutions for some relatively simple inhomogeneous terms using this method of undetermined coefficients.
Find a particular solution of ..x−3.x−4x=2sint.
Solution
We show two methods for finding a particular solution. The first more direct method tries the ansatz x(t)=Acost+Bsint, where the argument of cosine and sine must agree with the argument of sine in the inhomogeneous term. The cosine term is required because the derivative of sine is cosine. Upon substitution into the differential equation, we obtain (−Acost−Bsint)−3(−Asint+Bcost)−4(Acost+Bsint)=2sint, or regrouping terms, −(5A+3B)cost+(3A−5B)sint=2sint.
This equation is valid for all t, and in particular for t=0 and π/2, for which the sine and cosine functions vanish. For these two values of t, we find 5A+3b=0,\quad 3A-5B=2;\nonumber and solving for A and B, we obtain A=\frac{3}{17},\quad B=-\frac{5}{17}.\nonumber
The particular solution is therefore given by x_p=\frac{1}{17}(3\cos t-5\sin t).\nonumber
The second solution method makes use of the relation e^{it} = \cos t + i \sin t to convert the sine inhomogeneous term to an exponential function. We introduce the complex function z(t) by letting z(t)=x(t)+iy(t),\nonumber and rewrite the differential equation in complex form. We can rewrite the equation in one of two ways. On the one hand, if we use \sin t = \text{Re}\{−ie^{it}\}, then the differential equation is written as \label{eq:5}\overset{..}{z}-3\overset{.}{z}-4z=-2ie^{it}; and by equating the real and imaginary parts, this equation becomes the two real differential equations \overset{..}{x}-3\overset{.}{x}-4x=2\sin t,\quad\overset{..}{y}-3\overset{.}{y}-4y=-2\cos t.\nonumber
The solution we are looking for, then, is x_p(t) = \text{Re}\{z_p(t)\}.
On the other hand, if we write \sin t = \text{Im}\{e^{it}\}, then the complex differential equation becomes \label{eq:6}\overset{..}{z}-3\overset{.}{z}-4z=2e^{it}, which becomes the two real differential equations \overset{..}{x}-3\overset{.}{x}-4x=2\cos t,\quad\overset{..}{y}-3\overset{.}{y}-4y=2\sin t.\nonumber
Here, the solution we are looking for is x_p(t) = \text{Im}\{z_p(t)\}.
We will proceed here by solving \eqref{eq:6}. As we now have an exponential function as the inhomogeneous term, we can make the ansatz z(t)=Ce^{it},\nonumber where we now expect C to be a complex constant. Upon substitution into the ode \eqref{eq:6} and using i^{2} = −1:
-C-3iC-4C=2;\nonumber or solving for C:
\begin{aligned}C&=\frac{-2}{5+3i} \\ &=\frac{-2(5-3i)}{(5+3i)(5-3i)} \\ &=\frac{-10+6i}{34} \\ &=\frac{-5+3i}{17}.\end{aligned}
Therefore, \begin{aligned}x_p&=\text{Im}\{z_p\} \\ &=\text{Im}\left\{\frac{1}{17}(-5+3i)(\cos t+i\sin t)\right\} \\ &=\frac{1}{17}(3\cos t-5\sin t).\end{aligned}
Find a particular solution of \overset{..}{x}+\overset{.}{x}-2x=t^2.
Solution
The correct ansatz here is the polynomial x(t)=At^2+Bt+C.\nonumber
Upon substitution into the ode, we have 2A+2At+B-2At^2-2Bt-2C=t^2,\nonumber or -2At^2+2(A-B)t+(2A+B-2C)t^0=t^2.\nonumber
Equating powers of t, -2A=1,\quad 2(A-B)=0,\quad 2A+B-2C=0;\nonumber and solving, A=-\frac{1}{2},\quad B=-\frac{1}{2},\quad C=-\frac{3}{4}.\nonumber
The particular solution is therefore x_p(t)=-\frac{1}{2}t^2-\frac{1}{2}t-\frac{3}{4}.\nonumber