# Solving a System of two ordinary differential equations

Problem:
Solve the following system of differential equations. \begin{align*} x' + y' - 2x - 4y &= e^t \tag{1a} \\ x' + y' - y &= e^{4t} \tag{2a} \\ \end{align*}
Answer:
Here I use the operator method. \begin{align*} (D-2)x + (D-4)y &= e^t \tag{1b} \\ D(D-2)x + D(D-4)y &= D(e^t) \\ D(D-2)x + D(D-4)y &= e^t \tag{1c} \\ Dx + (D-1)y &= e^{4t} \tag{2b} \\ D(D-2)x + (D-1)(D-2)y &= (D-2)(e^{4t}) = 4e^{4t} - 2e^{4t} \\ D(D-2)x + (D-1)(D-2)y &= 2e^{4t} \tag{2c} \\ D(D-4)y - (D-1)(D-2)y &= e^t - 2e^{4t} \\ (D^2 - 4D)y - (D^2 - 3D + 2)y &= e^{t} - 2e^{4t} \\ (D^2 - 4D - D^2 + 3D - 2)y &= e^{t} - 2e^{4t} \\ (-D - 2)y &= e^t - 2e^{4t} \\ \frac{dy}{dt} + 2y &= 2e^{4t} - e^t \\ \end{align*} Now, we have a first order ordinary differential equation. We now find the integrating factor $$I$$. \begin{align*} I &= e^{\int 2 \, dt} = e^{2t} \\ e^{2t}\frac{dy}{dt} + 2e^{2t}y &= 2e^{6t} - e^{3t} \\ D( e^{2t}y) &= 2e^{6t} - e^{3t} \\ e^{2t}y &= \frac{e^{6t}}{3} - \frac{e^{3t}}{3} + C \\ y &= \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \\ \end{align*} Now we have to solve for $$x$$. \begin{align*} y' &= \frac{4e^{4t}}{3} - \frac{e^t}{3} - 2Ce^{-2t} \\ x' + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 2Ce^{-2t} - \left( \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \right) &= e^{4t} \\ x' + \frac{e^{4t}}{3} - \frac{e^t}{3} - 2Ce^{-2t} - \left( \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \right) &= 0 \\ x' - \frac{e^t}{3} - 2Ce^{-2t} - \left( - \frac{e^t}{3} + Ce^{-2t} \right) &= 0 \\ x' &= -3Ce^{-2t} \\ x &= \frac{3Ce^{-2t}}{2} + C_2 \\ \end{align*} Now we use the equation $$x' + y' - 2x - 4y = e^t$$ to eliminate one of the constants. Since no initial conditions were given, we cannot eliminate both constants. \begin{align*} -3Ce^{-2t} + y' - 2\left( x \right) - 4y &= e^t \\ -3Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 2Ce^{-2t} - 2\left( \frac{3Ce^{-2t}}{2} + C_2 \right) - 4\left( \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \right) &= e^t \\ -5Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 2\left( \frac{3Ce^{-2t}}{2} + C_2 \right) - 4\left( \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \right) &= e^t \\ % -5Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 3Ce^{-2t} - 2 C_2 - 4\left( \frac{e^{4t}}{3} - \frac{e^t}{3} + Ce^{-2t} \right) &= e^t \\ % -8Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 3Ce^{-2t} - 2 C_2 - 4\left( \frac{e^{4t}}{3} - \frac{e^t}{3} \right) &= e^t \\ % -8Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 3Ce^{-2t} - 2 C_2 - \frac{4e^{4t}}{3} + \frac{4e^t}{3} &= e^t \\ -11Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 2 C_2 - \frac{4e^{4t}}{3} + \frac{4e^t}{3} &= e^t \\ -11Ce^{-2t} - \frac{e^t}{3} - 2 C_2 + \frac{4e^t}{3} &= e^t \\ -2 C_2 &= 0 \\ C_2 &= 0 \\ -11C &= 0 \\ C_0 &= 0 \\ \end{align*} This does not seem right to me. Hence, my answer is: \begin{align*} x &= 0 \\ y &= \frac{e^{4t}}{3} - \frac{e^t}{3} \\ \end{align*} The book's answer is: \begin{align*} x &= \frac{3ce^{-2t}}{2} \\ y &= -\frac{2ce^{-2t}}{3} + \frac{e^{4t}}{3} - \frac{e^t}{3} \\ \end{align*} What did I do wrong?

• You must have a sign error in the last group of equations, as you should obtain $0\,C=0$. – Yves Daoust Nov 5 '19 at 23:20
• @YvesDaoust I suspect you are right about the sign error but I cannot find it. Do you know where it is? If so, please tell me. – Bob Nov 6 '19 at 17:58

## 3 Answers

Let $$z:=x+y$$ and the system turns to

$$\begin{cases}z'-2z-2y=e^t,\\z'-y=e^{4t}.\end{cases}$$

Then eliminating $$y$$,

$$z'+2z=2e^{4t}-e^t,$$ has the solution

$$z=Ce^{-2t}+\frac13e^{4t}-\frac13e^t.$$

Then you draw $$y$$ from $$y=z'-e^{4t}=-2Ce^{-2t}+\frac13e^{4t}-\frac13e^t$$ and $$x=z-x$$ follows.

Hint:

\begin{align} x'+y'-2x-4y &= e^t \tag{1} \\ x'+y'-y &= e^{4t} \tag{2} \\ \end{align}

$$(2)-(1)$$ gives, $$2x+3y = e^{4t}-e^{t} \tag{3}$$

$$(2)\times 2-(1)$$ gives, $$(x+y)'+2(x+y) = 2e^{4t}-e^t \tag{4}$$

Solving $$(4)$$ gives,

$$x+y=\frac{e^{4t}-e^t}{3}+ke^{-t} \tag{5}$$

Can you proceed?

If you've learn't matrices in linear algebra course, you may refer to this link here.

• Is my approach wrong? – Bob Nov 4 '19 at 0:29
• I'm not sure whether there'll be extraneous solution coming out when you differentiate on the equations. Also, I'm not quite follow how to arrive $(-D-2)y=e^t-2e^{4t}$. – Ng Chung Tak Nov 4 '19 at 1:42
• @Nu Chung Tak I added an extra line to show more detail. Now, can you see how I got $(-D - 2)y = e^t - 2e^{4t}$? – Bob Nov 4 '19 at 2:09
• One term (in red) is missing: $$-8Ce^{-2t} + \frac{4e^{4t}}{3} - \frac{e^t}{3} - 3Ce^{-2t} - 2 C_2 - 4\left( \frac{e^{4t}}{3} - \frac{e^t}{3}+\color{red}{Ce^{-2t}} \right) = e^t$$ – Ng Chung Tak Nov 5 '19 at 22:51

Here is my correct solution to find $$x$$:

\begin{align*} -2x - 4y + y &= e^t - e^{4t} \\ -2x - 3y &= e^t - e^{4t} \\ -2x &= e^t - e^{4t} + 3y \\ -2x &= e^t - e^{4t} + 3 \left( -\frac{2ce^{-2t}}{3} + \frac{e^{4t}}{3} - \frac{e^t}{3} \right) \\ -2x &= e^t - e^{4t} - 2ce^{-2t} + e^{4t} - e^t \\ -2x &= -2ce^{-2t} \\ x &= ce^{-2t} \\ \end{align*}

Now, I am matching the book.