Linear operator in a given basis

Given a linear operator $g$ : $R_{2}$ $to$ $R_{2}$ maps a vector $x$=$begin{pmatrix}
2\
-1
end{pmatrix}$
and $y$= $begin{pmatrix}
-3\
2
end{pmatrix}$
to vectors $a$= $g(x)$=$begin{pmatrix}
2\
4
end{pmatrix}$
and $b$= $g(y)$=$begin{pmatrix}
-1\
-2
end{pmatrix}$

Find $g$ in the basis {$x$,$b$}

The approach followed by me was finding $g$ by using the mappings and solving a system of linear equations for $g$ which will be a 2×2 matrix. Then I found the basis by mapping the columns of vectors $x$ and $b$ as the following:

$B=begin{pmatrix}
2 & -1 \
-1 & -2
end{pmatrix}$
and $g=begin{pmatrix}
3 & 4 \
6 & 8
end{pmatrix}$

and then using the below formula to calculate it in given basis {$x$,$b$} as:

$g_{1}=B^{-1}gB$ where $g_{1}$ is the linear operator in the given basis {$x$,$b$}

Can you please let me know if the approach to the above formulation is correct?