Chapter 1 — Vectors, matrices, and linear systems¶
After expressions (Volume 1) and linear functions (Volume 2), we move to the language of Linear Algebra. Here we represent multiple equations in a compact way using vectors and matrices.
1.1 Vectors in \(\mathbb{R}^2\) and \(\mathbb{R}^3\)¶
A vector in \(\mathbb{R}^2\) can be written as
Example vectors:
Vector addition:
Scalar multiplication:
A quick extension to \(\mathbb{R}^3\) is \(\mathbf{w}=\begin{bmatrix}1\\0\\-2\end{bmatrix}\), where each entry is one coordinate component.
1.2 Matrices and system notation¶
A matrix \(A\in\mathbb{R}^{2\times 2}\) can be written as
and we define
Then the linear system is represented by
which corresponds to the scalar form:
| Equation | Scalar form |
|---|---|
| 1 | \(2x_1 + x_2 = 5\) |
| 2 | \(x_1 - x_2 = 1\) |
1.3 Worked example: solving a linear system¶
Solve the system
Add the equations:
Substitute into \(x_1-x_2=1\):
Vector solution:
Matrix verification (short derivation)¶
1.4 Pseudo-code for a 2x2 solver¶
algorithm solve_2x2_system(a11, a12, b1, a21, a22, b2)
d <- a11*a22 - a12*a21
if d = 0 then
return "system has no unique solution"
end_if
x1 <- (b1*a22 - a12*b2)/d
x2 <- (a11*b2 - b1*a21)/d
return (x1, x2)
end
This structure prepares the next steps: computational methods and engineering applications involving larger linear models.