[Math] How to find a transformation matrix, given coordinates of two triangles in $R^2$

linear algebramatrices

I am an undergraduate student, and today I was given two triangles, $T_1$ (green) and $T_2$ (blue) in $R^2$:

enter image description here

I was then asked to find the transformation matrix transforming $T_1$ to $T_2$.
What I understand from this is, that I need to find $F$ in the following matrix equation:

$T_2 = F \cdot T_1$.

where

$T_1= \begin{bmatrix}2&6&8\\2&-2&6\end{bmatrix}$

$T_2= \begin{bmatrix}-2&-10&-14\\-2&-4&10\end{bmatrix}$

which are the coordinates of the corners of the triangles.

The above matrix equation however, is inconsistent, so how can I find $F$?

It has to be a linear mapping, not an affine one.

Have tried a lot, any help greatly appreciated!

Best Answer

Organize each of the points of the starting triangle as columns in a matrix $\mathbf{U}$, and each of the points of the resulting triangle as columns in a matrix $\mathbf{V}$. Thus, both $\mathbf{U}$ and $\mathbf{V}$ are $3\times3$ matrices because you have 3 vertices, each vertex having 3 coordinates. I am assuming the triangles are contained in $\mathbb{R}^3$ space.

If your triangles are in $\mathbb{R}^2$ (as is your case, since they are in the plane), you should use "0 0 1" as the last row for each of the $\mathbf{U}$ and $\mathbf{V}$ matrices so that they are not singular.

Now, assume there is a matrix $\mathbf{T}$ such that $\mathbf{T}\mathbf{U}=\mathbf{V}$. All you need to do is to isolate $\mathbf{T}$:

$$ \mathbf{T}\mathbf{U}\mathbf{U}^{-1}=\mathbf{V}\mathbf{U}^{-1}\\ \mathbf{T}=\mathbf{V}\mathbf{U}^{-1} $$

And you can transform any point now using $\mathbf{T}$, including each of the three vertices of the starting triangle. Say you have a point $p=[x\ y\ z]^T$ in the starting triangle frame of reference (given by the $\mathbf{U}$ matrix), then you get a point $p^\prime=[x^\prime\ y^\prime\ z^\prime]^T$ in the resulting triangle frame of reference (given by the $\mathbf{V}$ matrix):

$$ \mathbf{T}p=\mathbf{V}\mathbf{U}^{-1}p=p^\prime $$

If your triangles were in the plane, you just ignore the trasformed z coordinate, $z^\prime$.

Using the vertices of the triangles as columns in $\mathbf{U}$ and $\mathbf{V}$ is just a convenient way of writing the problem in matrix form.