% This is lecture no. 5 of MH1201/: Linear Algebra II.

\chapter[Notation, Null Space, \& Range]{Linear Transformation Notation, Null Space, \& Range}%
\label{cha:linear_transformation_notation_null_space_&_range}

\section{Basic Notation}%
\label{sec:basic_notation}

If $\mathsf{V}$ and $\mathsf{W}$ are vector spaces, the mapping $\mathsf{T}$ from $\mathsf{V}$ to $\mathsf{W}$ is a function that assigns to each vector $v\in \mathsf{V}$ a unique vector $w\in \mathsf{W}$.
In this case we say that $\mathsf{T}$ maps $\mathsf{V}$ into $\mathsf{W}$, and write:
\[
\mathsf{T}:\mathsf{V}\mapsto \mathsf{W}
.\]
For each $v\in \mathsf{V}$ the vector $w=\mathsf{T}(v)\in \mathsf{W}$ is the image of $v$ under $\mathsf{T}$.
\begin{definition}
	Linear Transformation.
	Consider the vector spaces $\mathsf{V}$ and $\mathsf{W}$ over a field  $F$.
	Then $\mathsf{T}:\mathsf{V}\mapsto \mathsf{W}$ is a \textbf{linear transformation} if $\forall u,v\in \mathsf{V}$, $\forall\lambda\in F$ the following conditions hold:
	\begin{align*}
		\mathsf{T}(u+v)&=\mathsf{T}(u)+\mathsf{T}(v)\\
		\mathsf{T}(\lambda u)&=\lambda \mathsf{T}(u),
	\end{align*}
	or:
	\[
		\mathsf{T}(\lambda u+\mu v)=\lambda \mathsf{T}(u)+\mu \mathsf{T}(v), \forall u,v\in \mathsf{V},\ \forall\lambda,\mu\in F
	.\]
\end{definition}
\begin{exmp}
	Determine if the transformation $\mathsf{T}:\mathbb{R}^2\mapsto\mathbb{R}^2$ defined by:
	\[
		\mathsf{T}(a_1,a_2)=(a_1+a_2,-a_1)
	.\]
	is linear.
	\begin{sol}
		Writing the vectors in column form:
		\[
		\mathsf{T}
		\begin{bmatrix}
			a_1\\
			a_2\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			a_1+a_2\\
			-a_1\\
		\end{bmatrix}
		.\]
		Consider the arbitrary vectors:
		\[
		u=
		\begin{bmatrix}
			a_1\\
			a_2\\
		\end{bmatrix}
		,\ 
		v=
		\begin{bmatrix}
			b_1\\
			b_2\\
		\end{bmatrix}
		\in\mathbb{R}^2
		,\]
		and scalars $\lambda,\mu\in\mathbb{R}$.
		We must verify the condition for linearity.
		For the left hand side we have:
		\begin{align*}
			\mathsf{T}(\lambda u+\mu v)
			&=\mathsf{T}
			\left(
			\begin{bmatrix}
				\lambda a_1\\
				\lambda a_2\\
			\end{bmatrix}
			+
			\begin{bmatrix}
				\mu b_1\\
				\mu b_2\\
			\end{bmatrix}
			\right)\\
			&=\mathsf{T}
			\begin{bmatrix}
				\lambda a_1+\mu b_1\\
				\lambda a_2+\mu b_2\\
			\end{bmatrix}
			\\
			&=
			\begin{bmatrix}
				(\lambda a_1+\mu b_1)+(\lambda a_2+\mu b_2)\\
				-(\lambda a_1+\mu b_1)\\
			\end{bmatrix}
		\end{align*}
		For the right hand side we have:
		\begin{align*}
			\lambda \mathsf{T}(u)+\mu \mathsf{T}(v)
			&=
			\lambda
			\begin{bmatrix}
				a_1+a_2\\
				-a_1\\
			\end{bmatrix}
			+\mu
			\begin{bmatrix}
				b_1+b_2\\
				-b_1\\
			\end{bmatrix}
			\\
			&=
			\begin{bmatrix}
				(\lambda a_1+\mu b_1)+(\lambda a_2+\mu b_2)\\
				-(\lambda a_1+\mu b_1)\\
			\end{bmatrix}
		\end{align*}
		The left hand side and the right hand side are equal and therefore $\mathsf{T}$ is a linear transformation.
	\end{sol}
