Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Math 208 Interactive Notebooks © 2024 by Soham Bhosale, Sara Billey, Herman Chau, Zihan Chen, Isaac Hartin Pasco, Jennifer Huang, Snigdha Mahankali, Clare Minerath, and Anna Willis is licensed under CC BY-ND 4.0
License: OTHER
Image: ubuntu2204
Chapter 2 Euclidean Space
by Snigdha Mahankali
snigsm@uw.edu
This Sage Worksheet is a part of a linear algebra tutorial created by Sara Billey's 2024 WXML group. It follows Chapter 8 of Holt's Linear Algebra with Applications. This section introduces on how to work with vectors, find their spans and determine linear independence.
Vectors
The way to create a vector is to use the vector keyword followed by the vector you wish to make. Sage will use context clues to figure out whether a vector is a row or column vector,
but all vectors will be rendered horizontally. For the purposes of this tutorial, all matrices will be inputed with column vectors and then transposed to look correct!
(Note: QQ and other specifiers denote which domain the vector will live in (ZZ: Integers, QQ: Rational, RR: Reals, CC: Complex, SR: Symbolic Ring aka variable expressions))
Vector addition works simply with the + operator and scalar multiplication works simply with the * operator. Here, any vector can be refered to by its variable name and can be used in arithmetic operations just as you would with normal intgers. These arithmetic operations are fomally called Linear Combinations where you combine vectors to create new ones.
Vectors can also be used to represent solutions to systems of equations (i.e Vector Form or General Solution Form).
Based on Textbook 2.1 Example 3 (open the next dropdown for the reference)
Vectors look like arrows, always starting from (0,0) and extending outward.
You can determine u + v using the tip to tail method.
You can also determine u + v using the parallelogram method.
Scaling a vector moves it along a fixed line.
The vector below is an example of putting a 2 dimentional vector in a 3 dimesional space
Span
Next, let's explore how to use these vectors to describe the space they live.
Span can be defined by all the linear combinations of vectors, typically given as a series of vectors {[1, 2, 3], [4, 5, 6]} or as a dimention (R2)
By solving an augmented matrix, we can test whether a matrix is in the span of others
Based on Textbook 2.2 Example 2 (open the next drop down for the reference)
(Note that the matrix used has been transposed for ease of computation)
Let's explore what span looks like visually. Two vectors that have different spans in R2 will span the entire space. This pattern continues for n independent vectors in Rn
The span of one vector is a line.
Any dependent (vectors in the span of others) vectors in R2 will also form a line like the one below.
Span of two vectors in R3 forms a plane like the one below.
Note: This plane extends to infinity, even if it is shown as aa bounded shape onscreen.
Vectors in the span of the others will lie on the plane made by independent vectors. Vectors not in the span will not be bounded by that plane.
The following code calculates span from a matrix of vectors. Feel free to experiment!
Note: Matrices in Sage are usually made row wise. For the matrix to be comprised of columnn vectors, simply transpose the matrix when you use it.
TIP: The span of a set of vectors are the vectors corresponding to pivots in the ROWS of the solved matrix.
A set of n vectors span Rn if there is something in each ROW of the solved matrix (no 0 rows)!
Any system of equations can be made into the form Ax = b where A is some matrix and x and b are vectors. Experiment with the code below to see how that works!
Linear Independence
Next, let's describe our sets of vectors.
A set of vectors is independent if you are able to solve the augmented matrix and back-substitute towards one single unique solution. But if at least one vector is in the span of any other vectors in the set, the set is linearly dependent and has infinite solutions. Try different vectors below to explore!
Note: A set of vectors containing the 0 vector is always linearly dependent since any vector in the set can be scaled by a factor of 0 to get the 0 vector.
TIP: A set of vectors are linearly independent if there is a pivot in each COLUMN down the diagonal of the solved matrix!
If a set of vectors is lineraly independent, then Ax = b (written as a series of equations or as an augmented matrix) has at most one unique solution for every b
Based on Textbook 2.3 Example 4 (open the next drown down for the reference)
Based on that example, since the the solution to Ax = b or Ax = 0 has free variables, the set is not linearly independent!)
Independent vectors are not in the span of another vector (or set of vectors)!
Unifying Theorum Part 1 (If you know one is true, you automatically know the others are true):
~ A set of n vectors spans Rn
~ A set of n vectors is lineraly independent
~ Ax = b (written as a series of equations or as an augmented matrix) has one unique solution for every b
Function Reference Sheet: