Problem 10.4.1
Given the basis $$ {\bf B}= \left\{ \left[ \begin{array}{r} 2\\ -1\\ \end{array} \right],\ \left[ \begin{array}{r} 3\\ 2\\ \end{array} \right] \right\} \text{ for }\mathbb{R}^2, $$ we are asked for $$ [x]_{\bf B} \quad\text{for}\quad x= \left[ \begin{array}{r} 5\\ -7\\ \end{array} \right]. $$ Look back to the beginning of Section 10.4 for what this means: $$ [x]_{\bf B}= \left[ \begin{array}{r} c_1\\ c_2\\ \end{array} \right] \quad\text{where}\quad \left[ \begin{array}{rr} 2&3\\ -1&2\\ \end{array} \right] \cdot \left[ \begin{array}{r} c_1\\ c_2\\ \end{array} \right] =x. $$ That $2\times 2$ matrix there is nothing but the two basis vectors (those in ${\bf B}$) placed side by side as columns.
As it happens, we've already seen how to find those $c_i$s. I'll now reiterate.
from sympy import *
init_printing(use_latex='mathjax')
B=Matrix([[2,3],[-1,2]]); B
x=Matrix([[5],[-7]]); x
B.solve(x)
Or: $c_1=\frac{31}7$ and $c_2=-\frac 97$. Let's check:
x==B.col(0)*S(31)/7 + B.col(1)*(-S(9)/7)
True
Yes: $x$ is the linear combination of the two columns of $B$ (in Python, remember, that means columns with indices 0 and 1, since the numbering starts at 0), with coefficients $c_1=\frac{31}7$ and $-\frac 97$ respectively.