All published worksheets from http://sagenb.org
Image: ubuntu2004
Links to other worksheets:
Book, (1) Linear Algebra Arithmetic, (2) Linear Algebra Applications, (4) Linear Transformations, (5) Changing Bases
This first block of code comes from the Linear Tranformation unit. It is a reminder of how a linear transformation transforms the plane. Most of the examples in this unit take the code below and modify it slightly to illustrate change of bases.
Matrix | \left(\right) |
Determinant | 6 |
Eigenvalues and Eigenvectors | Under the table |
The code below shows how a basis for is really just a way of defining a new coordinate system ( axes) in 2D. The coordinates of relative to this new system satisfy , so the coordinates are .
Basis | \left[\left[1, 2\right], \left[2, -3\right]\right] |
Matrix | \left(\right) |
Inverse | \left(\right) |
Determinant | -7 |
vector (a,b) has coordinates [(a,b)]_S = | \left(\frac{3}{7} \, a + \frac{2}{7} \, b,\frac{2}{7} \, a - \frac{1}{7} \, b\right) |
The code below shows how a basis for is really just a way of defining a new coordinate system ( axes) in 3D. The coordinates of relative to this new system satisfy , so the coordinates are .
Basis | \left[\left[1, 2, 0\right], \left[2, -3, 0\right], \left[0, -1, 1\right]\right] |
Matrix | \left(\right) |
Inverse | \left(\right) |
Determinant | -7 |
vector (a,b,c) has coordinates [(a,b)]_S = | \left(\frac{3}{7} \, a + \frac{2}{7} \, b + \frac{2}{7} \, c,\frac{2}{7} \, a - \frac{1}{7} \, b - \frac{1}{7} \, c,c\right) |
The following code illustrates how the exact same vector has different coordinates relative to different bases. Remember that the vector always satisfies So if and are two different bases, with matrices and formed by placing the basis vectors in columns, then We can then compute two change of bases matrices where and .
Basis | |
\left[\left[1, 2\right], \left[2, -3\right]\right] | \left[\left[1, 0\right], \left[2, 1\right]\right] |
Matrix | |
\left(\right) | \left(\right) |
Inverse | |
\left(\right) | \left(\right) |
Determinant | |
-7 | 1 |
P = (B2)^{-1} B1 and Q = B1^{-1} B2 | |
\left(\right) | \left(\right) |
The coordinates of v relative to each basis | \left(5,1\right) |
\left(\frac{17}{7},\frac{9}{7}\right) | \left(3,1\right) |
The words "change of basis matrix from to " are used in two opposite ways in different places. The matrix in can be call the change of basis matrix from to or the change of basis matrix from to (notice the reversal). It depends on the context and the use the author wished to emphasize.
- If we start with coordinates relative to , then multiplying by on the left transforms these to coordinates relative to . We say that is a change of basis matrix from to , as inputing coordinates relative to outputs coordinates relative to . Think of multiplication by as a way to transform us from what we know to what we want .
- If we start with coordinates relative to , then replacing with transform equations written relative to into equations written relative to . We then say that is a change of basis matrix from to , as it transforms equation from to .
The following code shows how to change equations from one coordinate system to another. In the example below, the set is the standard basis, whereas the set is the standard basis rotated 45 degrees counterclockwise. Here are some things to notice:
- If you know the coordinates and want the coordinates , then you compute .
- To change the equation to an equation in coordinates, you replace with . The change of basis matrix is different.
The axes are marked in red and blue.The axes are marked in orange and green. You can modify the xy basis, the uv basis, as well as any of the equations. If you need to adjust the viewing bounds to include more than [-3,3] in each window, feel free to adjust these.
Basis | \left[\left[1, 0\right], \left[0, 1\right]\right] | \left[\left[\frac{1}{2} \, \sqrt{2}, \frac{1}{2} \, \sqrt{2}\right], \left[-\frac{1}{2} \, \sqrt{2}, \frac{1}{2} \, \sqrt{2}\right]\right] |
Basis Matrix | \left(\right) | \left(\right) |
Inverse | \left(\right) | \left(\right) |
Coordinates of (a,b) | \left(a,b\right) | \left(\frac{1}{2} \, \sqrt{2} a + \frac{1}{2} \, \sqrt{2} b,-\frac{1}{2} \, \sqrt{2} a + \frac{1}{2} \, \sqrt{2} b\right) |
(x,y) = some function of (u,v) | \left(\frac{1}{2} \, \sqrt{2} u - \frac{1}{2} \, \sqrt{2} v,\frac{1}{2} \, \sqrt{2} u + \frac{1}{2} \, \sqrt{2} v\right) | \left(u,v\right) |
(u,v) = some function of (x,y) | \left(x,y\right) | \left(\frac{1}{2} \, \sqrt{2} x + \frac{1}{2} \, \sqrt{2} y,-\frac{1}{2} \, \sqrt{2} x + \frac{1}{2} \, \sqrt{2} y\right) |
Changing an equation from uv to xy | \frac{1}{36} \, {\left(\sqrt{2} x - \sqrt{2} y\right)}^{2} + \frac{1}{16} \, {\left(\sqrt{2} x + \sqrt{2} y\right)}^{2} = 1 | \frac{1}{4} \, u^{2} + \frac{1}{9} \, v^{2} = 1 |
Changing an equation from xy to uv | y = \sin\left(\pi x\right) | \frac{1}{2} \, \sqrt{2} u + \frac{1}{2} \, \sqrt{2} v = \sin\left(\frac{1}{2} \, {\left(\sqrt{2} u - \sqrt{2} v\right)} \pi\right) |
In the previous worksheet, we saw how a linear transformation tells us how to map the unit square to a parallelogram. When you pick a different basis, the "unit square" is really a parallelogram whose edges are formed by the basis vectors. This parallelogram representing the unit square is then mapped to the range and we have to find its coordinates relative to the new basis. In what follows below, we use the following color scheme:
- In the left picture, which represents the domain:
- domain basis = {red, blue}
- standard basis = {black,brown}
- In the right picture, which represents the range
- image of domain basis vectors = {red, blue}
- image of standard basis vectors = {black, brown} (which provides the columns of )
- range basis vectors = {orange, green}
The columns of are precisely the coordinates of the images of the red and blue vectors relative to the orange and green vectors.
S - Basis for Domain | \left[\left[-1, 1\right], \left[2, 1\right]\right] |
S' - Basis for Range | \left[\left[3, 0\right], \left[0, 2\right]\right] |
B - matrix of domain basis vectors | \left(\right) |
B' - matrix of range basis vectors | \left(\right) |
B'^{-1} | \left(\right) |
T(x,y) - The linear transformation | \left(2 \, x + y,3 \, y\right) |
[T]_{E_2} - The standard matrix representation | \left(\right) |
[T]_{S,S'} - The matrix representation relative to S and S' | \left(\right) |
[T(s,y)]_{S_'} = [T]_{S,S'}[(a,b)]_S | \left(\frac{2}{3} \, a + \frac{1}{3} \, b,\frac{3}{2} \, b\right) |
The code below repeats what was done above, but without drawing any pictures. This way you can work with the code for any linear transformation of the form . As long as your vector spaces are finite dimensional, then the code below will help you see how to create a matrix representation relative to any basis.
S - Basis for Domain | \left[\left[-1, 1, 0\right], \left[2, 1, 2\right], \left[3, -2, 1\right]\right] |
S' - Basis for Range | \left[\left[3, 1\right], \left[-1, 3\right]\right] |
B - matrix of domain basis vectors | \left(\right) |
B' - matrix of range basis vectors | \left(\right) |
B'^{-1} | \left(\right) |
A=[T] - Standard matrix representation | \left(\right) |
[T]_{S,S'} = B'^{-1}AB - Matrix representation relative to S and S' | \left(\right) |
v - standard coordinates | \left(a,b,c\right) |
[v]_S - coordinates relative to S | \left(-5 \, a - 4 \, b + 7 \, c,a + b - c,-2 \, a - 2 \, b + 3 \, c\right) |
T(v) - standard coordinates of T(v) | \left(2 \, a + b,3 \, b - 2 \, c\right) |
[T(v)]_{S_'} = [T]_{S,S'}[v]_S - coordinates of T(v) relative to S' | \left(\frac{3}{5} \, a + \frac{3}{5} \, b - \frac{1}{5} \, c,-\frac{1}{5} \, a + \frac{4}{5} \, b - \frac{3}{5} \, c\right) |
I still need to give an example of what happens if you choose the null space as part of your basis, and the image of the other vectors in your basis as a basis for the range. Then the map is simply the identity. Maybe I won't visualize this, rather just show how to do it.
Then I need to show what happens if I use eigenvectors as the basis vectors. This provides a really nice way to view the matrix transformation.
P - matrix of basis vectors | \left(\right) |
P^{-1} | \left(\right) |
T(x,y) - The linear transformation | \left(2 \, x + y,3 \, y\right) |
[T]_{E_2} - The standard matrix representation | \left(\right) |
[T]_{P} - The matrix representation relative to eigenvectors | \left(\right) |
[T(a,b)]_{P} = [T]_{P}[(a,b)]_P | \left(3 \, b,2 \, a - 2 \, b\right) |
Eigenvalues | \left[3, 2\right] |
P - matrix of basis vectors | \left(\right) |
P^{-1} | \left(\right) |
T(x,y) - The linear transformation | \left(2 \, x + y,3 \, y\right) |
[T]_{E_2} - The standard matrix representation | \left(\right) |
[T]_{P} - The matrix representation relative to eigenvectors | \left(\right) |
[T(a,b)]_{P} = [T]_{P}[(a,b)]_P | \left(3 \, b,2 \, a - 2 \, b\right) |
When you choose as your basis a set of eigenvectors of , the matrix whose columns are eigenvectors allows us to diagonalize . We have the equation where is the diagonal matrix whose diagonal entries are the eigenvectors. The code below illustrates how to do this for any matrix. If the matrix is not diagonalizable, it is precisely because there are not enough linearly independent eigenvectors. In this case, Jordan form provides a simple way to view the transformation. We'll be looking at Jordan form more in the next unit.
Eigenvalues - if there is a repeat, does P contain a column of zeros? | \left[7, 5, 5\right] |
P - matrix of basis vectors - does it contain a column of zeros? | \left(\right) |
P - matrix of basis vectors using generalized eigenvectors | \left(\right) |
J=P^{-1}AP - Jordan Form | \left(\right) |
J - Jordan Form with an emphasis on the Jordan blocks | \left(ParseError: KaTeX parse error: Expected '\right', got 'EOF' at end of input: …} 7 \end{array}\right) & \left(\right) \\ \left(\right) & \left(\right) \end{array}\right) |