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

\chapter{The Change of Coordinate Matrix}%
\label{cha:the_change_of_coordinate_matrix}

In this lecture, we study how a coordinate vector relative to one basis can be changed into a coordinate vector relative to the other.
\begin{exmp}
	Consider the equation
	\[
	2x^2-4xy+5y^2=1
	.\]
	It is hard to see what curve this equation represents.
	If we make the following changes of variables:
	\begin{align*}
		x & = \frac{2}{\sqrt{5}}x^{\prime}-\frac{1}{\sqrt{5}}y^{\prime}\\
		y & = \frac{1}{\sqrt{5}}x^{\prime}+\frac{2}{\sqrt{5}}y^{\prime}
	\end{align*}
	then we obtain the equation:
	\[
		(x^{\prime})^2 + 6(y^{\prime})^2 = 1
	,\]
	which is the equation of an ellipse.
	In this case, the coordinates of a point relative to the unit vectors of the standard ordered basis
	\[
	\beta = \left\{
		e_1 = 
		\begin{bmatrix}
			1\\
			0\\
		\end{bmatrix}
		,
		e_2 = 
		\begin{bmatrix}
			0\\
			1\\
		\end{bmatrix}
	\right\}
	\]
	is changed to new coordinates of the same point, but relative to the unit vectors of the new ordered basis:
	\[
	\beta^{\prime}= \left\{
		\frac{1}{\sqrt{5}}
		\begin{bmatrix}
			2\\
			1\\
		\end{bmatrix}
		,
		\frac{1}{\sqrt{5}}
		\begin{bmatrix}
			-1\\
			2\\
		\end{bmatrix}
	\right\}
	.\]
	Notice that the equations of the change of variables shown above can be represented in the form of a matrix equation:
	\[
	\begin{bmatrix}
		x\\
		y\\
	\end{bmatrix}
	=
	\frac{1}{\sqrt{5}}
	\begin{bmatrix}
		2 & -1\\
		1 & 2\\
	\end{bmatrix}
	\begin{bmatrix}
		x^{\prime}\\
		y^{\prime}\\
	\end{bmatrix}
	.\]
	Notice also that the matrix:
	\[
	Q = \frac{1}{\sqrt{5}}
	\begin{bmatrix}
		2 & -1\\
		1 & 2\\
	\end{bmatrix}
	\]
	is equal to $[I]^{\beta}_{\beta^{\prime}}$, where $I$ is the identity transformation of $\mathbb{R}^2$.
	This phenomenon is true in general.
\end{exmp}

\begin{thrm}
	Let $\mathsf{V}$ be a finite dimensional vector space with the ordered bases $\beta$ and $\beta^{\prime}$.
	Also let $Q=[I_{\mathsf{V}}]^{\beta}_{\beta^{\prime}}$.
	Then $Q$ is invertible, and for any $v\in\mathsf{V}$:
	\[
	[v]_{\beta} = Q[v]_{\beta^{\prime}} = [I_{\mathsf{V}}]^{\beta}_{\beta^{\prime}}[v]_{\beta^{\prime}}
	.\]
\end{thrm}
There is a mathematical name assigned to the matrix $Q$.
\begin{definition}
	Change of Coordinate Matrix.
	For a given finite vector space $\mathsf{V}$, that has ordered bases $\beta$ and $\beta^{\prime}$, the matrix
	\[
	Q=[I_{\mathsf{V}}]^{\beta}_{\beta^{\prime}}
	,\]
	is called a \textbf{change of coordinate matrix}, which changes $\beta^{\prime}$-coordinates into $\beta$-coordinates.
\end{definition}
\begin{exmp}
	\label{above}
	Let the vector space in question be $\mathbb{R}^2$, with $\beta=\left\{(1,1),(1,-1)\right\}$ and $\beta^{\prime}=\left\{(2,4),(3,1)\right\}$.
	Find the matrix that changes $\beta^{\prime}$-coordinates into $\beta$-coordinates.
	\begin{sol}
		By definition, $Q=[I_{\mathsf{V}}]^{\beta}_{\beta^{\prime}}$, so we have to represent $I_{\mathsf{V}}$ at $\beta^{\prime}$ in terms of $\beta$:
		\[
		I_{\mathsf{V}}
		\begin{bmatrix}
			2\\
			4\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			2\\
			4\\
		\end{bmatrix}
		= 3
		\begin{bmatrix}
			1\\
			1\\
		\end{bmatrix}
		-1
		\begin{bmatrix}
			1\\
			-1\\
		\end{bmatrix}
		\]
		and
		\[
		I_{\mathsf{V}}
		\begin{bmatrix}
			3\\
			1\\
		\end{bmatrix}
		=
		\begin{bmatrix}
			3\\
			1\\
		\end{bmatrix}
		= 2
		\begin{bmatrix}
			1\\
			1\\
		\end{bmatrix}
		+1
		\begin{bmatrix}
			1\\
			-1\\
		\end{bmatrix}
		.\]
		Hence
		\[
		Q=
		\begin{bmatrix}
			3 & 2\\
			-1 & 1\\
		\end{bmatrix}
		.\]
	\end{sol}
