# Linear Maps in the Plane
The map $y_{n+1} = a\,y_n$ from [[MATH310F26(Day 27) - One step at a time, no dice|Day 27]] has one number, $a$, and seven cases. With two populations the same idea needs a matrix,
$\mathbf z_{n+1} = J\,\mathbf z_n, \qquad \mathbf z_n = \begin{pmatrix} x_n \\ y_n \end{pmatrix}, \qquad J = \begin{pmatrix} J_{11} & J_{12} \\ J_{21} & J_{22} \end{pmatrix}.$
This is also what any two-variable map looks like close to one of its fixed points, with $J$ its Jacobian there and $\mathbf z$ the distance from the fixed point. That is how it connects to [[Predators and Prey in Seasons]]. The applet opens on that model's Jacobian at the class values, $J = \begin{pmatrix} 1 & -0.4 \\ 0.15 & 1 \end{pmatrix}$.
<div class="applet" data-applet="linear-map-2d"></div>
## Reading the applet
- **Eigenvalues (bottom).** The eigenvalues of $J$ are drawn in the complex plane with the unit circle $|\lambda| = 1$ dashed and its inside shaded. Drag them.
- A complex pair $a \pm ib$ always moves together as a mirror-image pair.
- Pull the pair down onto the real axis and it splits into two real eigenvalues, $\lambda_1$ (orange) and $\lambda_2$ (purple), which then move separately along the axis.
- Push the two real ones together and lift up to make a pair again.
- Near $|\lambda| = 1$, and near $\lambda = -1, 0, 1$ on the real axis, the dots snap onto those values.
- **Eigenvectors and shape (top).** The eigenvalues don't fix the whole picture.
- With two real eigenvalues, the orange and purple lines through the origin are the eigenvectors. Turn them with the handles.
- With a complex pair, the **stretch** and **tilt** sliders set the shape of the dashed ellipse. Each step moves the point around that ellipse, and grows or shrinks it by $|\lambda|$.
- **Orbits (top).** Click to add a starting point (up to six). Each orbit is a set of dots, one per step, starting at a ring.
- **Time series (middle).** $x_n$ (solid) and $y_n$ (dashed) for the newest orbit.
- **Readout.** It gives $J$, its trace and determinant, the eigenvalues, the classification, and whether $J$ is inside the stability triangle (explained below).
- **Buttons.** The **start from** buttons load ready-made cases. **run the map** reveals the steps four per second. **autoscale** fits the plot to the orbits.
## How the matrix is built
With two real eigenvalues $\lambda_1, \lambda_2$ and eigenvectors at angles $\varphi_1, \varphi_2$,
$J = V\begin{pmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{pmatrix}V^{-1}, \qquad V = \begin{pmatrix} \cos\varphi_1 & \cos\varphi_2 \\ \sin\varphi_1 & \sin\varphi_2 \end{pmatrix}.$
Along an eigenvector each step just multiplies by its eigenvalue, so a start on the orange line stays on it and is multiplied by $\lambda_1$ every step.
With a complex pair $a \pm ib$, a stretch $\sigma$ and a tilt $\phi$,
$J = P\begin{pmatrix} a & -b \\ b & a \end{pmatrix}P^{-1}, \qquad P = \begin{pmatrix} \cos\phi & -\sin\phi \\ \sin\phi & \cos\phi \end{pmatrix}\begin{pmatrix} \sigma & 0 \\ 0 & 1 \end{pmatrix}.$
The middle matrix turns by $\theta = \arg\lambda$ and scales by $|\lambda| = \sqrt{a^2 + b^2}$. $P$ squashes the circle into the ellipse. For the predator–prey Jacobian, $a = 1$, $b = \sqrt{0.06} \approx 0.245$, $\sigma = \sqrt{0.4/0.15} \approx 1.633$ and $\phi = 0$.
The applet doesn't trust the sliders for the eigenvalues it prints. It recomputes them from $J$ itself, $\lambda = \tfrac12\operatorname{tr}J \pm \sqrt{\tfrac14(\operatorname{tr}J)^2 - \det J}$.
## When does every orbit go to 0?
Every orbit goes to the origin exactly when both eigenvalues are inside the unit circle. In terms of $J