Matrices and Vectors
This chapter covers the following topics:
- Matrices and their operations
- Vectors
- Gradient, divergence, and curl
- Identities
- Newton’s method for root extraction
- Trapezoidal rule for numerical integration
- Simpson’s rule for numerical integration
Matrices and their operations
A matrix is a rectangular array of numbers arranged in rows and columns. We usually write an matrix (with rows and columns) as:
Addition and subtraction
You can add or subtract two matrices only if they have the same dimensions. The operation is done element by element.
Addition:
Subtraction:
Matrix multiplication
Matrix multiplication is not done element by element. Instead, each entry of the product comes from a row-by-column dot product.
If is an matrix and is a matrix, then is an matrix, and each entry is
Matrix multiplication is defined only when the number of columns of matches the number of rows of .
Determinant of a matrix
The determinant is defined for square matrices. It produces a single number that is used in several places, including checking whether a matrix is invertible.
For a matrix:
For a matrix:
Adjoint of a matrix
The adjoint (also called the adjugate) of a square matrix is the transpose of its cofactor matrix:
Inverse of a matrix
A square matrix has an inverse only if its determinant is nonzero (that is, ). When the inverse exists, it is given by:
Identity matrix
An identity matrix is a square matrix with ones on the diagonal and zeros everywhere else:
It acts like the number 1 in matrix multiplication:
Properties of matrices
- Associative property:
- Distributive property:
- Commutative property (addition):
- Transpose of a product:
- Inverse property:
This section has outlined the main matrix operations and the key definitions used with square matrices.
Vectors
A vector is a quantity that has both magnitude and direction. In three dimensions, a vector is often written in component form as:
Where:
- are the components of the vector in the x, y, and z directions.
- are unit vectors in the x, y, and z directions, respectively.
Vector addition and subtraction
Addition
Vector addition combines components in the same direction:
Subtraction
Vector subtraction subtracts components in the same direction:
Dot product (scalar product)
The dot product of two vectors produces a scalar. It can be defined using magnitudes and the angle between the vectors:
Or computed directly from components:
- Result: Scalar
- Measures projection of one vector onto another.
Cross product (vector product)
The cross product of two vectors produces a vector perpendicular to both. Its magnitude depends on the angle between the vectors:
Where is the unit vector perpendicular to both and .
Using a determinant form:
- Result: Vector
- Direction follows the right-hand rule.
Angle between two vectors
You can find the angle between two nonzero vectors using the dot product:
Projection of a vector
Scalar projection of on :
The scalar projection gives the signed length of in the direction of :
Vector projection of on :
The vector projection gives the actual vector component of parallel to :
Gradient, divergence, and curl
Gradient (∇f)
The gradient takes a scalar field and produces a vector field. The gradient points in the direction where increases most rapidly.
Divergence (∇·F)
The divergence takes a vector field and produces a scalar field:
- Measures the “outflowing-ness” of a vector field at a point.
Curl (∇×F)
The curl takes a vector field and produces another vector field:
- Measures the rotation or swirling strength of the field.
Identities
Vector algebra identities
Vector dot product properties
-
Commutativity:
-
Distributive property:
-
Dot product with itself (magnitude squared):
-
Unit vector dot products:
-
Perpendicular unit vectors:
-
Zero dot product condition:
If , then either:
- ,
- ,
- or is perpendicular to .
Vector cross product properties
-
Anti-commutativity:
-
Distributive property:
-
Alternative distributive property:
-
Unit vector cross products:
-
Cyclic permutation:
-
Anti-symmetry property:
-
Zero cross product condition:
If , then either:
- ,
- ,
- or is parallel to .
Vector calculus identities
-
Laplacian operator:
-
Curl of a gradient:
-
Divergence of a curl:
-
Vector Laplacian identity:
Newton’s method for root extraction
Newton’s method (also called the Newton-Raphson method) is an iterative numerical technique for finding roots of a real-valued function (that is, values of where ).
The iteration formula is:
- Choose an initial guess
- Compute successive approximations using the formula
- Stop when the difference is below a chosen tolerance
Example
To find the square root of 2, define a function whose root is :
Substitute into the iteration formula:
Trapezoidal rule for numerical integration
The trapezoidal rule estimates a definite integral by approximating the graph of with straight-line segments, forming trapezoids.
Single application
For over :
Composite trapezoidal rule
Divide the interval into equal subintervals of width , then:
Simpson’s rule for numerical integration
Simpson’s rule estimates a definite integral by fitting parabolas through points on the curve.
Single application
For over , with midpoint :
Composite simpson’s rule
Let be even and :