Linear Algebra
- Physical Vectors
- Real Vectors
- Linear Equations
- Systems of Linear Equations
- Gaussian Elimination
- Row Reduction
- Graphical Solutions
- Echelon Forms
- Parametric Solutions
- Gauss-Jordan Elimination
- Matrices & Linear Equations
- Matrices
- Matrices & Linear Combinations
- Transpose of a Matrix
- Trace of a Matrix
- Properties of Matrix Algebra
Physical Vectors
- To gain some intuition on we'll start by focusing on physical vectors — vectors that can be visualized geometrically. These are the vectors often seen in physics. Later, we'll extend this concrete foundation to more general and abstract concepts.
- definition. A physical vector is a mathematical object with a magnitude and a direction.
- definition. A vector quantity is a quantity that has both a magnitude and a direction.
- Examples: Displacement, velocity, acceleration, etc.
- definition. A physical scalar is a mathematical object with a magnitude but no direction.
- Examples: Mass, temperature, pressure, energy, etc.
- We denote physical vectors with a lower case letter and an over-right arrow. For example:
- In later sections, we will omit the use of this over-right arrow.
Resultants
- Suppose an object moves from point to then from to
- We can represent its overall displacement with two successive vectors, (a vector from to ) and (a vector from to ).
- The object's net displacement is a single displacement vector from to call it
- We call the vector sum or resultant of and
- Some properties of vector addition to take note of:
- Commutativity. The order of addition does not matter.
- Associativity. Adding two or more vectors, we can group the vectors however way we'd like.
Vector Negation & Difference
- The vector is a vector with the same magnitude as but with opposite direction.
- Thus:
- We use this property to define the vector difference.
Vector Components
- A component of a vector is the vector's projection on an axis.
- To find the projection of a vector along an axis geometrically, we draw perpendicular lines from the vector's ends to the axis, as shown below.
- We can also find the projection algebraically:
where is the angle that the vector makes with the positive direction of the -axis, and is the magnitude of
- From the equations above, we have:
- The vector's projection on an -axis is its -component.
- The vector's projection on a -axis is its -component.
- The vector's projection on a -axis (for 3D vectors) is its -component.
- The process of finding the components of a vector is called vector resolution.
Unit Vectors
- A unit vector is a vector with a magnitude of and points in a particular direction.
- The unit vector's sole purpose is to specify a direction.
- We use special symbols for these vectors:
Symbol Meaning Unit vector in the positive direction of the -axis. Unit vector in the positive direction of the -axis. Unit vector in the positive direction of the -axis. - Unit vectors can be used to express vectors. For example: Here, the quantities and are called the vector components of The quantities and are called the scalar components (or simply components) of
Adding Vectors by Components
- We can add multiple vectors by adding their respective components.
- example. Given we have:
Vector Multiplication
- There are three types of vector multiplication:
- The scalar product,
- dot product, and
- cross product.
Scalar Product
- definition. To muliply a vector by a scalar we multiply each component of the vector by
Dot Product
- definition. Given vectors and the dot product, denoted is defined to be where is the magnitude of is the magnitude of and is the angle between the directions of and
- Dot products are commutative:
- When two vectros are in unit-vector notation, we write their dot product as:
Cross Product
- definition. Given vectors and the cross product of and denoted is defined to be: where is the smaller of the two angles between and
Real Vectors
- For now, we'll focus only on vectors in That is, vectors with components, all of which are real numbers.
- definition. The zero vector in is the vector whose components are all zero.
- The zero vector is special for a few reasons:
- Given a vector adding the zero vector will always return Because of this result, we call the zero vector the additive identity of
- The zero vector is the only vector with a magnitude of zero.
- The zero vector is the only vector with no direction.
Scalar Multiplication
- Scalar multiplication is straightforward: We multiply each component of the vector by the given scalar Geometrically (in or ), if this has the effect of making the vector shorter or longer.
- definition. Let be a vector in and let be a scalar. Then:
- example. Since can be any real number, scalar multiplication's definition implies that we can negate a vector and perform element-wise division.
- definition. Given a vector the negation of denoted is: Geometrically, negating a vector "switches" its direction.
Linear Equations
- definition. A linear equation with variables is an equation of the form where are constants.
- If satisfy the equation we say that is a solution to the equation.
- example. Consider One solution to the equation is since Another solution is since There are, in fact, an infinite number of solutions to the equation. We can express this infinite set of solutions as follows:
- The set of all solutions to a linear equation is called the linear equation's solution space.
Systems of Linear Equations
-
Many problems in mathematics can be reduced to systems of linear equations. Linear algebra provides us the tools for solving these systems.
-
definition. The system
is called an (or ) system of linear equations, or linear system, where and each is a real number called an unknown of the system.
-
Given a system of linear equations each -tuple that satisfies is called a solution of In a system with two unknowns and each linear equation defines a line on the - plane.
-
example. Consider the system
Note that we chose the variables and arbitrarily. We could've just used and
Notice that these are simple linear equations. Solving for
The point where these lines intersect is a solution to the system. In this case, the point Thus, the system above has the solution space of Notice the graph for this system. What are the coordinates of the point where the two lines meet?
An system of linear equations is inconsistent if it has no solution (i.e., a solution space of ). The system is consistent if it has at least one solution. An system of linear equations is underspecified if it has more unknowns than equations If the system has more equations than unknowns then the system is overspecified. If an underspecified system of linear equations is consistent, then it will have infinitely many solutions.
Homogeneous Linear Systems
- Given the linear system If for all we say that the system is homogeneous. Homogeneous linear systems have a special property: If a system is homogeneous, then is always a solution (but not necessarily the only solution).
- Every homogeneous linear system is consistent because all such systems have the solution This solution is called the trivial solution. All other solutions (if there are any) are called nontrivial solutions. Because homogeneous systems always have the trivial solution, there are only two possibilities for their solutions:
- The system has only one solution (the trivial solution), or
- the system has infinitely many solutions, including the trivial solution.
- The one case where a homogeneous system always has nontrivial solutions is the underspecified homogenous linear system — a homogeneous linear system with more unknowns than equations.
- theorem. If a homogeneous linear system has unknowns, and if the reduced row echelon form of its augmented matrix has nonzero rows, then the system has free variables.
- theorem. A homogeneous linear system with more unknowns than equations has infinitely many solutions.
Augmented Matrices
-
An linear system can be written as a rectangular array of by numbers by leaving out the and signs and the variables. We call this an augmented matrix. The general system
has the augmented matrix
Gaussian Elimination
-
We can solve a linear system (find its solution space) through Gaussian elimination. The method of Gaussian elmination employs three operations:
- Swapping: Interchange the equations.
- Scaling: Replace an equation by any nonzero multiple of itself.
- Pivoting: Replace an equation by a multiple of itself plus a multiple of another equation.
-
example. Consider the system
Swapping:
Scaling by the first equation :
Pivoting (replace the second equation by "two times the second equation minus the first equation"):
- Two times the second equation:
- Minus the first equation:
- Result:
Row Reduction
-
Since linear systems can be represented with augmented matrices, we can frame Gaussian elimination in terms of augmented matrices:
- Swapping: Interchange rows.
- Scaling: Replace any row by a non-zero multiple of itself.
- Pivoting: Replace any row by itself plus a multiple of another row.
-
example. Using the augmented matrix for our previous system:
Swapping rows and (we can express this notationally with ):
Multiply row by (scaling, expressed notationally as ):
Replace row by " times row minus row (a pivot, expressed notationally as ):
-
The goal of Gaussian elimination, as applied to augmented matrices, is row reduction: We use the elementary row operations to eliminate variables from selected rows of the augmented matrix until we obtain a solution space.
Graphical Solutions
- For linear systems in and we can quickly see solutions with the aid of plotting.
Linear Systems in ℝ²
-
A linear equation of the form where are real constants, graphically corresponds to a line in the Cartesian plane. Given two such lines (i.e., a linear system), there are three possible cases which may occur:
Intersecting Lines Parallel Lines Coincident Lines One point of intersection; there is a unique solution. No points of intersection; there are no solutions. Infinitely many points of intersection; there are infinitely many solutions.
Linear Systems in ℝ³
-
In parallel planes indicate there are no solutions, since there is no common intersection.
-
exmaple. The system
has no solution. Examining the plot above, there is no point of intersection since the resulting planes are parallel. The fact that planes intersect, however, does not imply that there is a solution.
-
Two parallel planes with no common intersection also indicates that the system has no solutions.
-
example. The system
has no solution. While there are infinitely many points of intersection, there isn't a common intersection.
-
If the planes share a common intersection, then either the intersection is a line or a point. If it's a line, then there are infinitely many solutions, since the line comprises infinitely many points.
-
example. The system
has infinitely many solutions since its common intersection is a line.
-
If, however, the common intersection is a point, then there is exactly one solution.
-
example. The system
has exactly one solution, since the equations' corresponding planes intersect at a single, common point of intersection. Nevertheless, the following fact always applies, regardless of what linear system we're in:
-
theorem. Every system of linear equations has zero, one, or infinitely many solutions. There are no other possibilities.
Echelon Forms
-
Consider the following system, with its corresponding augmented matrix and plot.
What is the solution space for this system? We will use the elementary row operations.
Add times the first equation to the second equation.
Add times the first row to the second row.
Add times the first equation to the third equation.
Add times the first row to the second row.
Multiply the second equation by
Multiply the second row by
Add times the second equation to the third equation.
Add times the second row to the third row.
Multiply the third equation by
Multiply the third row by
Add times the second equation to the first equation.
Add times the second row to the first row.
Add times the third equation to the first equation and times the third equation to the second equation.
Add times the third row to the first row and times the third row to the second row.
We see that the solution space comprises exactly one solution:
- If we rewrite the augmented matrix as a plain, old matrix we get a particularly special kind of matrix — a matrix in reduced row echelon form.
- definition. A matrix is in reduced row echelon form if, and only if, the following properties hold for
- If a row does not consist entirely of zeros, then the first nonzero number in the row is This is called the leading 1.
- If there are any rows that consist entirely of zeros, then they are grouped together at the bottom of the matrix.
- In any two successive rows that do not consist entirely of zeros, the leading in the lower row occurs farther to the right than the leading in the higher row.
- Each column that contains a leading has zeros everywhere else in that column.
- Variables that correspond to the leading s are called leading variables, and all others free variables.
- Matrices that satisfy the first three properties are said to be in row echelon form.
- To be in reduced row echelon form, the matrix must satisfy all four properties.
Parametric Solutions
- Consider the augmented matrix below (vertical separator omitted):
- The last row maps to the equation This is trivial and can be discarded since it holds no restrictions on or Thus:
- Above, we see that the leading variables are and with a free variable. If we solve for the leading variables in terms of the free variables, we get: It's now apparent that can be treated as a parameter. So we can express the solution space with the parametric equations
Gauss-Jordan Elimination
-
In the preceding examples, we saw that we can solve a linear system by casting its augmented matrix into reduced row echelon form. But how did we know which elementary operations to perform? Our choices seemed arbitrary, if not the result of trial and error. We now introduce an algorithm for reducing any matrix to reduced row echelon form — Gauss-Jordan Elimination. To illustrate, we will reduce this matrix:
Step 1. Find the leftmost column that does not consist entirely of zeros.
The leftmost column not entirely of zeros is colored red.
Step 2. Swap the top row with another row, if necessary, to bring a nonzero entry to the top of the column found in step
We swapped the first and second rows.
Step 3. If the entry on top of the column found in step is multiply the first row by to introduce a leading
We multiplied the first row by
Step 4. Add multiples of the top row to the rows below so that all entries below the leading become zeros.
We added times the first row of the preceding matrix to the third row.
Step 5. Now cover (ignore) the top row in the matrix. With the remaining rows (the submatrix) repeat the process again starting from step
Leftmost nonzero column is colored red.
We multiply the first row in the submatrix by to introduce a leading
We add times the first row of the submatrix to the second row of the submatrix to introduce a zero below the leading
We cover the top row of the submatrix and return again to step The leftmost nonzero column is colored red.
The first (and only) row in the new submatrix is multiplied by to introduce a leading
The matrix is now in row echelon form. To find the reduced row echelon form, proceed to step
Step 6. Beginning with the last nonzero row and working upward, add suitable multiples of each row to the rows above to introduce zeros above the leading
We added times the third row of the preceding matrix to the second row.
We added times the third row to the first row.
We added times the second row to the first row. The matrix is now in reduced row echelon form.
Matrices & Linear Equations
-
We can represent a system of linear equations with matrices. We place the coefficients into vectors,
then place the vectors into matrices
Matrices
- A matrix can be thought of as an array of arrays. They allow us to compactly represent a system of linear equations.
- definition. Let A real-valued matrix is an tuple of elements This tuple is ordered as a rectangle of rows and columns: We call the row index, and the column index.
- Some additional terminology: A matrix is called a row vector, and a matrix is called a column vector.
- example. In programming, we can represent a row vector with a simple array:
let R = [1, 2, 3, 4];
- example. A matrix would be an array of arrays:
let M = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ];
- example. A column vector would be an array of one-element arrays:
let C = [[1], [2], [3]];
Matrix Equality
- definition. Two matrices are equal if and only if they have the same size and their corresponding entries are equal.
Matrix Addition
- To add two matrices, we add each element of one matrix to the corresponding element (the element of the same indices) in the other matrix (element-wise sum).
- definition. Let and let Then the sum is defined as:
- example.
- From the definition, we see that matrices of different sizes cannot be added.
Matrix Multiplication
- There are three forms of matrix multiplication: scalar multiplication, the Hadamard product, and the row-column dot product.
Hadamard Product
- The Hadamard product is simply element-wise multiplication.
- definition. Let and let Then the Hadamard product is defined as:
- Like the matrix sum, the Hadamard product is defined only if and have the same dimensions.
- example.
Scalar Multiplication
- When we multiply a scalar to a matrix, we multiply each element of the matrix with the scalar.
Row-Column Dot Product
-
With matrix sums, we simply perform element-wise addition. Matrix multiplication, however, looks a little different:
-
definition. Given matrices and the elements of the product are computed as:
That is, to compute the element multiply the row of with the column of and sum them.
-
example. To compute the row-column dot product of
we start by computing the dot product of the first row of and the first column of
This gives us the first row, first column entry:
Next we compute the first row, second column dot product:
This gives us the first row, second column entry:
Now the second row, first column:
Thus, we now have:
Finally, compute the second row, second column:
The result:
-
Notice: Given a matrix and a matrix the row-column product is defined only if the number of columns of is equal to the number of rows of In general, given an matrix and an matrix is defined only if the s are the same. The result is an matrix.
-
Why do we multiply matrices like this? A small bakery sells three types of cake slices: Coffee is a slice; chocolate is a slice; and carrot is a slice. The bakery maintains a ledger of how many that've sold. Here is a snippet for the past four days:
Mon. Tue. Wed. Thu. Coffee 13 9 7 15 Chocolate 8 7 4 6 Carrot 6 4 0 3 And here are the prices per slice:
Price Coffee 3 Chocolate 4 Carrot 2 How much revenue did the bakery generate on Monday? We multiply the number of slices sold for that type with the type's price per slice, perform that operation for each type, and sum the products:
To compute the revenue for each day, we compute the row-column dot product:
In other words, to find the revenue, we must match each price to each quantity. As it turns out, this operation (matching entries in one table to the entries in another, multiplying them, and then summing the results) occurs over and over again in pure and applied mathematics. So much so that we've defined it as its own operation, the row-column dot product, or simply, the matrix product.
⚠ In real arithmetic, we know that (the commutative law of multiplication). This law does not hold for matrix multiplication (it is very rarely the case that in fact, you have better luck assuming ). The test can fail for possible reasons:
- is defined, but is not.
- and are both defined, but they are of different orders.
- and are both defined, and have the same orders, but the product's entries are different.
Matrices & Linear Combinations
-
definition. If are matrices of the same size, and if are scalars, then an expression of the form
is called a linear combination of with coefficients
Transpose of a Matrix
-
If is any matrix, then the transpose of denoted is defined to be the matrix that results from interchanging the rows and columns of
-
example. If
then
Trace of a Matrix
-
If is a square matrix, then the trace of denoted by is the sum of the entries on the main diagonal of If is not a square matrix, then is undefined.
-
example. If
then
Properties of Matrix Algebra
- Let and be matrices and and be scalars. Then: