Systems of First-Order Differential Equations

April 13, 2026

Problem

Solve dx/dt = x + y, dy/dt = -x + y. Find the eigenvalues of the system matrix, recognise a spiral, and show the outward-spiraling solution in the phase plane.

Explanation

Why systems?

Many real-world models are coupled: predator–prey, chemical reactions, electrical circuits with multiple loops, mechanical systems with several degrees of freedom. These are naturally systems of first-order ODEs: x=F(t,x),x=(x1,,xn).\mathbf{x}' = \mathbf{F}(t, \mathbf{x}), \qquad \mathbf{x} = (x_1, \ldots, x_n).

For linear constant-coefficient systems, this simplifies to x=Ax\mathbf{x}' = A \mathbf{x} with a constant matrix AA, and we get to bring the full machinery of linear algebra (eigenvalues, eigenvectors, matrix exponentials) to bear.

Any higher-order linear ODE can also be converted into a first-order system — that's what numerical solvers like Runge-Kutta assume as input — so mastering systems pays twice.

The given system

dxdt=x+y,dydt=x+y.\frac{dx}{dt} = x + y, \qquad \frac{dy}{dt} = -x + y.

In matrix form: x=Ax,A=(1111),x=(xy).\mathbf{x}' = A \mathbf{x}, \quad A = \begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}, \quad \mathbf{x} = \begin{pmatrix} x \\ y \end{pmatrix}.

Step-by-step solution

Step 1 — Eigenvalues of AA.

det(AλI)=det(1λ111λ)=(1λ)2(1)(1)=(1λ)2+1.\det(A - \lambda I) = \det \begin{pmatrix} 1 - \lambda & 1 \\ -1 & 1 - \lambda \end{pmatrix} = (1 - \lambda)^{2} - (1)(-1) = (1 - \lambda)^{2} + 1.

Set to zero: (1λ)2=1    1λ=±i    λ=1±i.(1 - \lambda)^{2} = -1 \implies 1 - \lambda = \pm i \implies \lambda = 1 \pm i.

Complex conjugate eigenvalues with α=1,β=1\alpha = 1, \beta = 1.

Step 2 — Eigenvector for λ1=1+i\lambda_1 = 1 + i.

Solve (A(1+i)I)v=0(A - (1 + i) I) \mathbf{v} = \mathbf{0}: (i11i)(v1v2)=0.\begin{pmatrix} -i & 1 \\ -1 & -i \end{pmatrix} \begin{pmatrix} v_1 \\ v_2 \end{pmatrix} = \mathbf{0}.

Top row: iv1+v2=0    v2=iv1-i v_1 + v_2 = 0 \implies v_2 = i v_1. Take v=(1,i)T\mathbf{v} = (1, i)^{T}.

Step 3 — Complex exponential solution and its real form.

The complex solution is xc(t)=e(1+i)t(1i)=et(cost+isint)(1i).\mathbf{x}_c(t) = e^{(1 + i) t} \begin{pmatrix} 1 \\ i \end{pmatrix} = e^{t} (\cos t + i \sin t) \begin{pmatrix} 1 \\ i \end{pmatrix}.

Expand: =et(cost+isintsint+icost).= e^{t} \begin{pmatrix} \cos t + i \sin t \\ -\sin t + i \cos t \end{pmatrix}.

Real and imaginary parts are each a real solution. The general real solution is any linear combination: x(t)=et(C1cost+C2sintC1sint+C2cost)\boxed{\, \mathbf{x}(t) = e^{t} \begin{pmatrix} C_1 \cos t + C_2 \sin t \\ -C_1 \sin t + C_2 \cos t \end{pmatrix} \,}

Phase-plane interpretation

Eigenvalues λ=α±iβ\lambda = \alpha \pm i \beta with α=1>0\alpha = 1 > 0, β=1\beta = 1:

  • β0\beta \ne 0spiral (rotational component).
  • α>0\alpha > 0 → spiral outward (unstable spiral).

Every non-trivial solution is a spiral emerging from the origin with angular speed 11 (one rotation per 2π2 \pi time) and exponential growth rate 11 (amplitude doubles roughly every ln20.69\ln 2 \approx 0.69 time units).

Classification chart for 2D linear systems

By the eigenvalues of AA:

  • Real, same sign: node. Stable if both negative, unstable if both positive.
  • Real, opposite signs: saddle. Unstable; one stable manifold + one unstable manifold.
  • Repeated real root: degenerate or star node, depending on whether AA has a full basis of eigenvectors.
  • Complex conjugate, α>0\alpha > 0: unstable spiral. (This problem.)
  • Complex conjugate, α<0\alpha < 0: stable spiral.
  • Complex conjugate, α=0\alpha = 0: center — pure rotation, neither stable nor unstable.

