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$.


$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!

  • 1
    $\begingroup$ Say your plane is $z=1$. What does this do to your matrices? $\endgroup$ – shade4159 Nov 9 '13 at 1:15
  • $\begingroup$ Well, then I add a row no. 3 to each of the matrices, filled with 1 (ones). Then I get F = T2.T1^-1 = [ [-2, 0 2], [1, 3/2, -7], [0, 0, 1] ]. But how can I generalize this to work in any plane? $\endgroup$ – Troels Folke Nov 9 '13 at 1:29
  • $\begingroup$ As long as you are in $\Bbb R^2$, which plane you use should be irrelevant. But you might want to try Gauss-Jordan Elimination. $\endgroup$ – shade4159 Nov 9 '13 at 1:38
  • $\begingroup$ Yes, when z=1, I can use Gauss-Jordan elimination to find the inverse of T1, and multiply that with T2 to get F. But that F will only work for triangles where z=1. If z=0, T1 becomes singular, and I cannot find an inverse of it. $\endgroup$ – Troels Folke Nov 9 '13 at 1:47
  • $\begingroup$ My mistake, any plane but $z=0$. $\endgroup$ – shade4159 Nov 9 '13 at 1:49

The vertices of $T_1$ are $(2,2)$, $(6,-2)$, and $(8,6)$. The vertices of $T_2$ are $(-2,-2)$, $(-10,-4)$, and $(-14,10)$. We want a transformation mapping $T_1$ to $T_2$. So the vertices of $T_1$ must map to the vertices of $T_2$. Let's factor out the 2 to save us some trouble. We seek a linear transformation $L:\mathbb{R}^2 \to \mathbb{R}^2$ with $$\{(1,1), (3,-1), (4,3)\} \mapsto \{(-1,-1), (-5,-2), (-7,5)\} $$ The map $L$ is determined by its action on the two linearly independent vectors $(1,1)$ and $(4,3)$. It must map them to two of the vectors in $\{(-1,-1), (-5,-2), (-7,5)\}$. Using this we can easily calculate a matrix.

For example, the matrix mapping $(1,1) \mapsto (-1,-1)$ and $(4,3) \mapsto (-5,-2)$ is $$ \begin{pmatrix} -2 & 1 \\ 1 & -2 \end{pmatrix}. $$ This matrix also happens to map $(3,-1)$ to the remaining vector $(-7,5)$ and so we are done. We got lucky this time; if this hadn't mapped to the right vector we could have kept choosing different pairs of vectors until we found the correct map.

  • 1
    $\begingroup$ Please specify how you built the matrix $\endgroup$ – SteakOverflow Mar 27 '17 at 8:21

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).

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} $$

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.

  • $\begingroup$ as they are in the plane, you should use "0 0 1" as the last row for each of T1 and T2 matrices $\endgroup$ – Girardi Sep 15 '18 at 21:41

$\newcommand{\+}{^{\dagger}}% \newcommand{\angles}[1]{\left\langle #1 \right\rangle}% \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}% \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}% \newcommand{\dd}{{\rm d}}% \newcommand{\isdiv}{\,\left.\right\vert\,}% \newcommand{\ds}[1]{\displaystyle{#1}}% \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}% \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}% \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}% \newcommand{\ic}{{\rm i}}% \newcommand{\imp}{\Longrightarrow}% \newcommand{\ket}[1]{\left\vert #1\right\rangle}% \newcommand{\pars}[1]{\left( #1 \right)}% \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}}% \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}% \newcommand{\sech}{\,{\rm sech}}% \newcommand{\sgn}{\,{\rm sgn}}% \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}}% \newcommand{\verts}[1]{\left\vert #1 \right\vert}% \newcommand{\yy}{\Longleftrightarrow}$

We just need a symmetric $3 \times 3$ real matrix $F$ where $F$ satisfy $F{\bf P}_{i} = {\bf P}_{i}'$. $i = 1, 2, 3$. ${\bf P}_{i}$ and ${\bf P}_{i}'$ are the triangle vertices "before" ( one of them ) and "after" ( the other one ) the transformation generated by the matrix $F$. With the vectors $$ {\bf 1} \equiv \pars{\begin{array}{c}1 \\ 0 \\ 0\end{array}}\,, \qquad {\bf 2} \equiv \pars{\begin{array}{c}0 \\ 1 \\ 0\end{array}}\,, \qquad {\bf 3} \equiv \pars{\begin{array}{c}0 \\ 0 \\ 1\end{array}} $$ The $F$ matrix elements $F_{ij} \equiv {\bf i}^{\sf T}F\,{\bf j}$ become $$ \color{#0000ff}{\large F_{ij}} = {\bf i}^{\sf T}F\sum_{\ell = 1, 2, 3}{\bf P}_{\ell}{\bf P}_{\ell}^{\sf T}\,{\bf j} = \color{#0000ff}{\large{\bf i}^{\sf T}\,\pars{\sum_{\ell = 1, 2, 3} {\bf P}_{\ell}'{\bf P}_{\ell}^{\sf T}}\,\,{\bf j}} $$

Notice that this is the ${\large\tt 3D}$ result but the idea can be straightforward 'translated' to ${\large\tt 2D}$.


Another way to get the answer is to notice that you can map $T_1$ to $T_2$ by reflecting $T_1$ in the origin and then scaling the result by 3 with respect to the diagonal $x=y$. Reflecting in the origin is simply $(x,y)\mapsto (-x,-y)$ and scaling is given by $(x,y)\mapsto(x+(x-y),y-(x-y))$.

Incidentally, the formula for scaling $(x,y)$ by $\gamma$ with respect to a line defined by $ax+by+d=0$ is

$$x\mapsto x+(\gamma-1)\frac{a(ax+by+d)}{(a^2+b^2)}\quad \text{and}\quad y\mapsto y+(\gamma-1)\frac{b(ax+by+d)}{(a^2+b^2)}.$$

If $(x,y)$ is at the distance $r$ from the line, then after it is scaled by $\gamma$ it will be at the distance $\gamma r$ from the line.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.