Purpose
For a shorter introduction to the computational basics, start with Elementary Linear Algebra; the corresponding NumPy operations are collected in the Python Linear Algebra Cheatsheet.
Geometric Basics
Definition and Representation
- A vector is a quantity with both magnitude and direction
- Notation: or or
- Components: in 3D space
Geometric Interpretation
- Directed line segment from initial point to terminal point
- Length (magnitude):
- Two vectors are equal if they have same magnitude and direction
Position Vectors
- Vector from origin to a point
- Written as:
Direction Vectors
- Unit vector in direction of :
- Represents pure direction (magnitude = 1)
Unit Vectors
- Vectors with magnitude 1:
- Direction cosines:
Standard Basis Vectors
| Vector | Components | Description |
|---|---|---|
| Unit vector in x-direction | ||
| Unit vector in y-direction | ||
| Unit vector in z-direction |
Basic Vector Operations
Addition and Subtraction
- Addition:
- Subtraction:
Parallelogram Law
- Sum of vectors forms diagonal of parallelogram
- where is diagonal
Triangle Inequality
- Equality holds if and only if vectors are parallel
Scalar Multiplication
- Properties:
Systems of Linear Equations
Matrix Form (Ax = b)
Solution Types
| Type | Condition | Geometric Interpretation |
|---|---|---|
| Unique Solution | Lines/planes intersect at one point | |
| Infinite Solutions | Lines/planes overlap | |
| No Solution | Lines/planes are parallel |
Geometric Interpretation
- 2D: Intersection of lines
- 3D: Intersection of planes
- Higher dimensions: Intersection of hyperplanes
Solution Methods
Gaussian Elimination
-
Forward Elimination
- Convert matrix to row echelon form (REF)
- Create zeros below diagonal
[1 * * *] [0 1 * *] [0 0 1 *] [0 0 0 1] -
Back Substitution
- Solve for variables from bottom up
Gauss-Jordan Elimination
- Convert to reduced row echelon form (RREF)
- Create zeros above and below diagonal
[1 0 0 *]
[0 1 0 *]
[0 0 1 *]
Key Operations
| Operation | Description | Notation |
|---|---|---|
| Row Swap | Swap rows and | |
| Scalar Multiplication | Multiply row by | |
| Row Addition | Add multiple of row to row |
Matrices
Types and Properties
| Type | Definition | Properties |
|---|---|---|
| Square | matrix | - Same number of rows and columns - Can have determinant - May be invertible |
| Rectangular | matrix | - Different number of rows and columns - No determinant |
| Identity () | - Square matrix - 1’s on diagonal, 0’s elsewhere - | |
| Zero () | All entries are 0 | - Can be any dimension - |
| Diagonal | for | - Non-zero elements only on main diagonal |
| Triangular | Upper: for Lower: for | - Square matrix - Determinant = product of diagonal entries |
Basic Matrix Operations
Addition and Subtraction
- Only defined for matrices of same dimensions
- Commutative:
- Associative:
Scalar Multiplication
- Distributive:
Transpose
Row Echelon Form
A matrix is in row echelon form if:
- All zero rows are at the bottom
- Leading coefficient (pivot) of each nonzero row is to the right of pivots above
- All entries below pivots are zero
Reduced Row Echelon Form
Additional conditions for RREF:
- Leading coefficient of each nonzero row is 1
- Each leading 1 is the only nonzero entry in its column
Pivot Positions
- First nonzero element in each row
- Determines rank of matrix
- Maximum number of linearly independent columns
Leading Entries
Properties:
- Always nonzero
- Leftmost nonzero entry in row
- Each leading entry is right of leading entries above it
Vector Spaces
Axioms of Vector Spaces
Let be a vector space over field with vectors and scalars :
- Closure under addition:
- Commutativity:
- Associativity:
- Additive identity: such that
- Additive inverse: such that
- Scalar multiplication closure:
- Scalar multiplication distributivity:
- Vector distributivity:
- Scalar multiplication associativity:
- Scalar multiplication identity:
Linear Independence
Definition
Vectors are linearly independent if: implies
Tests and Algorithms
| Test | Description | Result |
|---|---|---|
| Matrix Test | Form matrix with vectors as columns and solve | Independent if only solution is trivial |
| Determinant | For square matrix of vectors | Independent if det |
| Rank | Compute rank of matrix | Independent if rank = number of vectors |
Span
Definition
The span of vectors is:
Geometric Interpretation
- 1 vector: line through origin
- 2 vectors: plane through origin (if independent)
- 3 vectors: 3D space (if independent)
Basis
A basis is a linearly independent set of vectors that spans the vector space.
Standard Basis
For : where: (1 in th position)
Dimension
The dimension of a vector space is the number of vectors in any basis.
Basis Theorem
Every basis of a vector space has the same number of vectors.
Dimension Theorem
For finite-dimensional vector space :
- Any linearly independent set can be extended to a basis
- Any spanning set can be reduced to a basis
Subspaces
Tests for Subspaces
A subset of vector space is a subspace if:
- Closed under addition:
- Closed under scalar multiplication:
Common Subspaces
| Subspace | Definition | Dimension |
|---|---|---|
| Null Space | ||
| Column Space | ||
| Row Space |
Advanced Vector Operations (cont. 1)
Dot Product
The scalar product of two vectors.
Geometric Definition
where is the angle between vectors
Algebraic Definition
For vectors in :
Properties
| Property | Formula | Description |
|---|---|---|
| Commutative | Order doesn’t matter | |
| Distributive | Distributes over addition | |
| Scalar Multiplication | Scalars can be factored out | |
| Self-Dot Product | Dot product with itself equals magnitude squared |
Angle Formula
Projection Formula
Vector projection of onto :
Cross Product
Vector product resulting in a vector perpendicular to both input vectors (3D only).
Right-Hand Rule
- Point index finger in direction of first vector
- Point middle finger in direction of second vector
- Thumb points in direction of cross product
Properties
| Property | Formula | Description |
|---|---|---|
| Anti-commutative | Order matters | |
| Distributive | Distributes over addition | |
| Magnitude | Area of parallelogram | |
| Perpendicular | and | Result is perpendicular to both vectors |
Triple Product
Scalar triple product: Represents volume of parallelepiped
Linear Combinations
Sum of vectors with scalar coefficients:
Geometric Interpretation
- For two vectors: Points on plane formed by vectors
- For three vectors: Points in space formed by vectors
- Span: Set of all possible linear combinations
Matrix Properties (cont. 1)
Rank
The rank of a matrix is the dimension of the vector space spanned by its columns (or rows).
Full Rank
A matrix has full rank when:
- For m×n matrix: rank = min(m,n)
- Column rank = Row rank
- For square matrix: rank = n ⟺ matrix is invertible
Rank Theorems
| Theorem | Statement |
|---|---|
| Rank-Nullity | For m×n matrix A: rank(A) + nullity(A) = n |
| Product Rank | rank(AB) ≤ min(rank(A), rank(B)) |
| Addition Rank | rank(A + B) ≤ rank(A) + rank(B) |
Trace
The trace of a square matrix is the sum of elements on the main diagonal.
Properties
- tr(A + B) = tr(A) + tr(B)
- tr(cA) = c⋅tr(A)
- tr(AB) = tr(BA)
- tr(A^T) = tr(A)
- For eigenvalues λᵢ: tr(A) = ∑λᵢ
Determinant
For square matrix A, det(A) or |A| measures the scaling factor of the linear transformation.
Properties
- det(AB) = det(A)⋅det(B)
- det(A^T) = det(A)
- det(A^{-1}) = \frac{1}{det(A)}
- For triangular matrices: det = product of diagonal entries
- det(cA) = c^n det(A) for n×n matrix
Calculation Methods
Cofactor Expansion
For n×n matrix: where Cᵢⱼ is the (i,j) cofactor
Row/Column Expansion
Choose any row/column i: where Mᵢⱼ is the minor
Triangular Method
- Convert to upper triangular using row operations
- Multiply diagonal elements
- Account for row operation signs
Cramer’s Rule
For system Ax = b with det(A) ≠ 0: where Aᵢ is A with column i replaced by b
Matrix Operations (cont. 1)
Matrix Multiplication
For matrices and :
Properties
- Distributive:
- Associative:
- Scalar multiplication:
- Identity:
- Zero matrix:
Non-commutativity
- Generally,
- Exception: If and commute, they are called “commuting matrices”
- Special cases where :
- When or is identity matrix
- When or is scalar multiple of identity
- When and are diagonal matrices
Associativity
always holds for conformable matrices
Inverse
For square matrix , if , then is the inverse of
Existence Conditions
- Matrix must be square
- Matrix must be non-singular (determinant ≠ 0)
- rank(A) = n for n×n matrix
Properties
| Property | Formula |
|---|---|
| Double Inverse | |
| Product Inverse | |
| Scalar Inverse | |
| Transpose Inverse |
Calculation Methods
Adjugate Method
For an n×n matrix: where adj(A) is the adjugate matrix
Gaussian Elimination
- Form augmented matrix
- Convert left side to identity matrix
- Right side becomes
Elementary Matrices
- Result from applying elementary row operations to identity matrix
- Types:
- Row swap:
- Row multiplication:
- Row addition:
- Properties:
- Always invertible
- where is row reduced form
Conjugate Transpose
For matrix :
- Denoted as or
- Properties:
- For real matrices,
Systems of Linear Equations (cont. 1)
Homogeneous Systems ()
A system where all constants are zero:
Trivial Solution
- Always has solution (zero vector)
- Exists for any coefficient matrix
Nontrivial Solutions
- Exist if and only if where is number of variables
- Equivalent to for square matrices
- Number of free variables =
Consistency Theorems
Consistent System Conditions
| Condition | System is Consistent When |
|---|---|
| Rank Test | |
| Square Matrix | |
| General | Solutions exist if is in column space of |
Fredholm Alternative
For system , exactly one of these is true:
- System has a solution
- has a solution with
Cramer’s Rule
For system where is with : Where is matrix with column replaced by
Matrix Inverse Method
For square system where is invertible:
Requirements:
- must be square
- Computationally expensive for large systems
Linear Transformations
Definition
A linear transformation is a function between vector spaces that preserves:
- Addition:
- Scalar multiplication:
Matrix Representation
Every linear transformation can be represented by a unique matrix
Standard Matrix
For transformation , the standard matrix is formed by: where are standard basis vectors
Properties
| Property | Definition | Test |
|---|---|---|
| Kernel (Null Space) | Solve | |
| Range (Image) | Span of columns of | |
| One-to-One (Injective) | ||
| Onto (Surjective) | Columns span | |
| Isomorphism | Bijective linear transformation | One-to-one and onto |
Special Transformations
Rotation
- 2D rotation by angle :
Reflection
- Across x-axis:
- Across y-axis:
Projection
- Onto x-axis:
- Onto y-axis:
Scaling
- Scale by factors and :
Shearing
- Horizontal shear by :
- Vertical shear by :
Inner Product Spaces
Definition
An inner product on a vector space is a function (or )
Properties
| Property | Mathematical Form | Description |
|---|---|---|
| Positive Definiteness | and | Always non-negative, zero only for zero vector |
| Symmetry | Complex conjugate for complex spaces | |
| Linearity | Linear in first argument |
Norm
The norm induced by inner product:
Properties
- Non-negative:
- Positive definite:
- Homogeneous:
- Triangle inequality:
Distance Function
Orthogonality
Orthogonal Vectors
Two vectors are orthogonal if
Orthogonal Sets
- Set of vectors where each pair is orthogonal
- If normalized, called orthonormal set
- Orthonormal basis: orthonormal set that spans space
Orthogonal Matrices
Matrix is orthogonal if
Properties
| Property | Formula | Note |
|---|---|---|
| Inverse | Transpose equals inverse | |
| Determinant | Always unit magnitude | |
| Column/Rows | Form orthonormal set | |
| Length Preservation | Preserves distances |
Orthogonal Complements
For subspace , orthogonal complement :
Orthogonal Projections
Projection onto subspace : where is basis for
For orthonormal basis:
Special Matrices (cont. 1)
| Type | Definition | Properties | Example |
|---|---|---|---|
| Symmetric | - Diagonal elements can be any real number - Elements symmetric across main diagonal - All eigenvalues are real | ||
| Skew-symmetric | - Diagonal elements must be zero - - All eigenvalues are imaginary or zero | ||
| Orthogonal | - - Columns/rows form orthonormal basis - - Preserves lengths and angles | ||
| Idempotent | - Eigenvalues are only 0 or 1 - Trace = rank - Used in projection matrices | ||
| Nilpotent | for some | - All eigenvalues = 0 - Trace = 0 - where is matrix size |
Additional Properties:
-
Symmetric Matrices:
- All real symmetric matrices are diagonalizable
- is a quadratic form
-
Orthogonal Matrices:
- Every column/row has unit length
- Any two columns/rows are perpendicular
- Preserves inner products:
-
Idempotent Matrices:
- is also idempotent if is idempotent
- Rank = Trace for idempotent matrices
-
Nilpotent Matrices:
- The minimal for which is called the index of nilpotency
- Characteristic polynomial is
Change of Basis
Transition Matrices
A transition matrix transforms coordinates from one basis to another: where are the basis vectors of B expressed in basis C
| Operation | Formula | Meaning |
|---|---|---|
| Change from C to B | Vector v in basis B | |
| Change from B to C | Vector v in basis C | |
| Inverse relation | Matrices are inverses |
Similar Matrices
Two matrices A and B are similar if: where P is an invertible matrix
Properties:
- Similar matrices have same eigenvalues
- Similar matrices have same determinant
- Similar matrices have same trace
- Similar matrices have same rank
Coordinate Vectors
For a vector and basis : where
Orthogonalization
Gram-Schmidt Process
Converting basis to orthogonal basis :
General formula: where
QR Decomposition
Matrix A can be decomposed as: where:
- Q is orthogonal matrix ()
- R is upper triangular matrix
Orthonormal Basis
Construction
- Start with any basis
- Apply Gram-Schmidt process
- Normalize each vector:
Properties
| Property | Description |
|---|---|
| Orthogonality | for |
| Normality | for all i |
| Transition Matrix | P is orthogonal () |
| Coordinates |
Eigenvalues and Eigenvectors
Definitions
- Eigenvalue (): A scalar value where for some nonzero vector
- Eigenvector (): A nonzero vector satisfying for some scalar
Characteristic Equation
where:
- is the square matrix
- is the eigenvalue
- is the identity matrix
Characteristic Polynomial
- Degree equals matrix dimension
- Roots are eigenvalues
Properties
| Property | Description |
|---|---|
| Sum | |
| Product | |
| Number | ≤ dimension of matrix |
Geometric Multiplicity
- Number of linearly independent eigenvectors for a given eigenvalue
- ≤ algebraic multiplicity
- = dimension of null space of
Algebraic Multiplicity
- Multiplicity of eigenvalue as root of characteristic polynomial
- ≥ geometric multiplicity
Eigenspace
- Subspace spanned by eigenvectors for eigenvalue
- Dimension = geometric multiplicity
Diagonalization
where:
- is diagonal matrix of eigenvalues
- is matrix of eigenvectors
Diagonalizability Conditions
Matrix is diagonalizable if and only if:
- Geometric multiplicity = algebraic multiplicity for all eigenvalues
- Sum of dimensions of eigenspaces = matrix dimension
Diagonalization Process
- Find eigenvalues (solve characteristic equation)
- Find eigenvectors for each eigenvalue
- Form from eigenvectors as columns
- Form with eigenvalues on diagonal
- Verify
Similar Matrices
- and similar if for invertible
- Similar matrices have same eigenvalues
- Similar matrices have same characteristic polynomial
Special Cases
Repeated Eigenvalues
- May have fewer linearly independent eigenvectors
- Need generalized eigenvectors if geometric multiplicity < algebraic multiplicity
Complex Eigenvalues
- Occur in conjugate pairs for real matrices
- Complex eigenvectors also occur in conjugate pairs
Applications
Powers of Matrices
- Simplifies computation of matrix powers
- Useful for recursive sequences
Difference Equations
For system :
- General solution involves eigenvalues and eigenvectors
- Stability determined by
Differential Equations
For system :
- Solutions of form
- Stability determined by
Important Theorems
Fundamental Theorem of Linear Algebra
For a linear transformation and its matrix :
Cayley-Hamilton Theorem
Every square matrix satisfies its own characteristic equation:
Spectral Theorem
For symmetric matrices :
- All eigenvalues are real
- Eigenvectors of distinct eigenvalues are orthogonal
- where:
- is orthogonal ()
- is diagonal containing eigenvalues
Triangle Inequality
For vectors :
Cauchy-Schwarz Inequality
For vectors :
- Equality holds if and only if vectors are linearly dependent
Invertible Matrix Theorem
The following statements are equivalent for a square matrix :
- is invertible
- Columns are linearly independent
- has unique solution for all
Matrix Factorization Theorems
LU Decomposition
For matrix : where:
- is lower triangular
- is upper triangular
- Exists if all leading principal minors are nonzero
QR Decomposition
For matrix : where:
- is orthogonal ()
- is upper triangular
- Always exists for full-rank matrices
Cholesky Decomposition
For symmetric positive definite matrix : where:
- is lower triangular
- is upper triangular
- Elements are real
Advanced Topics
Singular Value Decomposition (SVD)
Any matrix can be decomposed as
Singular Values
- Diagonal entries of matrix
- Always real and non-negative
- Ordered:
U and V Matrices
- : orthogonal matrix (left singular vectors)
- : orthogonal matrix (right singular vectors)
- : diagonal matrix with singular values
Applications
| Application | Description |
|---|---|
| Low-rank approximation | Truncate to largest singular values |
| Image compression | Reduce dimensionality while preserving structure |
| Principal Component Analysis | Use right singular vectors as principal components |
| Pseudoinverse |
Jordan Canonical Form
For matrix , exists invertible such that
Jordan Blocks
Generalized Eigenvectors
- Chain:
- is regular eigenvector
Positive Definite Matrices
Symmetric matrix where for all nonzero
Tests for Positive Definiteness
| Test | Condition |
|---|---|
| Eigenvalue | All eigenvalues > 0 |
| Leading Principals | All leading principal minors > 0 |
| Cholesky | Exists unique lower triangular with |
| Quadratic Form | for all nonzero |
Applications
- Optimization problems
- Covariance matrices
- Least squares solutions
- Energy functions
Linear Operators
Maps between vector spaces preserving linear structure
Adjoint Operators
- For operator , adjoint satisfies
- Matrix representation: conjugate transpose
- Properties:
Self-Adjoint Operators
- Real eigenvalues
- Orthogonal eigenvectors
- Spectral theorem applies
Dual Spaces
Vector space of linear functionals on
Dual Basis
- For basis of , dual basis satisfies
- Dimension equals original space
- Natural pairing:
Dual Maps
For linear map , dual map
Tensor Products
is universal space for bilinear maps
Definition
- Elementary tensors:
- Bilinear in components:
Properties
| Property | Description |
|---|---|
| Dimension | |
| Associativity | |
| Distributivity | |
| Field multiplication |
Multilinear Algebra
Tensors
- Multilinear maps:
- Type : contravariant, covariant indices
- Transformation rules under basis change
Exterior Algebra
- Antisymmetric tensors
- Wedge product
- Properties:
- Anticommutativity:
- Associativity:
- Distributivity over addition
- -forms and differential forms