% FILE antonLT.tex
% AR6 Chapter 7

\section{Linear Transformations}

The material of this chapter is primarily theoretical.
In practical uses of Maple 
for linear algebra one tends to work with matrices.
It is possible to use Maple for material in this chapter.
See \cite{J} \S4.1,4.2 and the help screen on
{\tt genmatrix}\index{genmatrix}.

\subsection{Introduction to Linear Transformations}

You are expected to know the main facts about functions, and in particular
linear transformations.

Similarly the geometric applications, and interpretations, of matrices and
linear transformations given in \cite{AR} 
should be familiar from your first
course in linear algebra.  
A favorite example (which arises in Computer Aided
Design) is rotations and reflections in $\DoubleR^3$. If you have graphics
capabilities on your computer terminal, you can see this for yourself using
Maple's {\tt plot3d} function:

\begin{maple}
with(linalg):
# 
> surface:= [x*sin(x)*cos(y), x*cos(x)*cos(y), x*sin(y) ]:
> domain:= x=0..Pi, y=0..Pi:
> plot3d(surface,domain);

> Q:= matrix([ [cos(Pi/4),sin(Pi/4),0], [-sin(Pi/4),cos(Pi/4),0], [0,0,1] ]):
> rotated:= convert( evalm(Q&*surface), list):   # To make it possible to plot
> plot3d(rotated,domain);

> Q:= matrix([ [-1,0,0], [0,-1,0], [0,0,1] ]):  # Rotation of Pi in the xy-plane
> rotated:= convert( evalm(Q&*surface), list):
> plot3d(rotated,domain);

> Q1:= matrix([ [1,0,0], [0,cos(Pi/3),sin(Pi/3)], [0,-sin(Pi/3),cos(Pi/3)] ]):
> Q2:= matrix([ [cos(Pi/3),0,sin(Pi/3)], [0,1,0], [-sin(Pi/3),0,cos(Pi/3)] ]):
> rotated:= convert(evalm(Q1&*Q2&*surface),list): #Rotations in xz and yz-planes
> plot3d(rotated,domain);

> Q:= matrix([ [1,0,0], [0,-1,0], [0,0,1] ]):   # Reflection through xz-plane
> reflected:= convert( evalm(Q&*surface), list):
> plot3d(reflected,domain);
\end{maple}

You are also expected to know the fact that a function
$T:\DoubleR^n\to\DoubleR^m$ is a linear transformation if and only if it is the
induced function of an $m\times n$ matrix.  This is illustrated below,
to-gether with a proof that differentiation is a linear transformation.
\begin{maple}
> with(linalg):
# Show that the induced function of  A  is a linear transformation where
> A:= matrix( [[a11,a12,a13],  
>              [a21,a22,a23]] ):
> u:= vector( [u1,u2,u3] ):                         v:= vector( [v1,v2,v3] ):
> evalm( A&*(u+v) - (A&*u+A&*v) ); 
                                    [ 0, 0 ]

> evalm( A&*(r*u) - r*A&*u ); 
                                    [ 0, 0 ]

> 
# 
# Consider a linear transformation  T  from  R^3  to  R^2
# MAPLE VERSION DEPENDENT PART 
interface(version);
# Up to  Maple Vr2
> define( linear(T) );     # This ensures that  T  is a linear transformation
# In Maple Vr3 
# define( Linear(T) );
#
# Write
\end{maple}
\goodbreak
\begin{maple}
> T([1,0,0]):= vector( [a11,a21] ):         T([0,1,0]):= vector( [a12,a22] ):
> T([0,0,1]):= vector( [a13,a23] ):
# Show that the matrix A above is the matrix induced by  T.
> evalm( T(Pi*[1,0,0]+E*[0,1,0]+gamma*[0,0,1]) - A&*vector([Pi,E,gamma]) );
                                    [ 0, 0 ]

# Pi, E and gamma must be used since define/linear only works with constants
\end{maple}
\smallskip
\begin{maple}
#
# AR6 Section 7.1 Example 12 p303; AR7 Section 8.1 Example 11 p387
# Show that differentiation is a linear transformation
> diff(f(x),x) + diff(g(x),x) - diff(f(x)+g(x),x);
                                       0

> diff(r*f(x),x) - r*diff(f(x),x);
                                       0
\end{maple}

\subsection{Kernel and Range}

In the context of matrices these were treated in Maple with
{\tt nullspace} and {\tt colspace}.

\subsection{Inverse Linear Transformations}

In the context of matrices these are treated in Maple with
{\tt inverse}.

\subsection{Matrices of Linear Transformations}
% AR6  from $\DoubleR^n$ to $\DoubleR^m$}

