The change of basis matrix from $B$ to $S$ is
$$P = \begin{pmatrix} 1 & r & r^2 \\ 0 & 1 & 2r \\ 0 & 0 & 1\end{pmatrix},$$
so the change of basis matrix from $S$ to $B$ is
$$P^{-1} = \begin{pmatrix} 1 & -r & r^2 \\ 0 & 1 & -2r \\ 0 & 0 & 1\end{pmatrix}.$$
Hence the $B$-coordinates of $p(x) = a_0 + a_1 x + a_2x^2$ are
$$ P^{-1}\begin{pmatrix} a_0 \\ a_1 \\ a_2 \end{pmatrix} = \begin{pmatrix} a_0 - a_1r + a_2 r^2 \\ a_1 - 2a_2 r \\ a_2 \end{pmatrix}.$$
I'm trying to get a better understanding of where this expression [the resultant] comes from
For the case of two quadratics, a common root means the following equations are satisfied for at least one value of $x$. The system includes the two original equations, plus the same equations multiplied by $x$.
$$
\begin{cases}
a_2 x^3 + & a_1 x^2 + & a_0 x && = 0 \\
& a_2 x^2 + & a_1 x + & a_0 & = 0 \\
b_2 x^3 + & b_1 x^2 + & b_0 x && = 0 \\
& b_2 x^2 + & b_1 x + & b_0 & = 0 \\
\end{cases}
$$
Consider this as a system of linear equations in $x_0 = 1, x_1 = x, x_2 = x^2, x_3 = x^3$.
$$
\begin{cases}
a_2 \cdot x_3 & +\; a_1 \cdot x_2 & +\; a_0 \cdot x_1 + & \,0 \cdot x_0 & = 0 \\
\,0 \cdot x_3 & +\; a_2 \cdot x_2 & +\; a_1 \cdot x_1 + & a_0 \cdot x_0 & = 0 \\
b_2 \cdot x_3 & +\; b_1 \cdot x_2 & +\; b_0 \cdot x_1 + & \,0 \cdot x_0 & = 0 \\
\,0 \cdot x_3 & +\; b_2 \cdot x_2 & +\; b_1 \cdot x_1 + & b_0 \cdot x_0 & = 0 \\
\end{cases}
$$
This is a linear homogeneous system which has the non-trivial solution $(1, x, x^2, x^3)$ so its matrix must be singular, which happens to be precisely the Sylvester matrix. This amounts to the following determinant being zero.
$$
\left|
\begin{matrix}
\;a_2 \;&\; a_1 \;&\; a_0 \;&\; 0 \\
\;0 \;&\; a_2 \;&\; a_1 \;&\; a_0 \\
\;b_2 \;&\; b_1 \;&\; b_0 \;&\; 0 \\
\;0 \;&\; b_2 \;&\; b_1 \;&\; b_0 \\
\end{matrix}
\right| \;\;=\;\; 0
$$
Expanding the determinant results in the expression posted for $R_{2,2}(f,g)$.
In the general case of polynomials $f$ of degree $r$ and $g$ of degree $s$, multiplying the equation $f(x) = 0$ by $x, x^2, \dots, x^{s-1}$ and $g(x) = 0$ by $x, x^2, \dots, x^{r-1}$ gives a system of $r+s$ equations with a similar Sylvester matrix.
Performing the Euclidean algorithm we get [...]
Looking at it from another angle, the first step of the euclidean division eliminates the $x^2$ term between equations, then the second step eliminates the $x$ term. In the end, this is solving the same equations by successive elimination, instead of determinants, but it becomes more laborious to do for higher degrees.
Best Answer
Take a polynomial $Q$ of degree at most $n$, and suppose there exist scalars $\lambda_0, \ldots, \lambda_n$ such that $Q = \lambda_0 P_0 + \cdots + \lambda_n P_n$. Then it is easy to tell what these scalars are, since $$ Q(a_k) = \lambda_0 P_0(a_k) + \cdots + \lambda_n P_n(a_k) = \lambda_k P_k(a_k) = \lambda_k$$ and hence we must have that $\lambda_0 = Q(a_0), \ldots, \lambda_n = Q(a_n)$.
The above argument applied to $Q = 0$ shows that the $P_0, \ldots, P_n$ are linearly independent, and hence they are spanning since we know that $\dim \mathbb{R}_{\leq n}[x] = n + 1$.