(a) is going to be easier.
Suppose that the B-coordinates of f in $P_2$ are (a,b,c), that is:
$f = ap_1 + bp_2 + cp_3$.
We want the matrix $P$ that sends $[f]_B \to [f]_{B'}$, that is it sends the column vector $(a,b,c)^T$ to $(a',b',c')^T$ where $f = a'q_1 + b'q_2 + c'q_3$.
Since matrices are linear transformations, we can write:
$P(a,b,c) = P(a(1,0,0) + b(0,1,0) + c(0,0,1)) = aP(1,0,0) + bP(0,1,0) + cP(0,0,1)$.
Now, let's be clear about what this means: by P(1,0,0) we mean the B'-coordinates of the B-coordinates of $p_1 = 1p_1 + 0p_2 + 0p_3$.
Since $p_1(x) = 1 + x + 2x^2 = 1q_1(x) + 1q_2(x) + 2q_3(x)$, we see the B'-coordinates of $p_1$ are (1,1,2). The other two basis vectors are similar.
However, as a matrix, we also know that P(1,0,0) is the first COLUMN of the matrix. So the columns of $P$ are just going to be $p_1,p_2,p_3$ in the "standard" basis B', that is:
$P = \begin{bmatrix}1&7&-3\\1&8&-1\\2&13&-7 \end{bmatrix}$
(b) is a bit harder. We can do this one of two ways:
1. Find $P^{-1}$, which is the matrix we want.
2. Explicitly determine the vectors $q_1,q_2,q_3$ in B-coordinates.
I suggest the second route, as inverting a 3x3 matrix is rather time-consuming.
So, if we want to find $c_1,c_2,c_3$ such that $q_1(x) = c_1p_1(x) + c_2p_2(x) + c_3p_3(x)$, there are a few "tricks" we can use. Note that $q_1$ is a constant function, so we can use any $x$ we want. Since the equation holds for ALL $x$, it is convenient to use $x = 0$. We then have:
$1 = q_1(0) = c_1p_1(0) + c_2p_2(0) + c_3p_3(0) = c_1 + 7c_2 + -3c_3$.
At $x = 1$, we obtain:
$1 = 4c_1 + 28c_2 - 11c_3$.
From the first equation, we get:
$c_1 = 3c_3 - 7c_2 + 1$
From the second equation we get:
$c_1 = \frac{11}{4}c_3 - 7c_2 + \frac{1}{4}$.
Thus:
$3c_3 - 7c_2 + 1 = \frac{11}{4}c_3 - 7c_2 + \frac{1}{4}$, and:
$3c_3 + \frac{3}{4} = \frac{11}{4}c_3$, so $c_3 = -3$.
Next, we can use $x = -1$, to get:
$1 = 2c_1 + 12c_2 - 9c_3$, or: $c_1 = -6c_2 - \frac{9}{2}c_3 + \frac{1}{2}$.
Since we already know $c_3 = -3$, we can solve the two equations:
$c_1 = -8 - 7c_2$ and
$c_1 = -6c_2 - 13$, which, when equated, gives:
$-8 - 7c_2 = -6c_2 - 13$, that is: $c_2 = 5$.
Finally, we know that:
$c_1 = -8 - 7c_2 = -8 - 35 = -43$.
As a sanity check, we verify:
$-43p_1(x) + 5p_2(x) - 3p_3(x) = -43 - 43x - 86x^2 + 35 + 40x + 65x^2 + 9 + 3x + 21x^2 = (-43+35+9) + (-43+40+3)x + (-86+65+21)x^2 = 1 + 0x + 0x^2 = 1 = q_1(x)$,
so the B-coordinates of $q_1$ are (-43,5,-3). This will be the first COLUMN of $P^{-1}$.
The B-coordinates of $q_2$ and $q_3$ can be found the same way.
Part (c) is easy, you don't even need to do part (b) to answer it, you just need part (a).