<s>[INST] How to find an affine map for given points I am trying to understand affine maps. In the book I am using there is the following example, which I don't understand. Given are the following points:
\begin{array}{lll}
  p_0 = \begin{pmatrix} 1 \\ 1 \end{pmatrix},
  &
  p_1 = \begin{pmatrix} 1 \\ 2 \end{pmatrix},
  &
  p_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix},
  \\
  q_0 = \begin{pmatrix} -2 \\ -1 \end{pmatrix},
  &
  q_1 = \begin{pmatrix} \phantom{-}0 \\ -1 \end{pmatrix},
  &
  q_2 = \begin{pmatrix} -2 \\ -2 \end{pmatrix}.
\end{array}
Then the following vectors are computed
\begin{array}{ll}
    \overrightarrow{p_0 p_1}
  = \begin{pmatrix} 0 \\ 1 \end{pmatrix},
  &
    \overrightarrow{p_0 p_2}
  = \begin{pmatrix} -1 \\ \phantom{-}0 \end{pmatrix},
  \\
    \overrightarrow{p_0 p_1}
  = \begin{pmatrix} 2 \\ 0 \end{pmatrix},
  &
    \overrightarrow{p_0 p_1}
  = \begin{pmatrix} \phantom{-}0 \\ -1 \end{pmatrix}.
\end{array}
I am asked to find an affine map such that $f(p_{i})=q_{i}$.
It now says that the matrix of the map determined by $F(\overrightarrow{p_0 p_i})=\overrightarrow{q_0 q_i}$, $i=1,2$ is given by
$$
    A
  = \begin{pmatrix}
      0 & 2 \\
      1 & 0
    \end{pmatrix}.
$$
I don't understand how I get this matrix. I would say it is the following one, but I guess I am wrong. I did everything with repect to the bases $\{(0,1),(-1,0)\}$ and $\{(1,0),(0,1)\}$. I am not sure about the second basis, but since there is no other basis mentioned I thought it is the one the author has used too.
$$
  \begin{pmatrix}
    2 & \phantom{-}0 \\
    0 &           -1 \\
  \end{pmatrix}
$$
Unfortunately I don't know  where I making the mistake.
I would really appreciate some help. Thanks a lot in advance! 
 [/INST] Let $A=    
\begin{pmatrix}
    a & b \\
    c & d \\
    \end{pmatrix}$
Now, apply this matrix to your vectors $p_0p_1$ and $p_0p_2$
The first one gives: 
$q_0q_1=A*p_0p_1$
So
$\begin{pmatrix}2 \\0 \end{pmatrix}=A* \begin{pmatrix}0 \\1 \end{pmatrix} = \begin{pmatrix} a*0 + b*1 \\ c*0 +d*1\\  \end{pmatrix}= \begin{pmatrix}b \\d \end{pmatrix}$ 
This gives you $b=2$ and $d=0$. You can use the other equation to get a and c.
</s>