\end{exmp}
\begin{exmp}
	Determine if the transformation $\mathsf{T}:\mathsf{M}_{2\times 2}(\mathbb{R})\mapsto\mathbb{R}$ defined by:
	\[
		\mathsf{T}(A)=\det(A)
	.\]
	or otherwise written:
	\[
	\mathsf{T}
	\begin{bmatrix}
		a_1&a_2\\
		a_3&a_4\\
	\end{bmatrix}
	=a_1a_4-a_2a_3
	.\]
	is linear.
	\begin{sol}
		In this case it is sufficient to show that either of the two conditions for linearity are not satisfied.
		Looking at the condition regarding scalar multiplication:
		\begin{align*}
			\mathsf{T}(\lambda A)&=\lambda a_1\lambda a_4-\lambda a_2\lambda a_3\\
				    &=\lambda^2\det(A)
		\end{align*}
		and on the other hand we have:
		\[
			\lambda \mathsf{T}(A)=\lambda\det(A)
		.\]
		Both sides of the equation are not equivalent, and therefore the transformation is not linear.
	\end{sol}
\end{exmp}
\begin{thrm}
	Let $\mathsf{T}:\mathsf{V}\mapsto \mathsf{W}$ be a linear transformation.
	The following properties hold as a consequence:
	\begin{enumerate}
		\item $\mathsf{T}(0)=0,\text{ or }\mathsf{T}(0_v)=0_w$
		\item $\mathsf{T}(\lambda u+v)=\lambda \mathsf{T}(u)+\mathsf{T}(v),\ \forall u,v\in \mathsf{V},\ \forall\lambda\in F$
		\item $\mathsf{T}(u-v)=\mathsf{T}(u)-\mathsf{T}(v),\ \forall u,v\in \mathsf{V}$
		\item $\forall u_1,u_2,\dotsc,u_n\in \mathsf{V},\ \forall\lambda_1,\lambda_2,\dotsc,\lambda_n\in F$:
			\[
				\mathsf{T}\left(\sum_{i=1}^{n}\lambda_iu_i\right)=\sum^{n}_{i=1}\lambda_i\mathsf{T}(u_i)
			.\]
	\end{enumerate}
\end{thrm}
\begin{note}
	The second property combines the two requirements for the linearity of $\mathsf{T}$ into one statement, and is generally used to prove that a transformation is linear.
\end{note}
We can use linear transformations to describe some familiar concepts.
Differentiation can be described as $\mathsf{T}:P_n(\mathbb{R})\mapsto P_{n-1}(\mathbb{R})$:
\[
	\mathsf{T}(f(x))=f^{\prime}(x),\ \forall f\in P_{n}(\mathbb{R})
.\]
\begin{proof}
	Let $g(x),h(x)\in P_{n}(\mathbb{R})$ and $\lambda\in\mathbb{R}$.
	Consider:
	\begin{align*}
		\mathsf{T}(\lambda g(x)+h(x))&=(\lambda g(x)+h(x))^{\prime}\\
				    &=\lambda g^{\prime}(x)+h^{\prime}(x)\\
				    &=\lambda \mathsf{T}(g(x))+\mathsf{T}(h(x))
	\end{align*}
	And therefore $\mathsf{T}$ is a linear transformation.
\end{proof}
\section{Null Space \& Range}%
\label{sec:null_space_&_range}

