Matrix Basics - drnickmines/MinesLinearAlgebra GitHub Wiki
Linear Algebra deals primarily with matrices, which are boxes of numbers. Here's an example of a matrix:
We typically use capital letters to denote matrices. The matrix
Important
By convention, we always use a (row,column) convention when working with matrices.
Note
Most matrices we encounter in STEM applications are very large, with hundreds or thousands of rows and/or columns. In this class, we'll do all our hand calculations using small matrices with up to 5-6 rows/columns. We'll work with larger matrices in our Python labs.
Now, why do we worry about boxes of numbers? Aside from just the interesting math that arises, these boxes of numbers are usually storing information. The study of matrices gives us power to manipulate and analyze that data.
This is a list of some basic matrix operations with examples:
- Addition/subtraction works by corresponding components:
Note
Addition/Subtraction of matrices is only defined if the matrices are the same size!
- Scalar multiplication also works by component:
- The transpose of a matrix, denoted
$\large A^T$ , is the matrix we get if we turn the rows of$\large A$ into columnns (or, equivalently, the columns into rows):
-
A square matrix is a matrix that has the same number of rows and columns (a
$\large 2\times 2$ , a$\large 3\times 3$ , etc.) -
The identity matrix
$\large I$ is a square matrix with this form:
-
A zero matrix can be any size and consists only of 0's.
-
Vectors can be considered 1-dimensional matrices. So,
- The diagonal of a square matrix is the set of numbers connecting the upper left element to the bottom right element. This is sometimes written as a vector and sometimes just as a list of numbers.
The product of two matrices has a trickier definition than addition or subtraction. The product
The image below illustrates the definition:
Image from: https://www.mathsisfun.com/algebra/matrix-multiplying.html
Here's a video example of how it works:
Because of this definition, matrix multiplication is not always defined. For
Warning
Matrix multiplication is not commutative! That is, even if they both exist (which they often don't),
Note
We will see soon why matrix multiplication has this funny definition. It's related to the way we represent systems of equations in linear algebra.
Since a vector is just a one dimensional matrix, matrix-vector multiplication is just a small case of matrix-matrix multiplication. In the following example, we have a
Note
There is another way to view matrix-vector multiplication. Look at the example above...we could have written this as a linear combination of the columns of
Linear algebra provides a slick way of representing systems of linear equations. Take the following system as an example:
Now, let's define three matrices/vectors as follows:
Then we see that the matrix-vector product equation
Check your understanding: What system of equations is represented by the following matrix equation?
Click to see the answer
The system consists of the equations
$\large 2x+3y=3$ and$\large -x+4y=0$ .
Whenever we see
- It is compact, so we can still write a large system of many equations and unknowns on a single line.
- It will lead to a systematic approach (an algorithm) to find the solution.
Note
We will see soon how linear algebra helps us solve these systems! For now, we just want to point out that matrix multiplication allows us to write systems in this handy way.
Some matrices come up often enough to get names. The following definitions will appear from time to time in this class:
- A square matrix
$\large A$ is symmetric if$\large A^T=A$ . Here's an example:
- A square matrix
$\large A$ is diagonal if$\large a_{i,j}=0$ for all$\large i\ne j$ (every element not on the diagonal is zero). Here's an example:
- A square matrix
$\large A$ is upper (lower) triangular if every element below (above) the diagonal is zero. Here are examples of each:
- A square matrix
$\large A$ is orthogonal if its columns are all orthogonal to each other (the dot product of any column with any other column is 0) and if every column is a unit vector (has length one). An equivalent definition is that$\large A^TA=AA^T=I$ , the identity matrix. Here's an example:
Every row and column in this matrix has length 1. Go ahead and check the dot product of any row with another. They are all zero.
There are many more special, named types of matrices, but these four will do for now.
I can:
- Use linear algebra terminology and notation.
- Perform basic matrix computations.
- Multiply matrices together (or recognize when the matrix product does not exist).
- Write a system of linear equations as
$\large A\vec{x}=\vec{b}$ . - Recognize square, symmetric, diagonal, triangular, and orthogonal matrices.