The eigenvalues' positions in the complex plane (the root locus) tell you the whole story of the phase portrait. See #197 for pictures.

Initial value problem

x(0)=(1,0)T\mathbf{x}(0) = (1, 0)^{T}: (10)=(C1C2)    C1=1,  C2=0.\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} C_1 \\ C_2 \end{pmatrix} \implies C_1 = 1, \; C_2 = 0. x(t)=et(costsint).\mathbf{x}(t) = e^{t} \begin{pmatrix} \cos t \\ -\sin t \end{pmatrix}.

Check:

  • At t=0t = 0: (1,0)T(1, 0)^{T}. ✓
  • x(0)=Ax(0)=A(1,0)T=(1,1)T\mathbf{x}'(0) = A \mathbf{x}(0) = A (1, 0)^{T} = (1, -1)^{T}. Directly: x(t)=et(costsint,sintcost)T\mathbf{x}'(t) = e^{t} (\cos t - \sin t, -\sin t - \cos t)^{T}, at t=0t = 0: (1,1)T(1, -1)^{T}. ✓

As tt \to \infty, amplitude grows like ete^{t} and the vector rotates clockwise (because the angular phase sint-\sin t in the yy-component is clockwise). Classic outward spiral.

Matrix exponential viewpoint

The general solution can be written as x(t)=eAtx0\mathbf{x}(t) = e^{A t} \mathbf{x}_0 where eAte^{A t} is the matrix exponential: eAt=n=0(At)nn!.e^{A t} = \sum_{n = 0}^{\infty} \frac{(A t)^{n}}{n!}.

For our matrix AA, the clean formula is eAt=et(costsintsintcost)e^{A t} = e^{t} \begin{pmatrix} \cos t & \sin t \\ -\sin t & \cos t \end{pmatrix} (a scaled rotation). Applied to x0\mathbf{x}_0, it gives the solution with initial value x0\mathbf{x}_0.

This form is the generalisation of the scalar formula x(t)=eatx0x(t) = e^{a t} x_0 from x=axx' = a x. Very compact and conceptually clean.

Decoupling via eigenvectors

If AA has a basis of eigenvectors v1,,vn\mathbf{v}_1, \ldots, \mathbf{v}_n with eigenvalues λ1,,λn\lambda_1, \ldots, \lambda_n, the system decomposes into nn uncoupled scalar ODEs via the transformation x=Vy\mathbf{x} = V \mathbf{y} where V=[v1vn]V = [\mathbf{v}_1 | \ldots | \mathbf{v}_n]: y=V1AVy=Dy(diagonal).\mathbf{y}' = V^{-1} A V \mathbf{y} = D \mathbf{y} \quad \text{(diagonal)}.

Each yiy_i satisfies yi=λiyiy_i' = \lambda_i y_i, trivially solved.

From higher-order ODE to system

Any nn-th order ODE y(n)=f(t,y,y,,y(n1))y^{(n)} = f(t, y, y', \ldots, y^{(n-1)}) becomes a first-order system by setting x1=y,x2=y,,xn=y(n1)x_1 = y, x_2 = y', \ldots, x_n = y^{(n-1)}: x1=x2x2=x3xn=f(t,x1,,xn).\begin{aligned} x_1' &= x_2 \\ x_2' &= x_3 \\ &\vdots \\ x_n' &= f(t, x_1, \ldots, x_n). \end{aligned}

This is what numerical ODE solvers always expect.

Common mistakes

  • Forgetting to take real and imaginary parts. Complex eigenvalues give complex solutions; the physically relevant real solutions are the real and imaginary parts of the complex exponential.
  • Wrong orientation of the spiral. The sign convention depends on which axis you plot; always verify with a specific time check.
  • Mis-reading eigenvalue stability. Stability of x=Ax\mathbf{x}' = A \mathbf{x} is determined by real parts of eigenvalues of AA, not the eigenvalues themselves. λ=1+10i\lambda = -1 + 10 i means stable (real part <0< 0) even though λ|\lambda| is large.
  • Confusing "system" with "ODE." A system is a vector-valued ODE. Some textbooks and online resources mix the terms.

Try it in the visualization

Plot the trajectory in the (x,y)(x, y) phase plane as a spiral curve, with an overlay of the eigenvalue pair in the complex plane. Drag the initial condition — watch the same spiral shape, just starting from a different place (all trajectories are scalings / rotations of each other). Slide the coefficients of AA to move the eigenvalues across the imaginary axis and see the spiral flip between outward, circular (centre), and inward.

Interactive Visualization

Parameters

1.00
1.00
-1.00
1.00
1.00
0.00
4.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Systems of First-Order Differential Equations | MathSpin