Explanation of an example of linear transformation This is an example from a text (Linear Algebra, Freidberg). I am trying to follow along, and I feel like I should know this from vector calc but I am missing something silly. 
The example is: 

Define the Linear transformation $T:P_2(R)\rightarrow M_{2x2}(R)$ by 
$$T(\,f(x)) = \begin {pmatrix} f(1)-f(2) & 0 \\ 0 & f(0) \end{pmatrix} \DeclareMathOperator{\span}{span}$$
since $\beta = ${$1, x, x^2$} is a basis for $P_2(R)$ we have
  \begin{align*}
R(T) &= \span(T(\beta)) \\
&= \span(\{T(1), T(x), T(x^2)\}) \\
&= \span\left(\left\{\begin {pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}, \begin {pmatrix} -1 & 0 \\ 0 & 0 \end{pmatrix}, \begin {pmatrix} -3 & 0 \\ 0 & 0 \end{pmatrix} \right\}\right) \\
&= \span\left(\left\{\begin {pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}, \begin {pmatrix} -1 & 0 \\ 0 & 0 \end{pmatrix} \right\}\right).
\end{align*}
  I wasn't sure how they got from the matrix defined above to the ones below. Neither $f(1)$ nor $f(2)$ are really defined, and plugging an $x$ or $x^2$ in there doesn’t help.

This is frustrating, because I am trying to just get through an example so I can figure out this stuff. The book says “thus we have found a basis for $R(T)$”, but it is far from obvious to me. I understand they are using the theorem that says 
$$R(T) = \span(T(\beta)) = \span(\{T(v_1), T(v_2)...T(v_n)\}),$$
where the $v_i$ are vectors that form a basis.
It’s getting through the matrix calculation above I am struggling with. 
 A: Your transformation is from the space of polynomials of degree at most 2 to the space of $2\times 2$ matrices with real coefficients.
They tell you that the polynomials $1$, $x$, and $x^2$ are a basis for $P_2(\mathbb{R})$; the next three matrices are just the results of applying your transformation to these three polynomials:
If $f(x)=1$ for all $x$, then
$$
T(\,f(x))=\begin{pmatrix}f(1)-f(2) & 0\\0 & f(0)\end{pmatrix}=\begin{pmatrix}1-1 & 0\\ 0 & 1\end{pmatrix}=\begin{pmatrix}0&0\\0&1\end{pmatrix}.
$$
If $f(x)=x$, then
$$
T(\,f(x))=\begin{pmatrix}f(1)-f(2) & 0\\0 & f(0)\end{pmatrix}=\begin{pmatrix}1-2 & 0\\0 & 0\end{pmatrix}=\begin{pmatrix}-1 & 0\\0 & 0\end{pmatrix}.$$
Finally, if $f(x)=x^2$, then
$$
T(\,f(x))=\begin{pmatrix}f(1)-f(2) & 0\\0 & f(0)\end{pmatrix}=\begin{pmatrix}1-4 & 0\\0 & 0\end{pmatrix}=\begin{pmatrix}-3 & 0\\0 & 0\end{pmatrix}.
$$
A: Let's take a look at how the elements of $T(f)$ are defined. We can easily show that $T(\alpha f+g) = \alpha T(f)+T(g)$ for, in fact, any functions $f$, $g$ and $\alpha\in \mathbb C$, because $(\alpha f+g)(x) = \alpha f(x)+g(x)$; this allows to say that $T$ is indeed linear. Apparently, $R(T)=span(T(1),T(x),T(x^2))$, (we look at the basis in $P_2[x]$), so we study what becomes of $T(1)$, $T(x)$, $T(x^2)$. After having obtained $R(T)$ we easily find its basis.
