- Refresher: vectors and working with them
- Matrices: notation, language, basic algebra
- Representing systems of equations with matrices
- Linear algebra in environmental science
EDS 212: Day 4, Lecture 1
Linear algebra continued
August 8th, 2024
Part 1: Linear algebra continued
Matrices
A matrix is a table of values (multiple vectors in combination). A vector, therefore, can be thought of as a matrix with a single column.
Matrix algebra (add / subtract)
Add or subtract the corresponding elements (by matrix position) to create a new matrix of the same dimensions.
Scalar multiplication
To multiply a matrix by a scalar, multiply each element in the matrix by the scalar to get a scaled matrix of the same dimensions.
For example:
Recall: dot product
The dot product of two vectors is the sum of their elements multiplied:
For \(\vec a =[1,5]\) and \(\vec b = [2,-3]\):
\[\vec a \cdot \vec b=(1)(2)+(5)(-3)=-13\]
Matrix multiplication
We find the dot product of row \(\cdot\) column vectors:
Practice problems
Critical thinking: Matrices with unequal dimensions
What do you think the output matrix would contain if you were multiplying the following?
Let’s try one!
Diagonal matrix
A diagonal matrix is (almost always) a square matrix (\(m\) = \(n\)) where only elements on the diagonal are non-zero values.
What happens when we multiply a matrix by a diagonal matrix?
A diagonal matrix is also called a scaling matrix because it scales rows proportionally, but not by the same value:
Matrices as systems of equations
Often in environmental data science, we have multiple equations representing processes. Matrices give us a way to express these systems of equations in data structures that are easy to store and work with in data science. For example, let’s say we have a system:
\[3x-8y=5\]
\[x + 2y = 10\]
How can we write this using matrices?
Rewriting in matrix form:
\[3x-8y=5\]
\[x + 2y = 10\]
The matrix form of this system of equations looks as follows:
Example: matrices and linear algebra in environmental science
Leslie Matrix: Population ecology
A matrix model that accounts for survival / fecundity rates at different life stages for a species.
Overview:
Define life stages
Estimate probability of survival / reproduction at different life stages to create a matrix over time
Combine into a matrix that allows calculation at the next time step
Writing estimates as equations:
For our species, each adult female will lay ~600 eggs during each cycle (let’s say that’s a year). Which means that the eggs at time \(t+1\) can be estimated by the number of adult females * 600:
\[E_{t+1}=600 * F_t\]
Writing estimates as equations:
\[E_{t+1}=600 * F_t\]
We also estimate that 20% of eggs survive to reach larval stage:
\[L_{t+1} = 0.2*E_t\]
Writing estimates as equations:
\[E_{t+1}=600 * F_t\] \[L_{t+1} = 0.2*E_t\]
We also estimate that 8% of those that reach larval stage will survive to become reproducing female adults:
\[F_{t+1}=0.08*L_t\]
How can we write this in matrix form?
\[E_{t+1}=600 * F_t\]
\[L_{t+1} = 0.2*E_t\]
\[F_{t+1}=0.08*L_t\]
How can we write this in matrix form?
\[E_{t+1}=600 * F_t\]
\[L_{t+1} = 0.2*E_t\]
\[F_{t+1}=0.08*L_t\]
Leslie matrix
Leslie matrix
See A Primer of Ecology, by Nicholas J. Gotelli