Given basis can be written in matrix form (first row - second power, second row - first power, third row - free coefficient):

$B=\left[\begin{array}{ccc}1& 1& 1\\ 0& 1& 2\\ 1& 0& 1\end{array}\right]$

Solve $Bx=p(t)$ using augmented matrix:

$\left[\begin{array}{ccc}1& 1& 1|7\\ 0& 1& 2|4\\ 1& 0& 1|1\end{array}\right]$

, multiply first row with -1 and add to third

$\sim \left[\begin{array}{ccc}1& 1& 1|7\\ 0& 1& 2|4\\ 0& -1& 0|-6\end{array}\right]$

$-{x}_{2}=-6\to {x}_{2}=6$

${x}_{2}+2{x}_{3}=4$

$6+2{x}_{3}=4$

$2{x}_{3}=4-6=-2$

${x}_{3}=-1$

${x}_{1}+{x}_{2}+{x}_{3}=7$

${x}_{1}+6-1=7$

${x}_{1}=7-5=2$

${p}_{B}=\left[\begin{array}{c}2\\ 6\\ -1\end{array}\right]$

Results:

${p}_{B}=\left[\begin{array}{c}2\\ 6\\ -1\end{array}\right]$