There are two basic and important transformations that appear frequently called the \textbf{identity} and \textbf{zero} transformations.
\begin{definition}
	Identity \& Zero transformation.
	The \textbf{identity} transformation $I_{\mathsf{V}}:\mathsf{V}\mapsto \mathsf{V}$ is defined by:
	\[
		I_{\mathsf{V}}(u)=u,\ \forall u\in \mathsf{V}
	.\]
	The \textbf{zero} transformation $\mathsf{T}_{0}:\mathsf{V}\mapsto \mathsf{W}$ is defined by:
	\[
		\mathsf{T}_{0}(u)=0,\ \forall u\in \mathsf{V}
	.\]
	They are both linear transformations.
\end{definition}
There are also two important sets associated with linear transformations.
They are called the \textbf{null space} and \textbf{range}.
\begin{definition}
	Null Space (Kernel) \& Range (Image).
	Consider a linear transformation $\mathsf{T}:\mathsf{V}\mapsto \mathsf{W}$.
	$N(\mathsf{T})$ the \textbf{null space} (or \textbf{kernel}) of $\mathsf{T}$ is defined as:
	\[
		N(\mathsf{T})=\{v\in \mathsf{V}:\mathsf{T}(v)=0\}
	.\]
	And $R(\mathsf{T})$ the \textbf{range} (or \textbf{image}) of $\mathsf{T}$ is defined as:
	\[
		R(\mathsf{T})=\{\mathsf{T}(v):v\in \mathsf{V}\}
	.\]
	Thus the null space is the set of all vectors in $\mathsf{V}$ that are mapped to the zero vector, while the range is the set of all images in $\mathsf{W}$ of the mapping.
\end{definition}
\begin{exmp}
	For the identity transformation $I_{\mathsf{V}}:\mathsf{V}\mapsto \mathsf{V}$:
	\begin{align*}
		N(I_{\mathsf{V}})&=\{0\}\\
		R(I_{\mathsf{V}})&=\mathsf{V}
	\end{align*}
	For the zero transformation $\mathsf{T}_0:\mathsf{V}\mapsto \mathsf{W}$:
	\begin{align*}
		N(\mathsf{T}_0)&=\mathsf{V}\\
		R(\mathsf{T}_0)&=\{0\}
	\end{align*}
\end{exmp}
\begin{exmp}
	Find the null space and range of the transformation $\mathsf{T}:\mathbb{R}^3\mapsto\mathbb{R}^2$ defined by:
	\[
		\mathsf{T}(a_1,a_2,a_3)=(a_1-a_2,2a_3)
	.\]
	\begin{sol}
		For $N(\mathsf{T})$ we have:
		\[
		\mathsf{T}
		\begin{bmatrix}
			a_1\\
			a_2\\
			a_3\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			a_1-a_2\\
			2a_3\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			0\\
			0\\
		\end{bmatrix}
		.\]
		Which implies the following:
		\begin{align*}
			a_1&=a_2\\
			a_3&=0
		\end{align*}
		and so we can describe the null space as such:
		\[
			N(\mathsf{T})=\{(a,a,0):a\in\mathbb{R}\}
		.\]
	\end{sol}
	As $R(\mathsf{T})\subseteq\mathbb{R}^2$, it suffices to prove that $\mathbb{R}^2\subseteq R(\mathsf{T})$.
	So we must prove that for any $v=(b_1,b_2)\in\mathbb{R}^2$ there exists $w=(a_1,a_2,a_3)\in\mathbb{R}^3$ such that $\mathsf{T}(w)=v$:
	\[
		\mathsf{T}
		\begin{bmatrix}
			a_1\\
			a_2\\
			a_3\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			a_1-a_2\\
			2a_3\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			b_1\\
			b_2\\
		\end{bmatrix}
	.\]
	Which implies that:
	\begin{align*}
		a_1-a_2&=b_1\\
		2a_3&=b_2
	\end{align*}
	Which is a set of linear equations that have infinitely many solutions, one of which is $a_1=b_1,\ a_2=0,\ a_3=\frac{b_2}{2}$ and hence $R(\mathsf{T})=\mathbb{R}^2$
