Find operator's matrix Let's assume that a linear operator in basis 
$$e_1=(1,0,0)$$
$$e_2=(0,1,0)$$
$$e_3=(0,0,1)$$
hast matrix
$$A = \begin{pmatrix}
-1&2&1\\3&1&0\\1&1&1&\end{pmatrix}$$
I need to find matrix of this operator in new basis
$$a_1=(0,1,2)$$
$$a_2=(3,1,0)$$
$$a_3=(0,1,1)$$

Okay, what I do is:

1) I say, that
$$T(1,0,0)=(-1,2,1)$$
$$T(0,1,0)=(3,1,0)$$
$$T(0,0,1)=(1,1,1)$$
First question, is it correct (that I write rows of the matrix $A$, or I should write its columns)?

2) I say, that
$$T(0,1,2)=T((0,1,0)+2*(0,0,1))=T(0,1,0)+2*T(0,0,1)=(3,1,0)+2(1,1,1)=(5,3,2)$$
$$T(3,1,0)=T((3*(1,0,0)+(0,1,0))=3*T(1,0,0)+T(0,1,0)=3(-1,2,1)+(3,1,0)=(0,7,3)$$
$$T(0,1,1)=T((0,1,0)+(0,0,1))=T(0,1,0)+T(0,0,1)=(3,1,0)+(1,1,1)=(4,2,1)$$

3)Finally, I say that new matrix
$$A = \begin{pmatrix}
5&3&2\\0&7&3\\4&2&1&\end{pmatrix}$$

Is my answer correct or I've made a mistake somewhere?
 A: For (1), you should write it's columns. E.g.
$$
Te_1 = \begin{bmatrix} -1 & 2 & 1 \\ 3 & 1 & 0\\ 1 & 1 & 1\end{bmatrix}\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} -1 \\ 3 \\ 1 \end{bmatrix}.
$$
Also, when you're changing basis from the standard basis $\{e_1,e_2,e_3\}$ to the basis $\beta := \{v_1, v_2, v_3\}$, you can always compute the matrix representation of $A$ in $\beta$ by forming a matrix 
$$
V = \begin{bmatrix} v_1 & v_2 & v_3 \end{bmatrix},
$$
by concatenating the column vectors in $\beta$. Then
$$
[A]_\beta = V^{-1} A_{\{e_1,e_2,e_3\}} V.
$$
See if you can see why this works. For more information, see for example this.
A: For your first question, you should write columns of $A$ not rows. So we have 
$Te_1= (-1,3,1), Te_2=(2,1,1), Te_3= (1,0,1)$. So, we have
$$T(0,1,2) = (10/3)(0,1,2)+(4/3)(3,1,0)+(-11/3)(0,1,1)$$
$$T(3,1,0) = (-19/3)(0,1,2)+(-1/3)(3,1,0)+(50/3)(0,1,1)$$
$$T(0,1,1) = (2)(0,1,2)+(1)(3,1,0)+(-2)(0,1,1)$$
Therefore, the matrix with respect to this basis is
$\begin{bmatrix} 10/3 & -19/3 & 2 \\ 4/3 & -1/3 & 1\\ -11/3 & 50/3 & -2\end{bmatrix}$
