Differential EquationsIntroduction to Systems1 of 3
Introduction to Systems · 1

First-Order Systems

When two or more quantities change at the same time and affect each other, a single differential equation can no longer track them on its own, and we need a system of differential equations.

1

Systems of First-Order Equations and Arrow Fields

A system of first-order equations gives the first derivatives x′\xq{x'} and y′\yq{y'} in terms of the current state (x,y)(\xq{x}, \yq{y}):

x′=x−2yy′=3x+y\displaystyle \begin{aligned} \xq{x'} &= \xq{x} - 2\yq{y} \\ \yq{y'} &= 3\xq{x} + \yq{y} \end{aligned}

Because y\yq{y} appears in the x′\xq{x'} equation and x\xq{x} appears in the y′\yq{y'} equation, the two rates of change depend on each other, and we track (x,y)(\xq{x}, \yq{y}) as a single point moving across a 2D grid.

Systems of First-Order Equations and Arrow Fields
{x′=x−2yy′=3x+y\left\{\begin{aligned} \htmlClass{lc-blue}{x'} &= \htmlClass{lc-blue}{x} - 2\htmlClass{lc-orange}{y} \\ \htmlClass{lc-orange}{y'} &= 3\htmlClass{lc-blue}{x} + \htmlClass{lc-orange}{y} \end{aligned}\right.
x\htmlClass{lc-blue}{x}
y\htmlClass{lc-orange}{y}
Text solution
Find the horizontal velocity x′\xq{x'} at (2,1)(2, 1)Substitute x=2\xq{x} = 2 and y=1\yq{y} = 1 into the first equation to see how fast the point moves left or right at this instant.
x′\displaystyle \xq{x'} =2−2(1)\displaystyle = \xq{2} - 2(\yq{1}) =0\displaystyle = 0
Find the vertical velocity y′\yq{y'} at (2,1)(2, 1)Substitute x=2\xq{x} = 2 and y=1\yq{y} = 1 into the second equation to see how fast the point moves up or down at the same instant.
y′\displaystyle \yq{y'} =3(2)+1\displaystyle = 3(\xq{2}) + \yq{1} =7\displaystyle = 7

At the point (2,1)(2, 1), the point is not moving horizontally (x′=0\xq{x'} = 0) and is moving straight up at a speed of 77 (y′=7\yq{y'} = 7).

−1\htmlClass{lc-mute}{-1}
−1\htmlClass{lc-mute}{-1}
1\htmlClass{lc-mute}{1}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
2\htmlClass{lc-mute}{2}
3\htmlClass{lc-mute}{3}
3\htmlClass{lc-mute}{3}
x\htmlClass{lc-blue}{x}
y\htmlClass{lc-orange}{y}
(2,1)(2, 1)
(0,7)\htmlClass{lc-pink}{(0, 7)}

For the system x′=x−2y\xq{x'} = \xq{x} - 2\yq{y}, y′=3x+y\yq{y'} = 3\xq{x} + \yq{y}, every point (x,y)(\xq{x}, \yq{y}) on the grid has its own velocity arrow (x′,y′)(\xq{x'}, \yq{y'}) and a path that follows the arrows from that point.

Where the point sits right now sets its velocity arrow from the two equations, and the solution path simply follows those arrows forward.
2

Checking a Solution to a System

As a point follows the arrows across the 2D grid over time tt, its coordinates trace out a pair of functions, x(t)\xq{x(t)} and y(t)\yq{y(t)}. Let's check whether the pair of functions

x(t)\displaystyle \xq{x(t)} =e−3t,y(t)\displaystyle = e^{-3t}, \quad \yq{y(t)} =−2e−3t\displaystyle = -2e^{-3t}

is a solution to the system

x′=x+2yy′=4x−y\displaystyle \begin{aligned} \xq{x'} &= \xq{x} + 2\yq{y} \\ \yq{y'} &= 4\xq{x} - \yq{y} \end{aligned}
Checking a Solution to a System
{x′=x+2yy′=4x−y\displaystyle \left\{\begin{aligned} \xq{x'} &= \xq{x} + 2\yq{y} \\ \yq{y'} &= 4\xq{x} - \yq{y} \end{aligned}\right.
x(t)=e−3ty(t)=−2e−3t\displaystyle \begin{aligned} \xq{x(t)} &= e^{-3t} \\ \yq{y(t)} &= -2e^{-3t} \end{aligned}
a solution?\displaystyle \text{a solution?}
Text solution
Differentiate x(t)\xq{x(t)} and y(t)\yq{y(t)}Find the first derivative of each function so we can compare them with the right-hand sides of the system.
x′(t)\displaystyle \xq{x'(t)} =−3e−3t,y′(t)\displaystyle = -3e^{-3t}, \quad \yq{y'(t)} =6e−3t\displaystyle = 6e^{-3t}
Substitute into the x′\xq{x'} equationPlug x(t)\xq{x(t)} and y(t)\yq{y(t)} into x+2y\xq{x} + 2\yq{y} to check that the right side matches x′(t)=−3e−3t\xq{x'(t)} = -3e^{-3t}.
x+2y=e−3t+2(−2e−3t)=e−3t−4e−3t=−3e−3t\displaystyle \begin{aligned} \xq{x} + 2\yq{y} &= \xq{e^{-3t}} + 2(\yq{-2e^{-3t}}) \\ &= e^{-3t} - 4e^{-3t} \\ &= -3e^{-3t} \end{aligned}
Substitute into the y′\yq{y'} equationPlug x(t)\xq{x(t)} and y(t)\yq{y(t)} into 4x−y4\xq{x} - \yq{y} to check that the second equation also matches y′(t)=6e−3t\yq{y'(t)} = 6e^{-3t}.
4x−y=4e−3t−(−2e−3t)=4e−3t+2e−3t=6e−3t\displaystyle \begin{aligned} 4\xq{x} - \yq{y} &= 4\xq{e^{-3t}} - (\yq{-2e^{-3t}}) \\ &= 4e^{-3t} + 2e^{-3t} \\ &= 6e^{-3t} \end{aligned}

Because x′=x+2y\xq{x'} = \xq{x} + 2\yq{y} and y′=4x−y\yq{y'} = 4\xq{x} - \yq{y} both hold at the same time, the pair x(t)=e−3t\xq{x(t)} = e^{-3t}, y(t)=−2e−3t\yq{y(t)} = -2e^{-3t} is a solution to the system.

3

Turning a Second-Order Equation into a First-Order System

Following arrows works on a first-order system because the current state tells us where to go next, but that doesn't work on a single second-order equation like the damped spring initial value problem

x′′+3x′+2x\displaystyle \curv{x''} + 3\rate{x'} + 2\unknown{x} =0,x(0)\displaystyle = 0, \quad \unknown{x(0)} =1,x′(0)\displaystyle = 1, \quad \rate{x'(0)} =0\displaystyle = 0

Knowing only the position x=1\unknown{x} = 1 on a 1D line does not tell us which way the weight is moving or what its acceleration x′′\curv{x''} is. To get an arrow field back, we rewrite this single second-order equation in First-Order Form by making the velocity v=x′\rate{v} = \rate{x'} its own state variable alongside position x\unknown{x}.

Turning a Second-Order Equation into a First-Order System
F=ma,a=x′′x′′+3x′+2x=0\begin{aligned} &F = ma, \quad a = \htmlClass{lc-orange}{x''} \\ &\htmlClass{lc-orange}{x''} + 3\htmlClass{lc-pink}{x'} + 2\htmlClass{lc-blue}{x} = 0 \end{aligned}
x=0\htmlClass{lc-blue}{x} = 0
Text solution
Isolate the highest derivative x′′\curv{x''}Move the lower-order terms to the right side so acceleration is written in terms of position and velocity.
x′′\displaystyle \curv{x''} =−2x−3x′\displaystyle = -2\unknown{x} - 3\rate{x'}
Make the first derivative a new variable v\rate{v}Track both position x\unknown{x} and velocity v=x′\rate{v} = \rate{x'} as the two coordinates of our state.
x\displaystyle \unknown{x} =position,v\displaystyle = \text{position}, \quad \rate{v} =x′\displaystyle = \rate{x'}
Write the first derivative of each state variableThe rate of change of x\unknown{x} is v\rate{v} by definition, and the rate of change of v\rate{v} is x′′\curv{x''}, where we replace x′\rate{x'} with v\rate{v} in our isolated equation.
x′=vv′⏟x′′=−2x−3v⏟x′\displaystyle \begin{aligned} x' &= \rate{v} \\ \underbrace{v'}_{\curv{x''}} &= -2\unknown{x} - 3\underbrace{\rate{v}}_{\rate{x'}} \end{aligned}
Rewrite the initial conditions as a starting point (x(0),v(0))(\unknown{x(0)}, \rate{v(0)})Replace x′(0)=0\rate{x'(0)} = 0 with v(0)=0\rate{v(0)} = 0 to get the starting coordinates on the 2D position-velocity grid.
x(0)\displaystyle \unknown{x(0)} =1,v(0)\displaystyle = 1, \quad \rate{v(0)} =0\displaystyle = 0

In First-Order Form, the spring problem becomes the system x′=vx' = \rate{v}, v′=−2x−3vv' = -2\unknown{x} - 3\rate{v} starting at (1,0)(1, 0), where the starting arrow (x′,v′)=(0,−2)(x', v') = (0, -2) makes the velocity negative (v<0\rate{v} < 0) right after the start, and following the arrows from there, the path approaches (0,0)(0, 0): the weight comes back toward rest at position 00 without passing it.

For the damped spring x′′+3x′+2x=0\curv{x''} + 3\rate{x'} + 2\unknown{x} = 0, starting at the same position x=1\unknown{x} = 1 with different initial velocities v\rate{v} traces out different paths on the (x,v)(\unknown{x}, \rate{v}) grid, with the weight moving right whenever the path is in the upper half of the grid (v>0\rate{v} > 0) and left whenever it is in the lower half (v<0\rate{v} < 0).

From the same starting position, each starting velocity traces a different path on the grid, moving the weight right in the upper half and left in the lower half.
4

Converting Higher-Order Equations into First-Order Form

For equations with third or higher derivatives, we use numbered state variables x1,x2,x3,…\unknown{x_1}, \rate{x_2}, \curv{x_3}, \dots for the function and each of its derivatives up to one order below the highest derivative. Let's convert the third-order initial value problem

2y′′′+8y′′−10y′+4y=2cos⁡(t),y(0)=3,y′(0)=−1,y′′(0)=5\displaystyle \begin{gathered} 2y''' + 8\curv{y''} - 10\rate{y'} + 4\unknown{y} = \forcing{2\cos(t)}, \\ \unknown{y(0)} = 3, \quad \rate{y'(0)} = -1, \quad \curv{y''(0)} = 5 \end{gathered}

into First-Order Form.

Converting Higher-Order Equations into First-Order Form
2y′′′+8y′′−10y′+4y=2cos⁡(t)y(0)=3,y′(0)=−1,y′′(0)=5\displaystyle \footnotesize\begin{gathered} 2y''' + 8\curv{y''} - 10\rate{y'} + 4\unknown{y} = \forcing{2\cos(t)} \\ \unknown{y(0)} = 3,\;\; \rate{y'(0)} = -1,\;\; \curv{y''(0)} = 5 \end{gathered}
x1′\displaystyle x_1' =  ?,x2′\displaystyle = \;?, \quad x_2' =  ?,x3′\displaystyle = \;?, \quad x_3' =  ?\displaystyle = \;?
Text solution
Isolate the highest derivative y′′′y'''Move the lower-order terms to the right side in order from y\unknown{y} up to y′′\curv{y''}, and divide every term by the leading coefficient 22.
2y′′′=−4y+10y′−8y′′+2cos⁡(t)y′′′=−2y+5y′−4y′′+cos⁡(t)\displaystyle \begin{aligned} 2y''' &= -4\unknown{y} + 10\rate{y'} - 8\curv{y''} + \forcing{2\cos(t)} \\ y''' &= -2\unknown{y} + 5\rate{y'} - 4\curv{y''} + \forcing{\cos(t)} \end{aligned}
Name the state variables up to one order below y′′′y'''Set x1,x2,x3\unknown{x_1}, \rate{x_2}, \curv{x_3} equal to y,y′,y′′\unknown{y}, \rate{y'}, \curv{y''}.
x1\displaystyle \unknown{x_1} =y,x2\displaystyle = \unknown{y}, \quad \rate{x_2} =y′,x3\displaystyle = \rate{y'}, \quad \curv{x_3} =y′′\displaystyle = \curv{y''}
Write the derivative of each state variableThe derivative of each variable is simply the next variable on the list until x3′=y′′′x_3' = y''', where we substitute x1,x2,x3\unknown{x_1}, \rate{x_2}, \curv{x_3} into the isolated equation for y′′′y'''.
x1′=x2x2′=x3x3′⏟y′′′=−2x1⏟y+5x2⏟y′−4x3⏟y′′+cos⁡(t)\displaystyle \begin{aligned} x_1' &= \rate{x_2} \\ x_2' &= \curv{x_3} \\ \underbrace{x_3'}_{y'''} &= -2\underbrace{\unknown{x_1}}_{\unknown{y}} + 5\underbrace{\rate{x_2}}_{\rate{y'}} - 4\underbrace{\curv{x_3}}_{\curv{y''}} + \forcing{\cos(t)} \end{aligned}
Match the initial conditions to x1(0),x2(0),x3(0)\unknown{x_1(0)}, \rate{x_2(0)}, \curv{x_3(0)}Copy the starting values of y,y′,y′′\unknown{y}, \rate{y'}, \curv{y''} directly to their new variable names.
x1(0)\displaystyle \unknown{x_1(0)} =3,x2(0)\displaystyle = 3, \quad \rate{x_2(0)} =−1,x3(0)\displaystyle = -1, \quad \curv{x_3(0)} =5\displaystyle = 5

The third-order equation is now a system of three first-order equations starting at (3,−1,5)(3, -1, 5), where the first two equations just set each derivative equal to the next variable on the list and only the last equation uses the rearranged differential equation.

5

Packing and Unpacking Matrix Form

To avoid writing the variable names x1,x2,x3\unknown{x_1}, \rate{x_2}, \curv{x_3} over and over, we can pack a linear first-order system into Matrix Form, or use row-by-column multiplication to unpack a matrix system like

[x′y′]=[4−123][xy]+[et−5]\displaystyle \begin{bmatrix} \xq{x'} \\ \yq{y'} \end{bmatrix} = \begin{bmatrix} 4 & -1 \\ 2 & 3 \end{bmatrix} \begin{bmatrix} \xq{x} \\ \yq{y} \end{bmatrix} + \begin{bmatrix} \forcing{e^t} \\ \forcing{-5} \end{bmatrix}

back into individual equations.

Packing and Unpacking Matrix Form
x1′=x2x2′=x3x3′=−2x1+5x2−4x3+cos⁡(t)\displaystyle \small\begin{aligned} x_1' &= \rate{x_2} \\ x_2' &= \curv{x_3} \\ x_3' &= -2\unknown{x_1} + 5\rate{x_2} - 4\curv{x_3} \\ &\qquad + \forcing{\cos(t)} \end{aligned}
[x1′x2′x3′]=  ?\displaystyle \begin{bmatrix} x_1' \\ x_2' \\ x_3' \end{bmatrix} = \;?
Text solution
Line up the state variables in columns with 00s for missing termsWrite our three-equation system from the previous example so every row has a spot for x1,x2,x3\unknown{x_1}, \rate{x_2}, \curv{x_3} and the forcing term in the same order.
x1′=0x1+1x2+0x3+0x2′=0x1+0x2+1x3+0x3′=−2x1+5x2−4x3+cos⁡(t)\displaystyle \begin{aligned} x_1' &= 0\unknown{x_1} &&{}+ 1\rate{x_2} &&{}+ 0\curv{x_3} &&{}+ 0 \\ x_2' &= 0\unknown{x_1} &&{}+ 0\rate{x_2} &&{}+ 1\curv{x_3} &&{}+ 0 \\ x_3' &= -2\unknown{x_1} &&{}+ 5\rate{x_2} &&{}- 4\curv{x_3} &&{}+ \forcing{\cos(t)} \end{aligned}
Pack the coefficients and initial values into matricesPut the grid of coefficients in front of the column of state variables, add the column of forcing terms at the end, and stack the initial conditions into a column.
[x1′x2′x3′]=[010001−25−4]⏟coefficient matrix[x1x2x3]⏟state column+[00cos⁡(t)]⏟forcing column,[x1(0)x2(0)x3(0)]=[3−15]\displaystyle \begin{aligned} \begin{bmatrix} x_1' \\ x_2' \\ x_3' \end{bmatrix} &= \underbrace{\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -2 & 5 & -4 \end{bmatrix}}_{\text{coefficient matrix}} \underbrace{\begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \\ \curv{x_3} \end{bmatrix}}_{\text{state column}} + \underbrace{\begin{bmatrix} 0 \\ 0 \\ \forcing{\cos(t)} \end{bmatrix}}_{\text{forcing column}}, \\ \begin{bmatrix} \unknown{x_1(0)} \\ \rate{x_2(0)} \\ \curv{x_3(0)} \end{bmatrix} &= \begin{bmatrix} 3 \\ -1 \\ 5 \end{bmatrix} \end{aligned}
Unpack a matrix system using row-by-column multiplicationFor the 2×22 \times 2 example, multiply across each row of [4−123]\begin{bmatrix} 4 & -1 \\ 2 & 3 \end{bmatrix} and down the column [xy]\begin{bmatrix} \xq{x} \\ \yq{y} \end{bmatrix}, then add the matching forcing term from [et−5]\begin{bmatrix} \forcing{e^t} \\ \forcing{-5} \end{bmatrix}.
x′=4x−y+ety′=2x+3y−5\displaystyle \begin{aligned} \xq{x'} &= 4\xq{x} - \yq{y} + \forcing{e^t} \\ \yq{y'} &= 2\xq{x} + 3\yq{y} - \forcing{5} \end{aligned}

The matrix form and the separate equations are two ways of writing the exact same system: each row of the matrix holds the coefficients for one first-order equation.

6

Linear vs. Nonlinear First-Order Systems

Every system we packed into a matrix so far was linear, meaning the state variables only appear to the first power multiplied by numbers or functions of tt. What happens when we convert an equation with a squared term like

y′′+3ty′−y2\displaystyle \curv{y''} + 3t\rate{y'} - \unknown{y^2} =et\displaystyle = \forcing{e^t}

into First-Order Form and try to pack it into a matrix?

Linear vs. Nonlinear First-Order Systems
y′′+3ty′−y2\displaystyle \curv{y''} + 3t\rate{y'} - \unknown{y^2} =et\displaystyle = \forcing{e^t}
First-Order Form?\displaystyle \text{First-Order Form?}
Matrix Form?\displaystyle \text{Matrix Form?}
Text solution
Isolate y′′\curv{y''} and convert to First-Order Form using x1=y,x2=y′\unknown{x_1} = \unknown{y}, \rate{x_2} = \rate{y'}Turning derivatives into state variables works the exact same way whether the equation is linear or nonlinear.
y′′=y2−3ty′+etx1′=x2x2′=x12−3tx2+et\displaystyle \begin{aligned} \curv{y''} &= \unknown{y^2} - 3t\rate{y'} + \forcing{e^t} \\ x_1' &= \rate{x_2} \\ x_2' &= \unknown{x_1^2} - 3t\rate{x_2} + \forcing{e^t} \end{aligned}
Check how the state variables x1\unknown{x_1} and x2\rate{x_2} appear in each termSeparate the terms that only involve time tt or the first power of a state variable from any term where a state variable is raised to a power, multiplied by another state variable, or inside a function.
x2′\displaystyle x_2' =x12⏟nonlinear in x1−3tx2⏟linear in x2+et⏟forcing term in t\displaystyle = \underbrace{\unknown{x_1^2}}_{\text{nonlinear in } \unknown{x_1}} - \underbrace{3t\rate{x_2}}_{\text{linear in } \rate{x_2}} + \underbrace{\forcing{e^t}}_{\text{forcing term in } t}

Because the state variable x1\unknown{x_1} is squared, the system x1′=x2x_1' = \rate{x_2}, x2′=x12−3tx2+etx_2' = \unknown{x_1^2} - 3t\rate{x_2} + \forcing{e^t} is nonlinear: it still defines a valid first-order arrow field, but we stop at the first-order equations because it cannot be written as a matrix of tt-only functions multiplying [x1x2]\begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \end{bmatrix}.

7

Coupled Second-Order Systems in First-Order Form

Some physical problems start out as two second-order equations that depend on each other, such as two carts connected by springs with positions x\unknown{x} and y\unknown{y}:

x′′=−5x+2yy′′=2x−2y\displaystyle \begin{aligned} \curv{x''} &= -5\unknown{x} + 2\unknown{y} \\ \curv{y''} &= 2\unknown{x} - 2\unknown{y} \end{aligned}

To predict what both carts do next, we need four pieces of information at any instant: both positions (x,y\unknown{x}, \unknown{y}) and both velocities (x′,y′\rate{x'}, \rate{y'}). So we convert the pair of second-order equations into a system of four first-order equations.

Coupled Second-Order Systems in First-Order Form
x\htmlClass{lc-blue}{x}
y\htmlClass{lc-blue}{y}
x′′=−5x+2yy′′=2x−2y\begin{aligned} \htmlClass{lc-orange}{x''} &= -5\htmlClass{lc-blue}{x} + 2\htmlClass{lc-blue}{y} \\ \htmlClass{lc-orange}{y''} &= 2\htmlClass{lc-blue}{x} - 2\htmlClass{lc-blue}{y} \end{aligned}
Text solution
Name a position variable and a velocity variable for each cartSet x1,x2\unknown{x_1}, \rate{x_2} equal to x\unknown{x} and x′\rate{x'}, and set x3,x4\unknown{x_3}, \rate{x_4} equal to y\unknown{y} and y′\rate{y'}.
x1\displaystyle \unknown{x_1} =x,x2\displaystyle = \unknown{x}, \quad \rate{x_2} =x′,x3\displaystyle = \rate{x'}, \quad \unknown{x_3} =y,x4\displaystyle = \unknown{y}, \quad \rate{x_4} =y′\displaystyle = \rate{y'}
Write the first derivative of each of the four state variablesThe derivatives of the position variables are their velocity variables (x1′=x2x_1' = \rate{x_2} and x3′=x4x_3' = \rate{x_4}), while the derivatives of the velocities (x2′=x′′x_2' = \curv{x''} and x4′=y′′x_4' = \curv{y''}) come from substituting x1=x\unknown{x_1} = \unknown{x} and x3=y\unknown{x_3} = \unknown{y} into the two second-order equations.
x1′=x2x2′⏟x′′=−5x1⏟x+2x3⏟yx3′=x4x4′⏟y′′=2x1⏟x−2x3⏟y\displaystyle \begin{aligned} x_1' &= \rate{x_2} \\ \underbrace{x_2'}_{\curv{x''}} &= -5\underbrace{\unknown{x_1}}_{\unknown{x}} + 2\underbrace{\unknown{x_3}}_{\unknown{y}} \\ x_3' &= \rate{x_4} \\ \underbrace{x_4'}_{\curv{y''}} &= 2\underbrace{\unknown{x_1}}_{\unknown{x}} - 2\underbrace{\unknown{x_3}}_{\unknown{y}} \end{aligned}

The two coupled second-order equations become a system of four first-order equations tracking the full state (x1,x2,x3,x4)=(x,x′,y,y′)(\unknown{x_1}, \rate{x_2}, \unknown{x_3}, \rate{x_4}) = (\unknown{x}, \rate{x'}, \unknown{y}, \rate{y'}).

Key concepts

First-order systems and solutions

A first-order system like x′=x−2y\xq{x'} = \xq{x} - 2\yq{y}, y′=3x+y\yq{y'} = 3\xq{x} + \yq{y} gives a velocity arrow (x′,y′)(\xq{x'}, \yq{y'}) at every point (x,y)(\xq{x}, \yq{y}) on the grid. A pair of functions x(t),y(t)\xq{x(t)}, \yq{y(t)} is a solution only if substituting them makes every equation in the system hold at the same time.

Converting higher-order equations into First-Order Form

Isolate the highest derivative first, then name one state variable for the function and each derivative up to one order below the highest:

  • For a single nnth-order equation like 2y′′′+8y′′−10y′+4y=2cos⁡(t)2y''' + 8\curv{y''} - 10\rate{y'} + 4\unknown{y} = \forcing{2\cos(t)}, isolating y′′′=−2y+5y′−4y′′+cos⁡(t)y''' = -2\unknown{y} + 5\rate{y'} - 4\curv{y''} + \forcing{\cos(t)} and setting x1=y,x2=y′,x3=y′′\unknown{x_1} = \unknown{y}, \rate{x_2} = \rate{y'}, \curv{x_3} = \curv{y''} gives x1′=x2x_1' = \rate{x_2} and x2′=x3x_2' = \curv{x_3}, with the isolated equation in the last equation: x3′=−2x1+5x2−4x3+cos⁡(t)x_3' = -2\unknown{x_1} + 5\rate{x_2} - 4\curv{x_3} + \forcing{\cos(t)}.
  • For a coupled second-order system like x′′=−5x+2y\curv{x''} = -5\unknown{x} + 2\unknown{y}, y′′=2x−2y\curv{y''} = 2\unknown{x} - 2\unknown{y}, give each variable its own position-velocity pair (x1=x,x2=x′\unknown{x_1} = \unknown{x}, \rate{x_2} = \rate{x'} and x3=y,x4=y′\unknown{x_3} = \unknown{y}, \rate{x_4} = \rate{y'}). This gives two separate pairs of equations: x1′=x2x_1' = \rate{x_2} with x2′=−5x1+2x3x_2' = -5\unknown{x_1} + 2\unknown{x_3}, and x3′=x4x_3' = \rate{x_4} with x4′=2x1−2x3x_4' = 2\unknown{x_1} - 2\unknown{x_3} (never x2′=x3x_2' = \unknown{x_3}).
When to pack into Matrix Form (and when not to)

Check what happens to the state variables x1,x2,…\unknown{x_1}, \rate{x_2}, \dots on the right-hand side:

  • Linear in the state variables (even when multiplied by functions of tt like −3tx2-3t\rate{x_2} or with forcing terms like cos⁡(t)\forcing{\cos(t)}): line up the x1,x2,x3\unknown{x_1}, \rate{x_2}, \curv{x_3} columns with 00s for missing variables, and pack the coefficients into a matrix multiplying the state column:
    [x1′x2′x3′]=[010001−25−4][x1x2x3]+[00cos⁡(t)]\displaystyle \begin{bmatrix} x_1' \\ x_2' \\ x_3' \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -2 & 5 & -4 \end{bmatrix} \begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \\ \curv{x_3} \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ \forcing{\cos(t)} \end{bmatrix}
  • Nonlinear in any state variable (such as x12\unknown{x_1^2}, sin⁡(x1)\sin(\unknown{x_1}), ex2e^{\rate{x_2}}, or x1x2\unknown{x_1}\rate{x_2} in x2′=x12−3tx2+etx_2' = \unknown{x_1^2} - 3t\rate{x_2} + \forcing{e^t}): do not pack into Matrix Form. Stop right at the first-order equations, because the coefficient matrix can only hold numbers and functions of tt, never the state variables themselves.
8

Practice

1

For the system x′=2x−3y\xq{x'} = 2\xq{x} - 3\yq{y}, y′=x−4y\yq{y'} = \xq{x} - 4\yq{y}, find (x′,y′)(\xq{x'}, \yq{y'}) at the instant when the state is at (3,2)(3, 2), and describe how the point is moving on the 2D grid at that instant.

Substitute x=3\xq{x} = 3 and y=2\yq{y} = 2 into both equations; which component of (x′,y′)(\xq{x'}, \yq{y'}) gives left-right motion and which gives up-down motion?

Plug x=3\xq{x} = 3 and y=2\yq{y} = 2 into each equation (watch out for swapping the coordinates into x=2,y=3\xq{x} = 2, \yq{y} = 3, which gives (−5,−10)(-5, -10)):
x′=2(3)−3(2)=0y′=3−4(2)=−5\displaystyle \begin{aligned} \xq{x'} &= 2(\xq{3}) - 3(\yq{2}) = 0 \\ \yq{y'} &= \xq{3} - 4(\yq{2}) = -5 \end{aligned}
Because x′=0\xq{x'} = 0 is horizontal velocity and y′=−5\yq{y'} = -5 is vertical velocity (don't read (0,−5)(0, -5) as moving left just because −5-5 is negative), at (3,2)(3, 2) the point is not moving left or right and is moving straight down at a speed of 55.
2

For the system x′=5x−y\xq{x'} = 5\xq{x} - \yq{y}, y′=4x\yq{y'} = 4\xq{x}, determine whether each pair of functions is a solution: (a) x(t)=e2t\xq{x(t)} = e^{2t}, y(t)=3e2t\yq{y(t)} = 3e^{2t} and (b) x(t)=e4t\xq{x(t)} = e^{4t}, y(t)=e4t\yq{y(t)} = e^{4t}.

Differentiate x(t)\xq{x(t)} and y(t)\yq{y(t)} first using the chain rule, then test whether both equations hold before deciding.

(a)Differentiating gives x′(t)=2e2t\xq{x'(t)} = 2e^{2t} and y′(t)=6e2t\yq{y'(t)} = 6e^{2t} (don't forget to multiply by 22 from the chain rule, which would leave x′=e2t\xq{x'} = e^{2t}). In the first equation, x′=2e2t\xq{x'} = 2e^{2t} and 5x−y=5e2t−3e2t=2e2t5\xq{x} - \yq{y} = 5\xq{e^{2t}} - \yq{3e^{2t}} = 2e^{2t}, which matches. Don't stop after the first equation and say (a) is a solution. Check the second equation too: y′=6e2t\yq{y'} = 6e^{2t} while 4x=4e2t4\xq{x} = 4\xq{e^{2t}}. Because the second equation fails, (a) is not a solution.
(b)Differentiating gives x′(t)=4e4t\xq{x'(t)} = 4e^{4t} and y′(t)=4e4t\yq{y'(t)} = 4e^{4t}. In the first equation, x′=4e4t\xq{x'} = 4e^{4t} and 5x−y=5e4t−e4t=4e4t5\xq{x} - \yq{y} = 5\xq{e^{4t}} - \yq{e^{4t}} = 4e^{4t}; in the second equation, y′=4e4t\yq{y'} = 4e^{4t} and 4x=4e4t4\xq{x} = 4\xq{e^{4t}}. Both hold, so (b) is a solution.
3

Unpack the matrix system

[x′y′]=[−2510][xy]+[0sin⁡(t)]\displaystyle \begin{bmatrix} \xq{x'} \\ \yq{y'} \end{bmatrix} = \begin{bmatrix} -2 & 5 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} \xq{x} \\ \yq{y} \end{bmatrix} + \begin{bmatrix} 0 \\ \forcing{\sin(t)} \end{bmatrix}

into two separate first-order differential equations.

Go across each row of [−2510]\begin{bmatrix} -2 & 5 \\ 1 & 0 \end{bmatrix} and down the column [xy]\begin{bmatrix} \xq{x} \\ \yq{y} \end{bmatrix}, then add the matching entry from the forcing column at the end.

Multiply each row of the matrix by the column [xy]\begin{bmatrix} \xq{x} \\ \yq{y} \end{bmatrix} (don't multiply down the matrix columns, which gives x′=−2x+y\xq{x'} = -2\xq{x} + \yq{y}, and don't attach y\yq{y} to sin⁡(t)\forcing{\sin(t)} as y′=x+ysin⁡(t)\yq{y'} = \xq{x} + \yq{y}\forcing{\sin(t)}; the coefficient of y\yq{y} in the bottom row is 00, and sin⁡(t)\forcing{\sin(t)} is added afterward):
x′=−2x+5yy′=x+sin⁡(t)\displaystyle \begin{aligned} \xq{x'} &= -2\xq{x} + 5\yq{y} \\ \yq{y'} &= \xq{x} + \forcing{\sin(t)} \end{aligned}
4

Convert the third-order initial value problem 3y′′′−6y′′+9y=3et3y''' - 6\curv{y''} + 9\unknown{y} = \forcing{3e^t}, y(0)=2\unknown{y(0)} = 2, y′(0)=0\rate{y'(0)} = 0, y′′(0)=−4\curv{y''(0)} = -4 into First-Order Form using x1=y\unknown{x_1} = \unknown{y}, x2=y′\rate{x_2} = \rate{y'}, x3=y′′\curv{x_3} = \curv{y''}, and then write the system and initial conditions in Matrix Form.

Isolate y′′′y''' first by moving −6y′′+9y-6\curv{y''} + 9\unknown{y} to the right and dividing by 33; when you line up the columns for the matrix, check which derivative is missing from the equation.

Isolate y′′′y''' by moving the lower-order terms to the right and dividing by 33 (copying coefficients before isolating and dividing by 33 gives the wrong bottom row [9,0,−6][9, 0, -6]):
y′′′\displaystyle y''' =−3y+2y′′+et\displaystyle = -3\unknown{y} + 2\curv{y''} + \forcing{e^t}
Substituting x1=y,x2=y′,x3=y′′\unknown{x_1} = \unknown{y}, \rate{x_2} = \rate{y'}, \curv{x_3} = \curv{y''} gives the first-order system x1′=x2x_1' = \rate{x_2}, x2′=x3x_2' = \curv{x_3}, x3′=−3x1+2x3+etx_3' = -3\unknown{x_1} + 2\curv{x_3} + \forcing{e^t} with x1(0)=2\unknown{x_1(0)} = 2, x2(0)=0\rate{x_2(0)} = 0, x3(0)=−4\curv{x_3(0)} = -4.
When packing the bottom row of the matrix, notice that y′\rate{y'} (x2\rate{x_2}) is missing, so put 00 in the second spot (writing [−3,2,0][-3, 2, 0] instead of [−3,0,2][-3, 0, 2] multiplies 22 by x2=y′\rate{x_2} = \rate{y'} instead of x3=y′′\curv{x_3} = \curv{y''}):
[x1′x2′x3′]=[010001−302][x1x2x3]+[00et],[x1(0)x2(0)x3(0)]=[20−4]\displaystyle \begin{aligned} \begin{bmatrix} x_1' \\ x_2' \\ x_3' \end{bmatrix} &= \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ -3 & 0 & 2 \end{bmatrix} \begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \\ \curv{x_3} \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ \forcing{e^t} \end{bmatrix}, \\ \begin{bmatrix} \unknown{x_1(0)} \\ \rate{x_2(0)} \\ \curv{x_3(0)} \end{bmatrix} &= \begin{bmatrix} 2 \\ 0 \\ -4 \end{bmatrix} \end{aligned}
5

Convert both (a) y′′+t2y′−cos⁡(t)y=ln⁡(t)y'' + t^2y' - \cos(t)y = \ln(t) and (b) y′′+4y′+sin⁡(y)=0y'' + 4y' + \sin(y) = 0 into first-order systems using x1=yx_1 = y, x2=y′x_2 = y'. State which system is linear and write only that system in Matrix Form.

After isolating y′′y'' in both equations, look at what is inside t2,cos⁡(t),ln⁡(t),t^2, \cos(t), \ln(t), and sin⁡(y)\sin(y): is it the time variable tt or a state variable x1,x2x_1, x_2?

Isolating y′′\curv{y''} and substituting x1=y,x2=y′\unknown{x_1} = \unknown{y}, \rate{x_2} = \rate{y'} gives:
(a)x1′=x2x_1' = \rate{x_2}, x2′=cos⁡(t)x1−t2x2+ln⁡(t)x_2' = \cos(t)\unknown{x_1} - t^2\rate{x_2} + \forcing{\ln(t)}
(b)x1′=x2x_1' = \rate{x_2}, x2′=−sin⁡(x1)−4x2x_2' = -\sin(\unknown{x_1}) - 4\rate{x_2} System (a) is linear because the state variables x1\unknown{x_1} and x2\rate{x_2} only appear to the first power multiplied by functions of tt (don't let t2,cos⁡(t),t^2, \cos(t), and ln⁡(t)\ln(t) trick you into calling (a) nonlinear, since those functions only act on the time variable tt), whereas (b) is nonlinear because the state variable x1\unknown{x_1} is inside sin⁡(x1)\sin(\unknown{x_1}) (don't try to put (b) into a matrix like [01−sin⁡(1)−4]\begin{bmatrix} 0 & 1 \\ -\sin(1) & -4 \end{bmatrix}). Matrix Form for (a):
[x1′x2′]=[01cos⁡(t)−t2][x1x2]+[0ln⁡(t)]\displaystyle \begin{bmatrix} x_1' \\ x_2' \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ \cos(t) & -t^2 \end{bmatrix} \begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \end{bmatrix} + \begin{bmatrix} 0 \\ \forcing{\ln(t)} \end{bmatrix}
6

Convert the coupled second-order system x′′+2x′=−4x+3y\curv{x''} + 2\rate{x'} = -4\unknown{x} + 3\unknown{y}, y′′=4x−3y+cos⁡(t)\curv{y''} = 4\unknown{x} - 3\unknown{y} + \forcing{\cos(t)} into a system of four first-order equations using x1=x\unknown{x_1} = \unknown{x}, x2=x′\rate{x_2} = \rate{x'}, x3=y\unknown{x_3} = \unknown{y}, x4=y′\rate{x_4} = \rate{y'}, and write the system in Matrix Form.

Isolate x′′\curv{x''} in the first equation first; then check what the derivative of x2=x′\rate{x_2} = \rate{x'} is, remembering that x3=y\unknown{x_3} = \unknown{y} starts the pair for y\unknown{y} and is not x′′\curv{x''}.

First subtract 2x′2\rate{x'} from both sides of the first equation to get x′′=−4x−2x′+3y\curv{x''} = -4\unknown{x} - 2\rate{x'} + 3\unknown{y} (moving +2x′+2\rate{x'} across the equals sign without flipping its sign leaves +2x2+2\rate{x_2} instead of −2x2-2\rate{x_2}).
Then write the derivative of each state variable (don't write x2′=x3x_2' = \unknown{x_3} out of habit from single third-order equations; here x2=x′\rate{x_2} = \rate{x'}, so x2′=x′′x_2' = \curv{x''}, while x3=y\unknown{x_3} = \unknown{y} starts the pair for y\unknown{y}):
x1′=x2x2′=−4x1−2x2+3x3x3′=x4x4′=4x1−3x3+cos⁡(t)\displaystyle \begin{aligned} x_1' &= \rate{x_2} \\ x_2' &= -4\unknown{x_1} - 2\rate{x_2} + 3\unknown{x_3} \\ x_3' &= \rate{x_4} \\ x_4' &= 4\unknown{x_1} - 3\unknown{x_3} + \forcing{\cos(t)} \end{aligned}
In Matrix Form:
[x1′x2′x3′x4′]=[0100−4−230000140−30][x1x2x3x4]+[000cos⁡(t)]\displaystyle \begin{aligned} \begin{bmatrix} x_1' \\ x_2' \\ x_3' \\ x_4' \end{bmatrix} &= \begin{bmatrix} 0 & 1 & 0 & 0 \\ -4 & -2 & 3 & 0 \\ 0 & 0 & 0 & 1 \\ 4 & 0 & -3 & 0 \end{bmatrix} \begin{bmatrix} \unknown{x_1} \\ \rate{x_2} \\ \unknown{x_3} \\ \rate{x_4} \end{bmatrix} \\ &\quad + \begin{bmatrix} 0 \\ 0 \\ 0 \\ \forcing{\cos(t)} \end{bmatrix} \end{aligned}