Problem 6.2.4
The aim is to find the matrix of the transformation $T$ defined by
$$ T \left[ \begin{array}{r} 1\\1\\-8 \end{array} \right] =\left[ \begin{array}{r} 1\\3\\1 \end{array} \right] ,\quad T \left[ \begin{array}{r} -1\\0\\6 \end{array} \right] =\left[ \begin{array}{r} 2\\4\\1 \end{array} \right] \quad\text{and}\quad T \left[ \begin{array}{r} 0\\-1\\3 \end{array} \right] =\left[ \begin{array}{r} 6\\1\\-1 \end{array} \right] $$
We are also given the hint of applying Exercise 6.2.2, so we'll do just that. The exercise gives the recipe for how to run through the problem:
- collect the vectors you are hitting with $T$ together, as the columns of a single matrix: $$ A=\left[ \begin{array}{rrr} 1&-1&0\\ 1&0&-1\\ -8&6&3 \end{array} \right]; $$
- also collect together the resulting vectors (those on the right-hand sides of the equal signs in the defining equations for $T$) as the columns of another matrix: $$ B=\left[ \begin{array}{rrr} 1&2&6\\ 3&4&1\\ 1&1&-1 \end{array} \right]; $$
- and then finally, just recover the desired $T$ as $T=B\cdot A^{-1}$.
We will implement precisely this procedure in SymPy.
In [4]:
from sympy import *
init_printing(use_latex='mathjax')
In [5]:
A=Matrix([[1,-1,0],[1,0,-1],[-8,6,3]]); B=Matrix([[1,2,6],[3,4,1],[1,1,-1]])
In [6]:
A
Out[6]:
$\displaystyle \left[\begin{matrix}1 & -1 & 0\\1 & 0 & -1\\-8 & 6 & 3\end{matrix}\right]$
In [7]:
B
Out[7]:
$\displaystyle \left[\begin{matrix}1 & 2 & 6\\3 & 4 & 1\\1 & 1 & -1\end{matrix}\right]$
In [9]:
T=B*A.inv(); T
Out[9]:
$\displaystyle \left[\begin{matrix}52 & 21 & 9\\44 & 23 & 8\\5 & 4 & 1\end{matrix}\right]$
That's supposed to be our $T$. Let's check that it meets the requirements:
In [10]:
T*Matrix([[1],[1],[-8]])
Out[10]:
$\displaystyle \left[\begin{matrix}1\\3\\1\end{matrix}\right]$
In [11]:
T*Matrix([[-1],[0],[6]])
Out[11]:
$\displaystyle \left[\begin{matrix}2\\4\\1\end{matrix}\right]$
In [12]:
T*Matrix([[0],[-1],[3]])
Out[12]:
$\displaystyle \left[\begin{matrix}6\\1\\-1\end{matrix}\right]$
Looks right.
In [ ]: