---
# System prepended metadata

title: Interactive Linear Algebra
tags: [Linear Algebra, Algebra, Matrix]

---

# Interactive Linear Algebra

https://textbooks.math.gatech.edu/ila/

> [TOC]

## Overview

什么是线性代数 Linear Algebra

- Linear: having to do with lines, planes, etc.
- 线性：与线、平面等有关。
- Algebra: solving equations involving unknowns.
- 代数：求解涉及未知数的方程。


现实中的需求：
- 方程组的变量很多
- 我们不需要求解精确的解集 (the set of sluitons)
- 系数包含参数（未知数）的情况，比如特征值方程 (eigenvalue equation)
- 数据建模中，甚至方程组 (a system of equations) 没有解，怎样找到最好的近似解。

主要内容：
- $Ax = b$，矩阵的行约简，矩阵逆，几何分析
- $Ax = \lambda x$，使用特征多项式 (characteristic) 解决特征值问题 (eigenvalue)，使用相似性(similarity)、特征值(eigenvalues)、对角化(diagonalization)和复数(complex numbers)来理解矩阵的几何形状
- $Ax \approx b$ 近似求解 Approximately solve
  - 使用最小二乘法(least-squares approximations)找到最佳拟合解(best-fit solutions)
  - 研究最近矢量和正交投影的几何形状

## Chapter 1 Systems of Linear Equations: Algebra

### 1.1 Systems of Linear Equations

几何对象点的定义：$\mathbb{R}^n$

线性方程组的解

parameterized solution sets 参数化的解

consistent 一致

inconsistent 不一致

**Linear**

Definition An **equation** in the unknowns $x, y, z, \dots$ is called **linear** if both sides of the equation are a sum of (constant) multiples of $x, y, z, \dots$ plus an optional constant.

**Solution sets**

- A solution of a system of equations is a list of numbers $x, y, z, \dots$ that make all of the equations true simultaneously.(所有的方程同时成立)
- The solution set of a system of equations is the collection of all solutions.
- Solving the system means finding all solutions with formulas involving some number of parameters.

**inconsistent**

A system of equations is called **inconsistent** if it has no solutions. It is called **consistent** otherwise.

**Point**

Let $n$ be a positive whole number. We define $$\mathbb{R}^n = \text{all ordered} \ n-\text{tuples of real numbers} \ (x_1, x_2, x_3, \dots, x_n).$$ An $n-$tuple of real numbers is called a **point** of $\mathbb{R}^n$.

**Line**

When $n = 1$, we just get: $\mathbb{R}^1 = \mathbb{R}$.
Geometrically, this is the number line.

**The Euclidean plane**

When $n = 2$, we can think of $\mathbb{R}^2$ as the $xy$-plane.

**3-Space**

When $n = 3$, we can think of $\mathbb{R}^3$ as the space we (appear to) live in. We can do so because every point in space can be represented by an ordered triple of real numebrs, namely, its $x
-, y-$, and $z-$coordinates.

**Pictures of Solution Sets**

One Equation in Two Variables, line

One Equation in Three Variables, plane

Two Equations in Two Variables, Point or None or Line

Two Equations in Three Variables, Line or None or Plane

**Parametric Description of Solution Sets**