\end{exmp}

We see that in the examples above, the null space and range of each of the linear transformations are a subspace.
This leads to the next theorem.
\begin{thrm}
	Let $\mathsf{T}$ be a linear transformation that maps the vector space $\mathsf{V}$ to the vector space $\mathsf{W}$:
	\[
	\mathsf{T}: \mathsf{V}\mapsto \mathsf{W}
	.\]
	Then, the null space $N(\mathsf{T})$ and $R(\mathsf{T})$ are subspaces of $\mathsf{V}$ and $\mathsf{W}$ respectively.
\end{thrm}
\begin{proof}
	Null Space of a Linear Transformation is a Subspace.
	For a set of vectors to be a subspace, we must check the three axioms are satisfied:

	\noindent
	\underline{Axiom 1.} $N(\mathsf{T})$ is non-empty:
	Since $\mathsf{T}(0_{\mathsf{V}})=0_{\mathsf{W}},0_{\mathsf{V}}\in N(\mathsf{T})$.

	\noindent
	\underline{Axiom 2.} $N(\mathsf{T})$ is closed under vector addition:
	We see that $\forall u,v \in N(\mathsf{T})$ we have:
	\begin{align*}
		\mathsf{T}(u + v) & = \mathsf{T}(u) + \mathsf{T}(v)\\
			 & = 0_{\mathsf{W}} + 0_{\mathsf{W}}\\
			 & = 0_{\mathsf{W}}\\
			 \therefore (u+v) & \in N(\mathsf{T})\quad \forall u,v\in N(\mathsf{T}).
	\end{align*}

	\noindent
	\underline{Axiom 3.} $N(\mathsf{T})$ is closed under scalar multiplication:
	We see that $\forall u\in N(\mathsf{T})$ and $\forall \lambda \in F$ we have:
	\begin{align*}
		\mathsf{T}(\lambda u) & = \lambda \mathsf{T}(u)\\
			     & = \lambda\cdot 0_{\mathsf{W}}\\
			     & = 0_{\mathsf{W}}\\
		\therefore \lambda u & \in N(\mathsf{T})\quad \forall u\in N(\mathsf{T}),\ \lambda\in F
	\end{align*}
	The above method can be applied to prove that the range is also a subspace.
\end{proof}
For a given linear transformation, we can find $N(\mathsf{T})$ by simply solving the equation:
\[
	\mathsf{T}(v) = 0
.\]
Where the set of all solutions is precisely $N(\mathsf{T})$, which in practice reduces to solving a linear system of equations.
To find $R(\mathsf{T})$, we can find the basis for the range we can apply the transformation to the basis.
\begin{thrm}
	Let $\mathsf{T}$ be a linear transformation:
	\[
	\mathsf{T}: \mathsf{V}\mapsto \mathsf{W}
	.\]
	And let $\beta$ be a basis for $\mathsf{V}$:
	\[
		\beta = \{v_1,v_2,\dotsc,v_n\}
	.\]
	Then:
	\[
		R(\mathsf{T}) = \text{span}(\mathsf{T}(\beta))
	.\]