\end{exmp}
\begin{thrm}
	Let $\mathsf{T}$ be a linear operator on a finite-dimensional vector space $\mathsf{V}$.
	Also let $\beta$ and $\beta^{\prime}$ be ordered bases for $\mathsf{V}$, where $Q$ is the change of coordinate matrix that changes $\beta^{\prime}$ into $\beta$.
	Then:
	\[
	[\mathsf{T}]_{\beta^{\prime}} = Q^{-1}[\mathsf{T}]_{\beta}Q
	.\]
\end{thrm}
\begin{proof}
	Let $I:=I_{\mathsf{V}}$ be the identity transformation on $\mathsf{V}$.
	Then $\mathsf{T}=I\circ\mathsf{T}=\mathsf{T}\circ I$.
	Hence,
	\[
	Q[\mathsf{T}]_{\beta^{\prime}}=[I]^{\beta}_{\beta^{\prime}}[\mathsf{T}]^{\beta^{\prime}}_{\beta^{\prime}}
	=
	[I\circ\mathsf{T}]^{\beta}_{\beta^{\prime}}
	=
	[\mathsf{T}\circ I]^{\beta}_{\beta^{\prime}}
	= [\mathsf{T}]^{\beta}_{\beta}[I]^{\beta}_{\beta^{\prime}} = [\mathsf{T}]_{\beta}Q
	.\]
	Therefore, $[\mathsf{T}]_{\beta^{\prime}}=Q^{-1}[\mathsf{T}]_{\beta}Q$.
\end{proof}
\begin{exmp}
	Let $\mathsf{T}$ be the following linear operator on $\mathbb{R}^2$:
	\[
	\mathsf{T}
	\begin{bmatrix}
		a\\
		b\\
	\end{bmatrix}
	=
	\begin{bmatrix}
		3a-b\\
		a-3b\\
	\end{bmatrix}
	.\]
	Also, let $\beta=\left\{(1,1),(1,-1)\right\}$ and $\beta^{\prime}=\left\{(2,4),(3,1)\right\}$ as in example \ref{above}.
	Find $[\mathsf{T}]_{\beta}$, as well as the matrix $Q$ that changes $\beta^{\prime}$-coordinates into $\beta$-coordinates, and $[\mathsf{T}]_{\beta^{\prime}}$, using the theorem above.
	\begin{sol}
		We have:
		\[
		[\mathsf{T}]_{\beta} =
		\left[
		\left(
		\mathsf{T}
		\begin{bmatrix}
			1\\
			1\\
		\end{bmatrix}
		\right)_{\beta},
		\left(
		\mathsf{T}
		\begin{bmatrix}
			1\\
			-1\\
		\end{bmatrix}
		\right)_{\beta}
		\right]
		=
		\begin{bmatrix}
			3 & 1\\
			-1 & 3\\
		\end{bmatrix}
		.\]
		By example \ref{above}, we know what $Q$ is, so we find its inverse:
		\[
		Q =
		\begin{bmatrix}
			3 & 2\\
			-1 & 1\\
		\end{bmatrix}
		\implies
		Q^{-1}= \frac{1}{5}
		\begin{bmatrix}
			1 & -2\\
			1 & 3\\
		\end{bmatrix}
		.\]
		Hence,
		\begin{align*}
			[\mathsf{T}]_{\beta^{\prime}} & = Q^{-1}[\mathsf{T}]_{\beta}Q\\
						      & = \frac{1}{5}
							\begin{bmatrix}
								1 & -2\\
								1 & 3\\
							\end{bmatrix}
							\begin{bmatrix}
								3 & 1\\
								-1 & 3\\
							\end{bmatrix}
							\begin{bmatrix}
								3 & 2\\
								-1 & 1\\
							\end{bmatrix}
							\\
						      & =
						      	\begin{bmatrix}
								4 & 1\\
								-2 & 2\\
						      	\end{bmatrix}
		\end{align*}
	\end{sol}