Lines:
- Consider the linear equation $x + y = 1$. In this context, we call $x + y = 1$ an **implicit equation** of the line. We can write the same line in **parametric form** as follows: $$(x, y) = (t, 1-t) \quad \text{for any} \ t \in \mathbb{R}.$$
- consider the system of two linear equations $$\left\{\begin{align*}\begin{matrix} x + y + z &= 1 \\ x - z &= 0\end{matrix}\end{align*}\right.$$ These collectively form the **implicit equations** for a line in $\mathbb{R}^3$. (At least two equations are needed to define a line in space.) This line also has a **parametric form** with one parameter $t$: $$(x, y, z) = (t, 1-2t, t).$$

Planes: 

Consider the linear equation $x + y + z = 1$. This is an **implicit equation** of a plane in space. This plane has an equation in **parametric form**: we can write every point on the plane as $$(x, y, z) = (1-t-w, t, w) \quad \text{for any} \ t, w \in \mathbb{R}.$$



### 1.2 Row Reduction

augmented matrix 增广矩阵

the elimination method 高斯消元法

(reduced) row echelon form （简化的）行梯形形式

row reduced matrices

the row reduction algorithm.

row operation 行运算

row equivalence 行等价 针对矩阵

pivot 主元

**The Elimination Method**

- scaling 倍乘         // 1st = 1st * -3
- replacement 替代     // 2nd = 2nd - 2 * 1st
- swap 交换            // 3rd <---> 1st


**augmented matrices**

$$\left( 
    \begin{array}{ccc|c}
        1 & 2 & 3 & 6 \\
        2 & -3 & 2 & 14 \\
        3 & 1 & -1 & -2 \\
    \end{array}
\right)$$

*augmented* refers to the vertical line

**row operations**

- scaling 倍乘         // $R_1 = R_1 \times -3$
- replacement 替代     // $R_2 = R_2 - 2 \times R_1$
- swap 交换            // $R_1 \longleftrightarrow R_3$


**row equivalent**

Two matrices are called **row equivalent** if one can be obtained from the other by doing some number of row operations.

**Echelon Forms**

A matrix is in **row echelon form** if:
1. All zero rows are at the bottom.
2. The first nonzero entry of a row is to the right of the first nonzero entry of the row above.
3. Below the first nonzero entry of a row, all entries are zero.


![image](https://hackmd.io/_uploads/Ski4ULmST.png)


**pivot**

A **pivot** is the first nonzero entry of a row of a matrix in row echelon form.

每个行都有 pivot

A matrix is in **reduced row echelon form** if it is in row echelon form, and in addition:
4. Each pivot is equal to 1.
5. Each pivot is the only nonzero entry in its **column**.

![image](https://hackmd.io/_uploads/B1vIUUXHT.png)


求解 $n$ 元线性方程组的过程，就是在 $\mathbb{R}^n$ 空间中，将每个方程对应的 $n-1$ 维物体旋转，直到垂直坐标轴（求出 Point 的某一个坐标）。

pivot, 就是把方程旋转的过程

![image](https://hackmd.io/_uploads/BJrD88mSp.png)

### The Row Reduction Algorithm

Every matrix is row equivalent to one and only one matrix in reduced row echelon form.

A **pivot position** of a matrix is an entry that is a pivot of a row echelon form of that matrix.

A **pivot column** of a matrix is a column that contains a pivot position.

The Row Echelon Form of an Inconsistent System An augmented matrix corresponds to an inconsistent system of equations if and only if the last column (i.e., the augmented column) is a pivot column.

![image](https://hackmd.io/_uploads/SkCDI8XH6.png)

## 1.3 Parametric Form

$$\left\{
\begin{matrix}
\begin{align*}
x &= 1-5z \\ 
y &= -1 -2z  \\
z &= z
\end{align*}
\end{matrix}
\right.$$

This is called the *parametric form* for the solution to the linear system. The variable $z$ is called a *free variable*.

消元就是降维

**Implicit Versus Parameterized Equations**
Implicit 隐式
Versus 相对/与


These equations are called the **implicit equations** for the line: the line is defined implicitly as the simultaneous solutions to those two equations.

Free variables come from the columns without pivots in a matrix in row echelon form.

### Number of Solutions

The last column is a pivot column. In this case, the system is inconsistent. There are zero solutions, i.e., the solution set is empty. For example, the matrix

![image](https://hackmd.io/_uploads/HJUdI87Ba.png)

Every column except the last column is a pivot column. In this case, the system has a unique solution. For example, the matrix

![image](https://hackmd.io/_uploads/rkpdUUXHT.png)

The last column is not a pivot column, and some other column is not a pivot column either. In this case, the system has infinitely many solutions, corresponding to the infinitely many possible values of the free variable(s). For example, in the system corresponding to the matrix

![image](https://hackmd.io/_uploads/ByM98I7S6.png)

# Chapter 2 Systems of Linear Equations: Geometry

## 2.1 Vectors

### Vector Algebra and Geometry

- We can add two vectors together
- We can multiply, or **scale**, a vector by a real number: **scalar multiple**


## 2.2 Vector Equations and Spans

A **vector equation** is an equation involving a linear combination of vectors with possibly unknown coefficients.

![image](https://hackmd.io/_uploads/rJF9UImHa.png)

等价于线性方程组

线性方程组是否有解等价于给定向量是否存在线性组合等于目标向量。

**Span**
某组向量的所有线性组合集合，仍然是一组向量

Let $v_1, v_2, \dots, v_k$ be vectors in $\mathbb{R}^n$. The span of $v_1, v_2, \dots, v_k$ is the collection of all linear combinations of $v_1, v_2, \dots, v_k$, and is denoted $\text{Span}\{v_1, v_2, \dots, v_k\}$. 

$$\{x_1v_1 + x_2v_2 + \cdots + x_kv_k | x_1, x_2, \dots, x_k \ \text{in} \ \mathbb{R} \}$$


## 2.3 Matrix Equations

![image](https://hackmd.io/_uploads/SkJoU87ST.png)

## 2.4 Solution Sets