Let $V$ $=$ $P_2$ and $dim(v)$ $=$ $3$. Let $B$ $=$ {$1$, $x$, $x^2$} and $S$ $=$ {$1+x$, $2-x$, $3+x^2$} be two basis of $V$. What is the matrix $P_B,_S$ and $P_S,_B$?
I am not entirely sure how to approach this problem. I see that the answer is $\begin{pmatrix}1&2&3\\ 1&-1&0\\ 0&0&1\end{pmatrix}$ for $P_S,_B$ and $\begin{pmatrix}\frac{1}{3}&\frac{2}{3}&-1\\ \frac{1}{3}&-\frac{1}{3}&-1\\ 0&0&1\end{pmatrix}$ for $P_B,_S$, but I am not entirely sure on how these matrices came about.
I do see that the first matrix is simply the the basis $S$ written in matrix form, but I am not entirely sure about why that is the correct answer in this case. Moreover, the second matrix is a different matrix altogether (it is not written in the matrix form of the basis $B$) so I am not entirely sure on how it came about. Is it some sort of linear combination of the other basis?
Any help would be highly appreciated!
Hint: note that the nth column of $P_{S,B}$ gives the linear combination of the basis elements in $B$ to get the nth element of the basis $S$. (i.e. $1\cdot 1 + 1 \cdot x + 0 \cdot x^2 = 1+x$)