# Solving a system of ordineary differential equations

Here is a system of ODEs:

$$y'_{1} = y_{2} +2e^{t}$$

$$y'_{2} = y_{1} -2e^{t}$$

The initial conditions are $$y_{1}(0) = 0$$ and $$y_{2}(0) = 1$$. Solving the system of ODEs, we get two solutions. one for homogeneous ODE and the other for non homogeneous part. The equations are of the form $$y' = Ay + g ------ (equation 1)$$ where $$y = \begin{pmatrix} y_1 \\ y_2 \end{pmatrix}$$ and $$y' = \begin{pmatrix} y_1' \\ y_2' \end{pmatrix}$$ After solving the characteristic equation, the following solution was obtained for the homogeneous ODE with the eigen vectors $$\begin{pmatrix} 1 \\ 1 \end{pmatrix}$$ and $$\begin{pmatrix} -1 \\ 1 \end{pmatrix}$$

Solution of homogeneous equation is $$y_{h} = C_{1} \begin{pmatrix} 1 \\ 1 \end{pmatrix}e^{t} + c_{2}\begin{pmatrix} -1 \\ 1 \end{pmatrix}e^{-t}$$

For the particular solution, the following substitution was used:
$$y_{p1} = u_{1}te^t +v_{1}e^t$$
$$y_{p2} = u_{2}te^t +v_{2}e^t$$

By substituting $$y_{p1}$$ and $$y_{p2}$$ in (1) and comparing coefficients, I got u1 + v1 = v2 + 2 and u2 + v2 = v1 - 2 and u1 = u2. The matrix A =$$\begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix}$$. I had used the equation $$y_p'=Ay_p+g$$ where g =$$\begin{pmatrix} 2e^t \\ -2e^t\end{pmatrix}$$

After this, $$u_1 = u_2 = 0$$ and $$v_1 -v_2 = 2$$. There was no way to calculate $$v_1$$ and $$v_2$$. I assumed $$v_2 = -1$$ , with that $$v_1 = 1$$. The final solution was:

$$y_{1} = 3\sinh t$$

$$y_{2} = \cosh t -2\sinh t$$

$$y_{1} = -\cosh t +2\sinh t + e^{t}$$

$$y_{2} = 2\cosh t -\sinh t - e^{t}$$

Can you tell where the solution was wrong? is it in the particular solution part or the solution for homogeneous ODE part? If somebody can walk through the problem and show the correct approach, much is appreciated.

Edit: The solution was matching because I assumed $$v_2 =-1$$. Is there a way to derive $$v_1$$ and $$v_2$$ explicitly to arrive at the solution?

Reference:

Advanced engineering mathematics ,Erwin and Herbert kreyszig and Normington, 10e, Wiley, page 163.

• The MathJax "$"s work better when you don't escape them with backslashes. Commented Jun 23 at 16:02 • How do I create matrix with two rows? Commented Jun 23 at 16:13 • The solutions are equivalent, since$-\cosh t+e^t=\sinh t$. Commented Jun 23 at 16:14 • It does:$2\cosh t-\sinh t-e^t$$=\cosh t-\sinh t+(\cosh t-e^t)=\cosh t-2\sinh t. Commented Jun 23 at 18:25 • "$$\begin{pmatrix} item11 & item 12 & item 13 \\ item21 & item22 & item 23 \end{pmatrix}$$" gives$$\begin{pmatrix} item11 & item 12 & item 13 \\ item21 & item22 & item 23 \end{pmatrix} For variations, see math.meta.stackexchange.com/questions/5020/… Commented Jun 23 at 23:28

Let's decouple the system of ODEs $$\begin{cases} y_1'=y_2+2e^t, \\ y_2'=y_1-2e^t. \end{cases} \tag{1}$$ Differentiating the first equation with respect to $$t$$, we get $$y_1''=y_2'+2e^t=(y_1-2e^t)+2e^t=y_1$$ $$\implies y_1=C_1e^t+C_2e^{-t}. \tag{2}$$ Plugging $$(2)$$ into the first equation of $$(1)$$, we obtain $$y_2=y_1'-2e^t=C_1e^t-C_2e^{-t}-2e^t=(C_1-2)e^t-C_2e^{-t}. \tag{3}$$ The initial conditions $$y_1(0)=0$$ and $$y_2(0)=1$$ then imply $$\begin{cases} C_1+C_2=0, \\ (C_1-2)-C_2=1. \end{cases} \tag{4}$$ The solution to $$(4)$$ is $$C_1=\frac{3}{2}$$ and $$C_2=-\frac{3}{2}$$. Therefore, $$\begin{cases} y_1=\frac{3}{2}e^t-\frac{3}{2}e^{-t}=3\sinh t, \\ y_2=-\frac{1}{2}e^t+\frac{3}{2}e^{-t}=\cosh t-2\sinh t. \tag{5} \end{cases}$$
Let me adapt what I did to your solution. You showed that $$y_p=\begin{pmatrix} v_1 \\ v_2 \end{pmatrix}e^{t} =\begin{pmatrix} v_1 \\ v_1-2 \end{pmatrix}e^{t}. \tag{6}$$ Therefore, \begin{align} y=y_h+y_p&=C_{1} \begin{pmatrix} 1 \\ 1 \end{pmatrix}e^{t} + C_{2}\begin{pmatrix} -1 \\ 1 \end{pmatrix}e^{-t} +\begin{pmatrix} v_1 \\ v_1-2 \end{pmatrix}e^{t} \\ &=\begin{pmatrix} C_1+v_1 \\ C_1+v_1-2 \end{pmatrix}e^{t} + \begin{pmatrix} -C_2 \\ C_2 \end{pmatrix}e^{-t} \\ &=\begin{pmatrix} C_1' \\ C_1'-2 \end{pmatrix}e^{t} + \begin{pmatrix} C_2' \\ -C_2' \end{pmatrix}e^{-t}. \tag{7} \end{align} Applying the initial conditions to $$(7)$$, we get $$y(0)=\begin{pmatrix} 0 \\ 1 \end{pmatrix} =\begin{pmatrix} C_1' \\ C_1'-2 \end{pmatrix} + \begin{pmatrix} C_2' \\ -C_2' \end{pmatrix}, \tag{8}$$ which is equivalent to $$(4)$$.