\documentclass[a4paper,11pt]{article}
\usepackage{amssymb}
%\usepackage[mathcal]{euscript}

\begin{document}
Applying an affine transformation to a point gives
\[ T\left(P\right) = T\left(p_1 \vec{v}_1 + p_2 \vec{v}_2 + \cdots + p_n
\vec{v}_n + \mathcal{O_A}\right) \]

Therefore the transformed point can be written using matrix multiplication in
the new frame as
\[ T\left(P\right) = \left[p_1\quad p_2\quad \cdots\quad p_n\quad 1\right]
\left[ \begin{array}{c}
T\left(\vec{v}_1\right) \\
T\left(\vec{v}_2\right) \\
\vdots \\
T\left(\vec{v}_n\right) \\
T\left(\mathcal{O_A}\right)
\end{array} \right]
\]

However, we really want to express our transformed point directly as an updated
set of coordinates in the new frame,
\[ T\left(P\right) = \left[p_1'\quad p_2'\quad \cdots\quad p_n'\quad 1\right]
\left[ \begin{array}{c}
T\left(\vec{w}_1\right) \\
T\left(\vec{w}_2\right) \\
\vdots \\
T\left(\vec{w}_n\right) \\
T\left(\mathcal{O_B}\right)
\end{array} \right]
\]

First consider the effect of the new frame on the basis vectors. This is simply
a case of rewriting the vectors in terms of the new basis set,
\begin{eqnarray*}
T\left(\vec{v}_1\right) & = & c_{1,1} \vec{w}_1 + c_{1,2} \vec{w}_2 + \cdots c_{1,n} \vec{w}_n \\
T\left(\vec{v}_2\right) & = & c_{2,1} \vec{w}_1 + c_{2,2} \vec{w}_2 + \cdots c_{2,n} \vec{w}_n \\
\vdots & & \vdots \\
T\left(\vec{v}_n\right) & = & c_{n,1} \vec{w}_1 + c_{n,2} \vec{w}_2 + \cdots c_{n,n} \vec{w}_n \\
\end{eqnarray*}

The only transformation which can occur to the origin point is that it undergoes
a translation,
\[ T\left(\mathcal{O_A}\right) = \vec{u}_{n + 1} + \mathcal{O_B} \]

The transformation vector component can also be written in terms of the new
basis and so
\[ T\left(\mathcal{O_A}\right) = c_{n+1,1}\vec{w}_1 + c_{n+1,2}\vec{w}_2 +
\cdots + c_{n+1,n}\vec{w}_n + \mathcal{O_B} \]

Substituting, the matrix representation of the updated point is
\[ T\left(P\right) = \left[ p_1\quad p_2\quad \cdots\quad p_n\quad 1\right]
\left[
\begin{array}{c}
c_{1,1}\vec{w}_1 + c_{1,2}\vec{w}_2 + \cdots + c_{1,n}\vec{w}_n \\
c_{2,1}\vec{w}_1 + c_{2,2}\vec{w}_2 + \cdots + c_{2,n}\vec{w}_n \\
\vdots \\
c_{n,1}\vec{w}_1 + c_{n,2}\vec{w}_2 + \cdots + c_{n,n}\vec{w}_n \\
c_{n+1,1}\vec{w}_1 + c_{n+1,2}\vec{w}_2 + \cdots + c_{n+1,n}\vec{w}_n - \mathcal{O_B} \\
\end{array}
\right] \]

However, this still isn't quite in the right form because each element of the
second matrix is a sum of basis vector terms, not the basis terms individually.

The second matrix can be decomposed into the product of a matrix with the basis
for the new frame,
\[ T\left(P\right) = \left[ p_1\quad p_2\quad \cdots\quad p_n\quad 1\right]
\left[
\begin{array}{ccccc}
c_{1,1} & c_{1,2} & \cdots & c_{1,n} & 0 \\
c_{2,1} & c_{2,2} & \cdots & c_{2,n} & 0 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
c_{n,1} & c_{n,2} & \cdots & c_{n,n} & 0 \\
c_{n+1,1} & c_{n+1,2} & \cdots & c_{n+1,n} & 1 \\
\end{array}
\right]
\left[
\begin{array}{c}
\vec{w}_1 \\
\vec{w}_2 \\
\vdots \\
\vec{w}_n \\
\mathcal{O_S} \\
\end{array}
\right]
\]

Therefore, the final transformation can be decomposed into as,
\[ T\left(P\right) = \left[ p_1\quad p_2\quad \cdots\quad p_n\quad 1\right]
\mathrm{\bf{T}}
\left[
\begin{array}{c}
\vec{w}_1 \\
\vec{w}_2 \\
\vdots \\
\vec{w}_n \\
\mathcal{O_B}
\end{array}
\right]
\]
where $p_1, p_2, \ldots p_n, 1$ are the coefficients of $P$ in $\mathcal{F_A}$,
$\mathrm{\bf{T}}$ is the transformation matrix, and $\vec{w}_1, \vec{w}_2,
\ldots\vec{w}_n, \mathcal{O_B}$ are $\mathcal{F_B}$.

Expanding the transformation matrix,
\[
\mathrm{\bf{T}} = 
\left[
\begin{array}{ccccc}
c_{1,1} & c_{1,2} & \cdots & c_{1,n} & 0 \\
c_{2,1} & c_{2,2} & \cdots & c_{2,n} & 0 \\
\vdots & \vdots & \ddots & \vdots & \vdots \\
c_{n,1} & c_{n,2} & \cdots & c_{n,n} & 0 \\
c_{n+1,1} & c_{n+1,2} & \cdots & c_{n+1,n} & 1 \\
\end{array}
\right]
\]
where the first $n$ rows of $\mathrm{\bf{T}}$ are the transformed basis vectors
of $\mathcal{A}$ and the last row is the transformed origin of $\mathcal{A}$.

Therefore, \emph{all} affine transformations can be written as
\[
\mathrm{\bf{T}} = \left[
\begin{array}{cc}
\mathcal{A} & \vec{0}^T \\
\vec{a} & 1
\end{array}
\right]
\]

\end{document}