\end{exmp}
We have the following result that follows from the theorem.
\begin{corollary}
	Let $A\in\mathsf{M}_{n\times n}(F)$ and let $\gamma$ be an ordered basis for $F^{n}$.
	Then
	\[
	[\mathsf{L}_{A}]_{\gamma}=Q^{-1}AQ
	,\]
	where $Q$ is the $n\times n$ matrix whose $j$-th column is the $j$-th vector of $\gamma$.
\end{corollary}
\begin{proof}
	This is a special case of the theorem, where $\mathsf{T}=\mathsf{L}_{A}$, the left-multiplication operator on $F^{n}$.
	Indeed, in the conclusion of the theorem
	\[
	[\mathsf{T}]_{\beta^{\prime}}=Q^{-1}[\mathsf{T}]_{\beta}Q
	,\]
	we take, for our case, $\gamma$ instead of $\beta^{\prime}$, where $\beta$ is the \textbf{standard} ordered basis for $F^{n}$, and we use $\mathsf{L}_{A}$ instead of $\mathsf{T}$.
	Then we get
	\[
	[\mathsf{L}_{A}]_\gamma = Q^{-1}[\mathsf{L}_A]_\beta Q
	.\]
	Since $\beta$ is the \textbf{standard} ordered basis for $F^{n}$, we have $[\mathsf{L}_{A}]_\beta=A$ and $Q=[I]^{\beta}_\gamma$, which is precisely the $n\times n$ matrix whose $j$-th column is the $j$-th vector of $\gamma$.
\end{proof}
\begin{exmp}
	Let
	\[
	A =
	\begin{bmatrix}
		2 & 1 & 0\\
		1 & 1 & 3\\
		0 & -1 & 0\\
	\end{bmatrix}
	,\]
	and
	\[
	\gamma = \left\{
		\begin{bmatrix}
			-1\\
			0\\
			0\\
		\end{bmatrix}
		,
		\begin{bmatrix}
			2\\
			1\\
			0\\
		\end{bmatrix}
		,
		\begin{bmatrix}
			1\\
			1\\
			1\\
		\end{bmatrix}
	\right\},\ \text{an ordered basis for $\mathbb{R}^3$}
	.\]
	Using the corollary, find $[\mathsf{L}_A]_\gamma$.
	\begin{sol}
		Let $Q$ be then $3\times 3$ matrix whose $j$-th column is the $j$-th vector of $\gamma$.
		Then
		\[
		Q =
		\begin{bmatrix}
			-1 & 2 & 1\\
			0 & 1 & 1\\
			0 & 0 & 1\\
		\end{bmatrix}
		\qquad
		Q^{-1} =
		\begin{bmatrix}
			-1 & 2 & 1\\
			0 & 1 & 1\\
			0 & 0 & 1\\
		\end{bmatrix}
		.\]
		Therefore,
		\begin{align*}
			[\mathsf{L}_{A}]_{\gamma} & = Q^{-1}AQ\\
						  & =
							\begin{bmatrix}
								-1 & 2 & 1\\
								0 & 1 & 1\\
								0 & 0 & 1\\
							\end{bmatrix}
							\begin{bmatrix}
								2 & 1 & 0\\
								1 & 1 & 3\\
								0 & -1 & 0\\
							\end{bmatrix}
							\begin{bmatrix}
								-1 & 2 & 1\\
								0 & 1 & 1\\
								0 & 0 & 1\\
							\end{bmatrix}
							\\
						  & =
						  	\begin{bmatrix}
								0 & 2 & 8\\
						  		-1 & 4 & 6\\
						  		0 & -1 & -1\\
						  	\end{bmatrix}.
		\end{align*}
	\end{sol}
\end{exmp}

We define the relationship between the matrices $[\mathsf{T}]_{\beta}$ and $[\mathsf{T}]_{\beta^{\prime}}$.
\begin{definition}
	Similarity.
	Let $A,B\in\mathsf{M}_{n\times n}(F)$.
	We say that $B$ is \textbf{similar} to $A$ if there exists an \textit{invertible} matrix $Q$ such that
	\[
	B = Q^{-1}AQ
	,\]
	denoted as $B\sim A$.
\end{definition}
