To show that B is a basis for W, all we need to do is show linear independence, since by definition B spans W.

So we need to show that if:

$(c_1p_1 + c_2p_2 + c_3p_3)(x) = 0$ for all real $x$, then $c_1 = c_2 = c_3 = 0$.

Expanding this out in terms of what the $p_i$ are defined as, this becomes:

$c_1(1 + x + 2x^2) + c_2(7 + 8x + 13x^2) + c_3(-3-x-7x^2) = 0 + 0x + 0x^2$, or:

$(c_1 + 7c_2 - 3c_3) + (c_1 + 8c_2 - c_3)x + (2c_1 + 13c_2 - 7c_3)x^2 = 0 + 0x + 0x^2$, which gives us 3 equations in 3 unknowns:

$c_1 + 7c_2 - 3c_3 = 0$

$c_1 + 8c_2 - c_3 = 0$

$2c_1 + 13c_2 - 7c_3 = 0$.

If we subtract the first equation from the second, we obtain:

$c_2 + 2c_3 = 0$, so we can replace $c_2$ with $-2c_3$ in all 3 equations. Doing this for the first and last equations gives:

$c_1 - 14c_3 - 3c_3 = c_1 - 17c_3 = 0$

$2c_1 - 26c_3 - 7c_3 = 2c_1 - 33c_3 = 0$.

Subtracting twice the first equation from the second, gives:

$-33c_3 + 34c_3 = 0$, that is: $c_3 = 0$. Since $c_2 = -2c_3$, this means $c_2 = 0$ as well, and it is immediate that $c_1 = 0$ must also be true. This establishes linear independence.

Therefore, dim(W) = |B|.

Now, what is the dimension of $P_2$?