# Plotting a system of linear ODE

I would like to plot a system of following ODE:

$$$$\mathbf{\dot{x}} = \mathbf{Ax} \text{ where } \mathbf{A} = \begin{bmatrix} -2 & 1 \\ -1 & 0 \end{bmatrix}$$$$

with general solution:

$$$$\vec{x}(t)=C_1 \begin{bmatrix} 1 \\ 1 \end{bmatrix} e^{-t}+C_2 \left(\begin{bmatrix} 0 \\ 1 \end{bmatrix}+\begin{bmatrix} 1 \\ 1 \end{bmatrix} t \right) e^{-t}$$$$

I know that this system is stable so arrows will be inward-pointing, also it has double eigenvalue at -1 so there will be an constant line for an eigenvalue crossing the plot but I am not sure how to fill the rest of the phase diagram. Could someone help me? Thanks in advance.

• I think you have a mistake. Shouldn't this system have a double eigenvalue of 1, not -1? – Josh B. Nov 4 '18 at 16:29
• @JoshB. I think the eigenvalue is given by $$\lambda^2+2\lambda+1$$ unless I made a mistake but I double checked the solution using Matlab – 1muflon1 Nov 4 '18 at 16:33
• If that's the case, then there is a typo in your matrix here. I just checked and the matrix you have definitely has a double eigenvalue of 1. – Josh B. Nov 4 '18 at 16:39
• @JoshB. You were correct the typo was 2 instead of -2. My bad. I am really sorry, I was copy pasting it from my latex and somehow I did not included the minus sign, dont know how did I even managed to do it – 1muflon1 Nov 4 '18 at 16:41

If you write your solution now as $$\vec{x}(t)=\left(C_1\begin{bmatrix} 1 \\ 1 \end{bmatrix}+C_2\begin{bmatrix} 0 \\ 1\end{bmatrix}\right)e^{-t}+C_2\begin{bmatrix}1 \\ 1\end{bmatrix}te^{-t}$$

it may be a little easier to see what's going on. As $$t\to\pm\infty$$, the equation is dominated by the second term, so $$\vec{x}(t)\approx C_2\begin{bmatrix} 1 \\ 1\end{bmatrix}te^{-t}\;\;\;\;\;\;\;\;\;\;\;t\to\pm\infty$$

As $$t\to\infty$$, the whole thing decays to $$0$$, so it makes sense that all solution curves begin to look like they fall along this eigenvector as they decay to $$0$$. Applying the same logic as $$t\to-\infty$$, it would seem that solutions grow along this vector as well, but this is only true on a macroscopic scale, as the solutions are growing exponentially in both directions. The first term, no longer decaying to $$0$$, shifts the solution away from the eigenvector and is growing large, but not as large as the second term. This means that when zoomed in, solutions look like they are leaving the eigenvector, but zoomed out solutions look like they are along the eigenvector (that is, until you let time grow large enough, in which you will see it move away slowly).

The last thing to consider is the direction of the curve. Suppose that $$\vec{x}$$ is in the first quadrant as $$t\to\infty$$. This means that $$C_2$$ is positive, so if $$t\to-\infty$$, then the sign on the second term is now negative, and the solution turns around to enter the third quadrant. This means that solutions sort of "spin" by turning $$180^\circ$$ around while still growing away from the origin.

The vector $$\begin{bmatrix} 0 \\ 1\end{bmatrix}$$ tells you which way the solution spins. If $$C_2$$ is positive, then that means that at $$t=0$$, the solution is above (in the xy-plane) of the line through the vector $$\begin{bmatrix} 1 \\ 1\end{bmatrix}$$ and the origin, so the solution must remain on this side of said line. The dominating term is in the first quadrant as $$t\to\infty$$, so the solution must spin clockwise to decay this way. It turns out that if solutions spin clockwise on one side of the eigenvector, they do the same on the other side as well; the same is true if they spin counterclockwise.

This type of equilibrium is called a Degenerate Node, in case you were curious. Here is an example of what one might look like.

• Thank you for very clear and detailed answer. By the way did you made the plot in matlab,? I know that it was not part of my original question and matlab inquiries dont really belong to math section, but would you mind sharing your code? I would like to learn how to do it. Or did you used another program? – 1muflon1 Nov 4 '18 at 17:36
• No, I pulled it from the encyclopedia of mathematics. Plotting this in MATLAB could be done by taking a spacing of points for t and plugging them in for x and y, then plotting the resulting curve. This would need to be done for a few different initial points to get a good diagram. – Josh B. Nov 4 '18 at 17:44