Chapter 12: Matrices
矩阵 — Operations, Transformations, and Markov Chains
| Term 术语 | Chinese 中文 | Meaning |
|---|---|---|
| Matrix | 矩阵 | Rectangular array of numbers, order $m\times n$ |
| Entry $a_{ij}$ | 元素 | Number in row $i$, column $j$ |
| Square matrix | 方阵 | Same number of rows and columns |
| Identity matrix $I$ | 单位矩阵 | Square matrix with 1s on diagonal, 0s elsewhere |
| Determinant | 行列式 | $\det(A)=ad-bc$ for $2\times2$; scalar value |
| Inverse matrix $A^{-1}$ | 逆矩阵 | $AA^{-1}=A^{-1}A=I$; exists iff $\det(A)\ne0$ |
| Linear transformation | 线性变换 | Map $T(\vec{x})=A\vec{x}$; outputs are linear combos of inputs |
| Standard matrix | 标准矩阵 | Matrix whose columns are images of standard unit vectors |
| Rotation operator | 旋转算子 | Matrix that rotates vectors by angle $\theta$ |
| Area scale factor | 面积缩放因子 | $|\det(A)|$; how much areas grow/shrink under $T$ |
| Markov chain | 马尔可夫链 | System where next state depends only on current state |
| Transition matrix | 转移矩阵 | $P$; columns sum to 1; $\vec{x}_{n+1}=P\vec{x}_n$ |
| Steady state | 稳态 | $P\vec{q}=\vec{q}$; distribution that doesn't change |
12.1 Matrix Basics 矩阵基础
- Row matrix(行矩阵): $1\times n$, e.g. $\begin{bmatrix}10 & 18 & 26\end{bmatrix}$
- Column matrix(列矩阵): $m\times1$, e.g. $\begin{bmatrix}3\\8\\4\end{bmatrix}$
- Square matrix(方阵): $n\times n$, e.g. $\begin{bmatrix}1&2\\3&4\end{bmatrix}$
12.2 Matrix Addition and Subtraction 矩阵加减法
Let $A=\begin{bmatrix}2&-1\\4&3\end{bmatrix}$, $B=\begin{bmatrix}0&3\\-5&2\end{bmatrix}$, $C=\begin{bmatrix}6&1\\4&7\end{bmatrix}$. Find $A+B$ and $C-A$.
$$A+B=\begin{bmatrix}2+0 & -1+3\\ 4+(-5) & 3+2\end{bmatrix}=\begin{bmatrix}2&2\\-1&5\end{bmatrix}$$
$$C-A=\begin{bmatrix}6-2&1-(-1)\\4-4&7-3\end{bmatrix}=\begin{bmatrix}4&2\\0&4\end{bmatrix}$$
12.3 Matrix Multiplication 矩阵乘法
Let $A=\begin{bmatrix}1&2&1\\0&3&4\end{bmatrix}$ ($2\times3$), $B=\begin{bmatrix}2&1\\5&0\\1&-3\end{bmatrix}$ ($3\times2$). Find $AB$.
$A$ is $2\times3$, $B$ is $3\times2$ → inner dims both $3$ ✓ → result is $2\times2$.
$c_{11}$: Row 1 of $A$ · Col 1 of $B$ $= 1(2)+2(5)+1(1)=2+10+1=13$
$c_{12}$: Row 1 of $A$ · Col 2 of $B$ $= 1(1)+2(0)+1(-3)=1+0-3=-2$
$c_{21}$: Row 2 of $A$ · Col 1 of $B$ $= 0(2)+3(5)+4(1)=0+15+4=19$
$c_{22}$: Row 2 of $A$ · Col 2 of $B$ $= 0(1)+3(0)+4(-3)=0+0-12=-12$
Let $A=\begin{bmatrix}3&1\\-2&4\end{bmatrix}$, $B=\begin{bmatrix}1&0\\2&-1\end{bmatrix}$. Find $AB$ and $BA$. Are they equal?
$BA=\begin{bmatrix}1(3)+0(-2)&1(1)+0(4)\\2(3)+(-1)(-2)&2(1)+(-1)(4)\end{bmatrix}=\begin{bmatrix}3&1\\8&-2\end{bmatrix}$
$AB\neq BA$ — confirms matrix multiplication is not commutative.
12.4 Identity Matrix 单位矩阵
12.5 Inverse Matrix and Determinant 逆矩阵与行列式
① 对角线元素 $a,d$ 互换位置;② 副对角线元素 $b,c$ 取相反数;③ 整体除以行列式 $ad-bc$。
验证:$AA^{-1}=I$。
Find the inverse of $A=\begin{bmatrix}3&-2\\-1&1\end{bmatrix}$.
$\det(A)=3(1)-(-2)(-1)=3-2=1$
Since $\det(A)=1\neq0$, the inverse exists.
$$A^{-1}=\frac{1}{1}\begin{bmatrix}1&2\\1&3\end{bmatrix}=\begin{bmatrix}1&2\\1&3\end{bmatrix}$$
$\begin{bmatrix}3&-2\\-1&1\end{bmatrix}\begin{bmatrix}1&2\\1&3\end{bmatrix}=\begin{bmatrix}3-2&6-6\\-1+1&-2+3\end{bmatrix}=\begin{bmatrix}1&0\\0&1\end{bmatrix}=I$ ✓
(a) Find $\det\begin{bmatrix}5&3\\2&4\end{bmatrix}$ and state whether it is invertible.
(b) If invertible, find its inverse.
(b) $A^{-1}=\dfrac{1}{14}\begin{bmatrix}4&-3\\-2&5\end{bmatrix}=\begin{bmatrix}2/7&-3/14\\-1/7&5/14\end{bmatrix}$
- 2nd x⁻¹ (MATRIX) → EDIT → 1:[A]. Enter the size (e.g. 2 × 2), then the entries.
- On the home screen, paste the matrix with 2nd x⁻¹ → NAMES → 1:[A].
- Inverse: [A] x⁻¹ ENTER. For fractions: MATH → 1:▶Frac.
- Determinant: 2nd x⁻¹ → MATH → 1:det( → [A] ) ENTER.
- Products and powers: [A]*[B]; [A]^10 gives $A^{10}$ (useful for Markov chains in 12.12).
12.6 Determinants and Area 行列式与面积
Use determinants to find the area of the parallelogram with vertices $(0,0)$, $(7,2)$, $(12,11)$, $(5,9)$.
$\vec{u}=\langle7,2\rangle$ (to $(7,2)$) and $\vec{v}=\langle5,9\rangle$ (to $(5,9)$).
$M=\begin{bmatrix}7&5\\2&9\end{bmatrix}$; $\quad\det(M)=7(9)-5(2)=63-10=53$
Verify: $(7,2)+(5,9)=(12,11)$ ✓ — this is the fourth vertex.
12.7 Linear Transformations 线性变换
It can be written as matrix multiplication: $T(\vec{x})=A\vec{x}$, where $A$ is an $m\times n$ matrix.
- $(x,y)\mapsto(2x+y,\;3x-y)$ ✓ linear
- $(x,y)\mapsto(x^2,\;y)$ ✗ NOT linear (has $x^2$)
- $(x,y)\mapsto(xy,\;y)$ ✗ NOT linear (variables multiplied)
- $(x,y)\mapsto(x+1,\;y)$ ✗ NOT linear (constant term: $(0,0)\mapsto(1,0)$)
Let $T:\mathbb{R}^3\to\mathbb{R}^2$ be defined by $T(x,y,z)=(x-y,\;2x+y+3z)$. Find the image of $\vec{v}=\begin{bmatrix}1\\3\\-2\end{bmatrix}$.
Each output component is read off as a row:
$x-y+0z \Rightarrow$ row 1: $[1,\,-1,\,0]$
$2x+y+3z \Rightarrow$ row 2: $[2,\,1,\,3]$
$$A=\begin{bmatrix}1&-1&0\\2&1&3\end{bmatrix}$$
$$A\vec{v}=\begin{bmatrix}1(1)+(-1)(3)+0(-2)\\2(1)+1(3)+3(-2)\end{bmatrix}=\begin{bmatrix}1-3+0\\2+3-6\end{bmatrix}=\begin{bmatrix}-2\\-1\end{bmatrix}$$
Transforming Several Vectors at Once 一次变换多个向量
Triangle $PQR$ has vertices $P(1,1)$, $Q(4,1)$, $R(1,3)$. Use one matrix product to find the image of the triangle under $T(\vec v)=A\vec v$ with $A=\begin{bmatrix}1&2\\0&1\end{bmatrix}$. Compare the areas.
12.8 Standard Matrix 标准矩阵
Find the matrix $A$ associated with $T(x,y)=(2x+y,\;-x,\;3y)$, where $T:\mathbb{R}^2\to\mathbb{R}^3$.
$T(1,0)=(2,\,-1,\,0)$
$T(0,1)=(1,\,0,\,3)$
$$A=\begin{bmatrix}2&1\\-1&0\\0&3\end{bmatrix}$$
12.9 Rotation Operators 旋转算子
Find the image of $\vec{v}=\begin{bmatrix}1\\1\end{bmatrix}$ after rotating counterclockwise by $\dfrac{\pi}{2}$.
$\cos\dfrac{\pi}{2}=0$, $\sin\dfrac{\pi}{2}=1$
$R_{\pi/2}=\begin{bmatrix}0&-1\\1&0\end{bmatrix}$
$R_{\pi/2}\vec{v}=\begin{bmatrix}0&-1\\1&0\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix}=\begin{bmatrix}0(1)+(-1)(1)\\1(1)+0(1)\end{bmatrix}=\begin{bmatrix}-1\\1\end{bmatrix}$
Rotate the vector $\vec{v}=\begin{bmatrix}3\\0\end{bmatrix}$ counterclockwise by $\dfrac{\pi}{6}$. Give exact values.
$R_{\pi/6}\begin{bmatrix}3\\0\end{bmatrix}=\begin{bmatrix}3\sqrt{3}/2\\3/2\end{bmatrix}$
Reflections and Dilations from Unit Vectors 由单位向量写出反射与伸缩
| Transformation 变换 | $T(\mathbf e_1)$ | $T(\mathbf e_2)$ | Matrix | $\det$ |
|---|---|---|---|---|
| Reflect over the $x$-axis | $\langle1,0\rangle$ | $\langle0,-1\rangle$ | $\begin{bmatrix}1&0\\0&-1\end{bmatrix}$ | $-1$ |
| Reflect over the $y$-axis | $\langle-1,0\rangle$ | $\langle0,1\rangle$ | $\begin{bmatrix}-1&0\\0&1\end{bmatrix}$ | $-1$ |
| Reflect over $y=x$ | $\langle0,1\rangle$ | $\langle1,0\rangle$ | $\begin{bmatrix}0&1\\1&0\end{bmatrix}$ | $-1$ |
| Dilate by factor $k$ | $\langle k,0\rangle$ | $\langle0,k\rangle$ | $\begin{bmatrix}k&0\\0&k\end{bmatrix}$ | $k^2$ |
| Stretch: horizontal $a$, vertical $b$ | $\langle a,0\rangle$ | $\langle0,b\rangle$ | $\begin{bmatrix}a&0\\0&b\end{bmatrix}$ | $ab$ |
12.10 Dilations and Area Scaling 缩放与面积变化
- $|\det(A)|>1$: areas are enlarged(放大)
- $|\det(A)|=1$: areas are preserved(面积不变), e.g. every rotation: $\det R_\theta=\cos^2\theta+\sin^2\theta=1$
- $0<|\det(A)|<1$: areas are shrunk(缩小)
- $\det(A)=0$: regions collapse to a line or point(坍缩为直线或点)
Given $A=\begin{bmatrix}1&1\\-1&3\end{bmatrix}$, find the area scale factor of the transformation $T(\vec{x})=A\vec{x}$.
$\det(A)=1(3)-(1)(-1)=3+1=4$
Every region in $\mathbb{R}^2$ is enlarged by a factor of $4$ under this transformation.
Use the matrix $A=\begin{bmatrix}1&1\\-1&3\end{bmatrix}$ from T-9. Find the image of the unit square with vertices $(0,0)$, $(1,0)$, $(1,1)$, $(0,1)$, and check that its area is $|\det A|$ times the original area.
12.11 Composition of Linear Transformations 线性变换的复合
Let $T(x,y)=(x+y,\;2x)$ and $S(x,y)=(3x,\;-x+y)$. Express $S\circ T$ as a matrix transformation.
$T(x,y)=\begin{bmatrix}1&1\\2&0\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}$, so $A=\begin{bmatrix}1&1\\2&0\end{bmatrix}$
$S(x,y)=\begin{bmatrix}3&0\\-1&1\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}$, so $B=\begin{bmatrix}3&0\\-1&1\end{bmatrix}$
$$BA=\begin{bmatrix}3&0\\-1&1\end{bmatrix}\begin{bmatrix}1&1\\2&0\end{bmatrix}=\begin{bmatrix}3&3\\1&-1\end{bmatrix}$$
(a) Find the single matrix that rotates every vector $90°$ counterclockwise and then reflects it over the $x$-axis. (b) Find the matrix for the opposite order (reflect first, then rotate). (c) Apply both to $\langle2,1\rangle$.
$T:\mathbb{R}^2\to\mathbb{R}^2$ is defined by $x_1=2x+y$, $x_2=3x+4y$. Show it is one-to-one and find $T^{-1}(x_1,x_2)$.
$A^{-1}=\dfrac{1}{5}\begin{bmatrix}4&-1\\-3&2\end{bmatrix}$
$T^{-1}(x_1,x_2)=\dfrac{1}{5}(4x_1-x_2,\;-3x_1+2x_2)$
Example: undoing a rotation by $\theta$ is a rotation by $-\theta$: $\;R_\theta^{-1}=R_{-\theta}=\begin{bmatrix}\cos\theta&\sin\theta\\-\sin\theta&\cos\theta\end{bmatrix}$ (use the inverse formula with $\det R_\theta=1$).
12.12 Markov Chains 马尔可夫链
Each column sums to $1$.
Probabilities sum to $1$; counts sum to the total.
An alumni donation model has two states: State 1 (donates) and State 2 (does not donate). The transition matrix is $P=\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}$. A new graduate did not donate in the initial year. Find the probability they donate after 3 years.
列 $j$ 表示从状态 $j$ 出发的转移概率:列 2 为 $\begin{bmatrix}0.3\\0.7\end{bmatrix}$(从不捐款出发,$30\%$ 变为捐款,$70\%$ 继续不捐款)。
$\vec{x}_0=\begin{bmatrix}0\\1\end{bmatrix}$
$\vec{x}_1=\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}\begin{bmatrix}0\\1\end{bmatrix}=\begin{bmatrix}0.3\\0.7\end{bmatrix}$
$\vec{x}_2=\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}\begin{bmatrix}0.3\\0.7\end{bmatrix}=\begin{bmatrix}0.24+0.21\\0.06+0.49\end{bmatrix}=\begin{bmatrix}0.45\\0.55\end{bmatrix}$
$\vec{x}_3=\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}\begin{bmatrix}0.45\\0.55\end{bmatrix}=\begin{bmatrix}0.36+0.165\\0.09+0.385\end{bmatrix}=\begin{bmatrix}0.525\\0.475\end{bmatrix}$
Using the same transition matrix $P=\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}$, find the steady-state vector $\vec{q}$.
Let $\vec{q}=\begin{bmatrix}q_1\\q_2\end{bmatrix}$. Then: $0.8q_1+0.3q_2=q_1 \;\Rightarrow\; -0.2q_1+0.3q_2=0$
From $-0.2q_1+0.3q_2=0$: $q_2=\dfrac{0.2}{0.3}q_1=\dfrac{2}{3}q_1$
Substitute: $q_1+\dfrac{2}{3}q_1=1\Rightarrow\dfrac{5}{3}q_1=1\Rightarrow q_1=\dfrac{3}{5}=0.6$
$q_2=1-0.6=0.4$
$\begin{bmatrix}0.8&0.3\\0.2&0.7\end{bmatrix}\begin{bmatrix}0.6\\0.4\end{bmatrix}=\begin{bmatrix}0.48+0.12\\0.12+0.28\end{bmatrix}=\begin{bmatrix}0.6\\0.4\end{bmatrix}$ ✓
Building a Model from a Context 由情境构造模型
Each day, students choose pizza (P) or salad (S) for lunch. Of the students who choose pizza one day, $90\%$ choose pizza the next day and $10\%$ switch to salad. Of those who choose salad, $20\%$ switch to pizza and $80\%$ stay with salad. Today $310$ students chose pizza and $190$ chose salad.
(a) Write the transition matrix and today's state vector. (b) Predict the next two days. (c) Use repeated multiplication to predict the long-run distribution, and confirm it with $P\vec q=\vec q$.
| $n$ | $0$ | $1$ | $2$ | $5$ | $10$ | $20$ | $50$ |
|---|---|---|---|---|---|---|---|
| pizza | $310$ | $317$ | $321.9$ | $329.41$ | $332.67$ | $333.31$ | $333.33$ |
| salad | $190$ | $183$ | $178.1$ | $170.59$ | $167.33$ | $166.69$ | $166.67$ |
Past States with the Inverse 用逆矩阵推算过去
Using the lunch model from T-15, how many students chose each lunch yesterday? Two days ago?
Check: $P\begin{bmatrix}300\\200\end{bmatrix}=\begin{bmatrix}270+40\\30+160\end{bmatrix}=\begin{bmatrix}310\\190\end{bmatrix}$ ✓
A weather model has two states: Sunny (S) and Rainy (R). The transition matrix is $P=\begin{bmatrix}0.7&0.4\\0.3&0.6\end{bmatrix}$ where columns represent current state (S, then R). Today is Sunny. Find: (a) probability it rains in 2 days, (b) the steady-state distribution.
Probability of rain in 2 days $= 39\%$.
(b) Steady state: $0.7q_1+0.4q_2=q_1\Rightarrow 0.4q_2=0.3q_1\Rightarrow q_1=\tfrac{4}{3}q_2$; with $q_1+q_2=1$: $q_1=\tfrac{4}{7}\approx57.1\%$ Sunny, $q_2=\tfrac{3}{7}\approx42.9\%$ Rainy.
Each year, $5\%$ of city residents move to the suburbs and $3\%$ of suburban residents move to the city; everyone else stays. This year the city has $60{,}000$ residents and the suburbs $40{,}000$.
(a) Write the transition matrix. (b) Predict next year. (c) Find last year's populations. (d) Find the long-run populations.
(b) $P\begin{bmatrix}60000\\40000\end{bmatrix}=\begin{bmatrix}58200\\41800\end{bmatrix}$.
(c) $\det P=0.92$; $\;P^{-1}\begin{bmatrix}60000\\40000\end{bmatrix}=\dfrac{1}{0.92}\begin{bmatrix}0.97(60000)-0.03(40000)\\-0.05(60000)+0.95(40000)\end{bmatrix}=\dfrac{1}{0.92}\begin{bmatrix}57000\\35000\end{bmatrix}\approx\begin{bmatrix}61957\\38043\end{bmatrix}$.
(d) $0.05c=0.03s$ and $c+s=100000$: city $37{,}500$, suburbs $62{,}500$.
Chapter 12 Summary 本章总结
| Topic 主题 | Key Formula / Rule |
|---|---|
| Matrix addition/subtraction | Entry-by-entry; requires same order |
| Matrix multiplication | $A_{m\times k}\cdot B_{k\times n}=C_{m\times n}$; row · column dot products |
| Not commutative | $AB\neq BA$ in general |
| Identity matrix | $AI=IA=A$; diag $=1$, off-diag $=0$ |
| Determinant ($2\times2$) | $\det\begin{bmatrix}a&b\\c&d\end{bmatrix}=ad-bc$ |
| Inverse ($2\times2$) | $A^{-1}=\dfrac{1}{ad-bc}\begin{bmatrix}d&-b\\-c&a\end{bmatrix}$; exists iff $\det\neq0$ |
| Parallelogram area | $|\det[\vec{u}\;|\;\vec{v}]|$ |
| Linear transformation | $T(\vec{x})=A\vec{x}$; outputs are linear combos of inputs |
| Standard matrix | Columns $= T(\mathbf{e}_1),T(\mathbf{e}_2),\ldots$ |
| Rotation by $\theta$ | $R_\theta=\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}$ |
| Area scale factor | $|\det(A)|$ |
| Composition $S\circ T$ | Matrix $= BA$ (right-to-left order) |
| Markov next state | $\vec{x}_{n+1}=P\vec{x}_n$; after $n$ steps: $P^n\vec{x}_0$ |
| Steady state | $P\vec{q}=\vec{q}$ with $\sum q_i=1$ (or the total); or compute $P^n\vec{x}_0$ for large $n$ |
| Building $P$ | Column $j$ = where state $j$ goes (percents as decimals); each column sums to $1$ |
| Markov past state | $\vec{x}_{n-1}=P^{-1}\vec{x}_n$ |
| Linear test | Must have $T(\vec 0)=\vec 0$ |
| Several vectors at once | Vectors as columns of $V$ ($2\times n$); images are the columns of $AV$ |
| Reflections | $x$-axis $\begin{bmatrix}1&0\\0&-1\end{bmatrix}$, $y$-axis $\begin{bmatrix}-1&0\\0&1\end{bmatrix}$, $y=x$ $\begin{bmatrix}0&1\\1&0\end{bmatrix}$ |
| Inverse transformation | $L^{-1}(\vec v)=A^{-1}\vec v$; $\;R_\theta^{-1}=R_{-\theta}$ |
- 矩阵乘法的维数检验:内维必须相等,结果矩阵取外维。
- $2\times2$ 逆矩阵:先算行列式,再用公式(对角互换,副对角取反,除以行列式)。
- 行列式 $=0$ 时,矩阵不可逆,对应的线性变换会压缩掉一个维度。
- 复合变换:先做的变换对应的矩阵写在右边($S\circ T \leftrightarrow BA$)。
- 马尔可夫链:转移矩阵每列之和为 $1$;稳态向量满足 $P\vec{q}=\vec{q}$ 且分量和为 $1$。
- 由情境构造转移矩阵:第 $j$ 列写"从状态 $j$ 出发去各状态的比例",写完检查每列和为 $1$。
- 推算过去用 $P^{-1}$;预测长期用 $P^n\vec{x}_0$($n$ 取大),或解 $P\vec{q}=\vec{q}$。
- Ch 1–4:函数、多项式、有理函数、母函数与变换
- Ch 5–7:指数函数、数列、对数函数
- Ch 8–9:三角函数、极坐标
- Ch 10–12:参数方程与圆锥曲线、向量、矩阵:对应 CED Unit 4,由学校自选,不在 AP 考试范围内。