We will begin by showing that the elements of \(\mathcal{B}\) are linearly independent. Suppose
\begin{equation*}
ax+b(1+x)+c(x+x^2)=0.
\end{equation*}
Then
\begin{equation*}
b+(a+b+c)x+cx^2=0.
\end{equation*}
This gives us the following system of equations:
\begin{equation*}
\begin{array}{ccccccc}
\amp \amp b\amp \amp \amp =\amp 0
a \amp +\amp b\amp +\amp c\amp = \amp 0
\amp \amp \amp \amp c\amp =\amp 0
\end{array}
\end{equation*}
The solution \(a=b=c=0\) is unique. We conclude that \(\mathcal{B}\) is linearly independent.
Next, we need to show that \(\mathcal{B}\) spans \(\mathbb{P}^2\text{.}\) To this end, we will consider a generic element \(p(x)=\alpha+\beta x+\gamma x^2\) of \(\mathbb{P}^2\) and attempt to express it as a linear combination of the elements of \(\mathcal{B}\text{.}\)
\begin{equation*}
ax+b(1+x)+c(x+x^2)=\alpha+\beta x+\gamma x^2.
\end{equation*}
then
\begin{equation*}
b+(a+b+c)x+cx^2=\alpha+\beta x+\gamma x^2.
\end{equation*}
Setting the coefficients of like terms equal to each other gives us
\begin{equation*}
\begin{array}{ccccccc}
\amp \amp b\amp \amp \amp =\amp \alpha\\
a \amp +\amp b\amp +\amp c\amp = \amp \beta \\
\amp \amp \amp \amp c\amp =\amp \gamma
\end{array}
\end{equation*}
Solving this linear system of \(a\text{,}\) \(b\) and \(c\) gives us
\begin{equation*}
a=\beta-\alpha-\gamma,\quad b=\alpha,\quad c=\gamma .
\end{equation*}
(You should verify this.) This shows that every element of \(\mathbb{P}^2\) can be written as a linear combination of elements of \(\mathcal{B}\text{.}\) Therefore \(\mathcal{B}\) is a basis for \(\mathbb{P}^2\text{.}\) To find the coordinate vector for \(p(x)=4-x+3x^2\) with respect to \(\mathcal{B}\) we need to express \(p(x)\) as a linear combination of the elements of \(\mathcal{B}\text{.}\) Fortunately, we have already done all the necessary work. For \(p(x)\text{,}\) \(\alpha=4\text{,}\) \(\beta=-1\) and \(\gamma=3\text{.}\) This gives us the coefficients of the linear combination: \(a=\beta-\alpha-\gamma=-8\text{,}\) \(b=\alpha=4\text{,}\) \(c=\gamma=3\text{.}\) We now write \(p(x)\) as a linear combination
\begin{equation*}
p(x)=-8(x)+4(1+x)+3(x+x^2)
\end{equation*}
The coordinate vector for \(p(x)\) with respect to \(\mathcal{B}\) is
\begin{equation*}
[p(x)]_{\mathcal{B}}=\begin{bmatrix}-8\\4\\3\end{bmatrix}
\end{equation*}