\end{thrm}
\begin{proof}
	Basis for Range is the Linear Transformation of Basis Vectors.
	First we prove that $R(\mathsf{T})\subseteq \text{span}(\mathsf{T}(\beta))$.
	Take an arbitrary vector $w\in R(\mathsf{T})$.
	The fact that $w\in R(\mathsf{T})$ implies that there is $v\in \mathsf{V}$ with $w=\mathsf{T}(v)$.
	Since $\beta$ is a basis for $\mathsf{V}$, we can represent $v$ in terms of vectors in $\beta$:
	\[
		v = \sum_{i=1}^{n} \lambda_i v_i,\qquad \lambda_i \in F\ (1\leqslant i\leqslant n)
	.\]
	Hence, by the linearity of $\mathsf{T}$:
	\[
		w = \mathsf{T}(v) = \mathsf{T}\left(\sum_{i=1}^{n} \lambda_i v_i\right) = \sum_{i=1}^{n} \lambda_i \mathsf{T}(v_i) \in \text{span}(\mathsf{T}(\beta))
	.\]
	So $R(\mathsf{T})\subseteq \text{span}(\mathsf{T}(\beta))$.

	Next we prove $\text{span}(\mathsf{T}(\beta))\subseteq R(\mathsf{T})$.
	Take an arbitrary vector $w\in \text{span}(\mathsf{T}(\beta))$.
	Then there exists scalars $\lambda_1,\lambda_2,\dotsc,\lambda_n \in F$ such that:
	\begin{align*}
		w & = \lambda_1\mathsf{T}(v_1) + \lambda_2\mathsf{T}(v_2) + \dotsb + \lambda_n \mathsf{T}(v_n)\\
		  & = \mathsf{T}(\lambda_1v_1 + \lambda_2v_2 + \dotsb + \lambda_nv_n)
	\end{align*}
	Therefore, w is the image under $\mathsf{T}$ of a linear combination of vectors in $\mathsf{V}$.
	This shows that $w\in R(\mathsf{T})$, and $\therefore \text{span}(\mathsf{T}(\beta))\subseteq R(\mathsf{T})$.
\end{proof}
\begin{exmp}
	The linear transformation $\mathsf{T}:P_2(\mathbb{R})\mapsto \mathsf{M}_{2\times 2}(\mathbb{R})$ is defined by:
	\[
		\mathsf{\mathsf{T}}(f(x)) =
		\begin{bmatrix}
			f(1)-f(2) & 0\\
			0 & f(0)\\
		\end{bmatrix}
	.\]
	Find a basis for $R(\mathsf{T})$ and $\mdim(R(\mathsf{T}))$.
	\begin{sol}
		Since $\beta=\left\{1,x,x^2\right\}$ is a basis for $P_2(\mathbb{R})$, we have:
		\begin{align*}
			R(\mathsf{T}) & = \mspan(\mathsf{T}(\beta))\\
			     & = \mspan\left(\left\{\mathsf{T}(1),\mathsf{T}(x),\mathsf{T}\left(x^2\right)\right\}\right)\\
			     & = \mspan\left(\left\{
				     \begin{bmatrix}
					     0 & 0\\
					     0 & 1\\
				     \end{bmatrix}
				     ,
				     \begin{bmatrix}
					     -1 & 0\\
					     0 & 0\\
				     \end{bmatrix}
				     ,
				     \begin{bmatrix}
					     -3 & 0\\
					     0 & 0\\
				     \end{bmatrix}
			     \right\}\right)
		\end{align*}
		Notice that $\ds{\begin{bmatrix} -1 & 0\\ 0 & 0\\ \end{bmatrix}}$,  $\ds{ \begin{bmatrix} -3 & 0\\ 0 & 0\\ \end{bmatrix}}$ are linearly dependent.
		Then:
		\begin{align*}
			R(\mathsf{T}) & = \mspan
			\left(\left\{
				\begin{bmatrix}
					0 & 0\\
					0 & 1\\
				\end{bmatrix}
				,
				\begin{bmatrix}
					-1 & 0\\
					0 & 0\\
				\end{bmatrix}
				,
				\begin{bmatrix}
					-3 & 0\\
					0 & 0\\
				\end{bmatrix}
			\right\}\right)\\
			     & = \mspan
			\left(\left\{
				\begin{bmatrix}
					0 & 0\\
					0 & 1\\
				\end{bmatrix}
				,
				\begin{bmatrix}
					-1 & 0\\
					0 & 0\\
				\end{bmatrix}
			\right\}\right)
		\end{align*}
		Since the two vectors in the resultant set are linearly independent, we can conclude that it is a basis for $R(\mathsf{T})$, and so $\mdim(R(\mathsf{T}))=2$.
	\end{sol}
\end{exmp}