A key result is that, if $T:\DoubleR^n\rightarrow\DoubleR^m$ is any
linear transformation, then there is an $m\times n$ matrix $A$
such that $T$ corresponds to multiplication by $A$.
\medskip

% AR6 \subsection{Matrices of General Linear Transformations}

The concept 
of the coordinates of a vector in a vector space
$V$ says in effect that {\em any} vector space of dimension $n$ may be regarded
as $\DoubleR^n$ (after a basis has been chosen). The same argument shows that,
relative to a chosen basis for the vector spaces $V$ and $W$, every linear
transformation $T:V\to W$ may be thought of as a matrix.

\ifodd\ARed\setcounter{subsection}{4}\else\setcounter{subsection}{5}\fi
% AR6 7.6; AR7 8.5
\subsection{Similarity}

\smallskip
% AR6 7.6.1
\setcounter{theorem}{0}
\begin{theorem}\quad 
  If $B$ and $B^\prime$ are bases for a finite dimensional vector space
  $V$, and if\\
   $I:V\rightarrow V$ is the identity operator,
  then $[I]_{B,B^\prime}$ is the transition matrix from
  $B^\prime$ to $B$.
\end{theorem}
%  $B=\{\rowi{\b v}{n}\}$\quad and\quad $C=\{\rowi{\b w}{m}\}$ respectively.
%
%  Let $T:V\to W$ be a linear transformation. Then there is an $m\times n$
% matrix $[T]_{BC}$ -- whose columns are the coordinate vectors
% $[T(\b v_i)]_C$ -- such that
%   $$ [T]_{BC} [\b x]_B = [T(\b x)]_C\qquad \mbox{for all}~~\b x\in V. $$
% $[T]_{BC}$ is called {\em the matrix induced by $T$ relative to the bases $B$
% and $C$}.
%\smallskip
\vfill
\eject

\begin{maple}
# Example 1 - AR6 Section 7.6 p352; AR7 Section 8.5 p427
> with(linalg):
# Consider the linear transformation  T  from R^2 to R^2 where
> T:= proc(v) local x,y: x:=v[1]: y:=v[2]: vector([x+y,-2*x+4*y]) end:
#
# 1st part: Find the matrix of  T  relative to the (standard) basis  B  where
> e1:= vector([1,0]):      e2:= vector([0,1]):     B:= augment( e1,e2 ):
#
#    Find the coordinates of  T(e1), T(e2) 
> T_BB:= augment( linsolve(B,T(e1)), linsolve(B,T(e2)) );
                                      [  1  1 ]
                              T_BB := [       ]
                                      [ -2  4 ]


# 2nd part:     Find the matrix of  T  relative to the basis  C  where
>  v1:= vector([1,1]):    v2:= vector([1,2]):   C:= augment( v1,v2):
 T_CC:= augment( linsolve(C,T(v1)), linsolve(C,T(v2)) );
                                      [ 2  0 ]
                              T_CC := [      ]
                                      [ 0  3 ]
> P:= C: equal( evalm(P^(-1) &* T_BB &* P), T_CC );
                                      true
\end{maple}
This exemplifies

% AR6 7.6.2
\begin{theorem} 
Let $T:V\to V$ be a linear operator on a finite dimensional vector
space $V$ and let $B$ and $B^\prime$ be bases for $V$. Then
    $$ [T]_{B^\prime} = P^{-1} [T]_{B} P $$
  where $P$ is the transition matrix from $B^\prime$ to $B$.
\end{theorem}
\smallskip

\headq{Warning.} $P$ is the transition matrix from 
  $B^\prime$ to $B$ --  not the
  transition matrix from $B$ to $B^\prime$. 
  This is because function composition is
  from right to left, and not from left to right.

\medskip
%\headq{Definition.} 
Recall, from before, the definition:
Two $n\times n$ matrices $A$ and $B$ are {\it similar}
if there is an invertible $n\times n$ matrix $P$ such that $B = P^{-1} A P$.

\smallskip
\headq{EXERCISE.} (Not Maple.)
Let $A$, $B$, $C$ be three $n\times n$ matrices. Show that
\begin{enumerate}\item[]
  \begin{enumerate}
  \item $A$ is similar to $A$;
  \item If $A$ is similar to $B$, then $B$ is similar to $A$;
  \item If $A$ is similar to $B$, and $B$ is similar to $C$,
    then $A$ is similar to $C$.
  \end{enumerate}
\end{enumerate}
\smallskip

%\begin{theorem}  
%\headq{THEOREM }
\theoremNN{\it
Two $n\times n$ matrices are similar if and only if they
  represent the same linear transformation on an $n$-dimensional vector space
  (possibly relative to different bases).
} %\end{theorem}
\theoremNNEnd

\vfill
\eject
