[Math] Finding the appropriate Linear Transformation given input and output points

geometrylinear algebralinear-transformationsvector-spaces

I'm trying to solve this problem about finding the right Linear Transformation $\phi: \mathbb{R^2} \rightarrow \mathbb{R^2}$ which maps a set of 3 given points
$A=(x_A, y_A) \space \space B=(x_B, y_B) \space \space C=(x_C, y_C) \space$
to 3 other given points $ A'=(x_{A'}, y_{A'}) \space B'=(x_{B'}, y_{B'}) \space C'=(x_{C'}, y_{C'})$ respectively.

My first idea was to check whether 2 of those vectors were a basis for $\mathbb{R^2}$ and express the other one as a linear combination like this:

$(x',y')=\alpha(x_A,y_A)+\beta(x_B,y_B)+\gamma(x_C,y_C)$

and then I can find $\alpha, \space \beta, \space \gamma$.

I'm not sure how to proceed from here, would there be a better approach?

Best Answer

Say you have more than two points, you can also consider for \begin{equation} T = \begin{pmatrix} T_{11} & T_{12}\\ T_{21} & T_{22} \end{pmatrix} \end{equation} the problem \begin{equation} \min_{T} \|XT-X'\|_F^2 \end{equation} with \begin{equation} X = \begin{pmatrix} x_1 & y_1\\ x_2 & y_2\\ x_3 & y_3 \end{pmatrix},\quad X' = \begin{pmatrix} x_1 '& y_1'\\ x_2' & y_2'\\ x_3' & y_3' \end{pmatrix}. \end{equation} This may look too difficult, but we have the closed-form expression for the minimizer (assuming $X$ is of sufficient rank): \begin{equation} T^{\star}=(X^{\top}X)^{-1}X^{\top}X' \end{equation} which is your desired transformation. Note that for more than two points a transformation which does the trick exactly, might simply not exist.

Related Question