Find the Matrix of T with respect to basis B. A linear transformation $T : P_2 \rightarrow P_2$ is given by
$T(a+bx+cx^2) = (a−b+c)+(b+c)x+(2b−a)x^2$.
It is given that the set $B=\{1+x+x^2, x+x^2, x^2\}$
is a basis for $P_2$.
(a) Find the matrix of $T$ with respect to the basis $B$ in both the domain and the
codomain.
I am really not sure how to answer this question, please help me.
I know the $T(x+x^2)=-(x+x^2)+2(x+x^2)=x+x^2$ therefore $0(1+x+x^2)+2(x+x^2)+0(x^2)$
so $\begin{pmatrix}0 & 2 & 0\end{pmatrix}$ but the answer for $T(1+x+x^2)$ and $T(x^2)$ is different on my mark scheme.
Thank you.

The matrix $T$, with respect to the basis $v_1= 1 + x + x^2$, $v_2= x + x^2$, and $v_3=x^2$ can be computed directly as follows
$T(v_1)=T(1+x+x^2)=(1-1+1) + (1+1)x + (2-1)x^2=1 + 2x + x^2= v_1+ v_2 - v_3$, 
$T(v_2)=T(x+x^2)= 2x + 2x^2 = 2v_2$,
$T(v_3)=T(x^2)= 1 + x = v_1-v_3$
Therefore, the matrix $T=(a_{ij})$ is the matrix which solves the equation
$\begin{pmatrix}
v_1 & v_2 & v_3
\end{pmatrix} T = \begin{pmatrix} v_1 + v_2 - v_3 & 2v_2 & v_1-v_3 \end{pmatrix}$. I'll let you solve explicitly for the values of $T$.
