In this section we explain how Sage can be used to explore linear transformations and deal with various concepts related to linear transformations that we have learned in this chapter.
Sage has a construction linear_transformation() to define a linear transformation. We can define a linear transformation in Sage using the following four different ways.
linear_transformation(A, side='left') defines a linear transformation as a matrix transformation defined by the matrix \(A\text{.}\) Domain and the codomain and the base space are inferred by the dimension of the matrix and base ring (the ring from on matrix is defined). Side is the keyword that can be taken as βleftβ or βrightβ, the default value is βleftβ.
linear_transformation(D, C, f), in this case \(f\) is the function that is defined on on a basis element of the domain and it produces the elements of the codomain. The linear tranformation is the unique linear transformation that is extended linearly on the domain \(D\text{.}\)
linear_transformation(D, C, images), where βimagesβ is a list or a touple of vectors of the codmain, whihc is equal to the size of the basis. Each element of th basis is mapped to the corresponding element of the image.
Clearly, here \(T\) is the matrix tranformatrion defined from \(\Q^3\) to \(\Q^2\text{.}\) We can find, the domain, codmain, parent, images, kernel, that is null space etc using the dot methods. Let us explore some of them.
T.matrix() returns a basis matrix of the image along with the dimension of the image space. By default, it takes option side="left". In our case, we need to give option side="right".
Define a matrix \(A=\left(\begin{array}{rrr}
-1 \amp 1 \amp 0 \\
2 \amp 0 \amp -1 \\
2 \amp -1 \amp 1 \\
0 \amp 2 \amp 1
\end{array}\right)\) and define a linear transformation \(T:\Q^3\to \Q^4\) by \(T(x)=Ax\text{.}\) Now define two vectors \(w_1=(-3, -1, 0, -31/3)\) and \(w_2=(1, -1/2, -1, 11/6)\) . Check that \(w_1,w_2\) lie in the image space of \(T\text{.}\) Let \(v_1\in T^{-1}(w_1)\) and \(v_2\in T^{-1}(w_1)\text{.}\) Show that \(v_1, v_2\) are linearly independent in \(\Q^3\text{.}\) Can you generalize this result and prove the same?
Now we define a subspace \(V_1\) of \(V\) with B as a basis and a subspace \(W_1\) of \(W\) with C as a basis. After that we rectrict T on to \(V_1\) on its domain and \(W_1\) on its codomain. We call this restriction as \(T_1\text{.}\) The matrix of \(T_1\) is the matrix of \(T\) with respect to \(\beta\) on domain and \(\gamma\) on codmain, that is \([T]_\beta^\gamma\text{.}\)
Note that the matrix \([T]_\beta^\gamma\) can also be obtained by defining a column matrix whose columns are \(w_1,w_2,w_3,w_4, T(v_1), T(v_2), T(v_3), T(v_4)\text{,}\) then applying RREF and extracting the last four columns.
Let us see what happens to the matrix of a linear transformation when we reshuffle the elemnts of a basis on domain and codomain. Let us find the matrix of the abobe linear transformation with resepect the basis \(\beta_1 =\{u_1,u_3,u_2,u_4\}\) of the domain and \(\gamma\) of the codomain. Here we have interchanged 2nd and 3rd basis elements of \(\beta\text{.}\) You may also explore with other interchanges.
Let \(T\R^n\to \R^m\) be a linear transformation. Let \(\beta=\{v_i\}\) and \(\gamma=\{w_j\}\) be bases of \(\R^n\) and \(\R^m\) respective. Let \(A=[T]_\beta^\gamma\text{.}\) Suppose \(\beta'\) is a basis obtained by permuting elements of \(\beta\text{.}\) Then \([T]_{\beta'}^\gamma\) is the matrix obtained by applying same permutaions to columns of \(A\text{.}\) Simlarly if \(\gamma'\) is a basis obtained by permuting elements of \(\gamma\text{.}\) Then \([T]_\beta^{\gamma'}\) is the matrix obtained by applying same permutaions to rows of \(A\text{.}\)
Find the reflection of \((2,4)\) about the line \(y=\frac{1}{2} x\text{.}\) Also plot the point and the line and the point point obtained by reflection.
Write a Sage routine to find the matrix of reflection about the plane \(ax+by+cz=0\text{.}\) Hence use this routine to find the reflection of a point \((2,5,7)\) about the plane \(2x-3y+z=0\text{.}\) Also plot the point, the plane and the point of reflection.
Write a Sage routine to find the matrix of projection of a point on to the plane \(ax+by+cz=0\text{.}\) Hence use this routine to find the projection of point \((2,5,7)\) on to the plane \(2x-3y+z=0\text{.}\) Also plot the point, the plane and the point projected.