Change of basis in two dimensions, use order of transformation matrices? I have the vector $\overrightarrow{v} = \begin{bmatrix}v_x \\ v_y\end{bmatrix}$ and I want to write it with respect to the basis  $B=\{\frac{1}{r_1+r_2}\begin{bmatrix}
        x_2-x_1 \\
        y_2-y_1 \\
        \end{bmatrix},\frac{1}{r_1+r_2}\begin{bmatrix}
        y_2-y_1 \\
        x_2-x_1 \\
        \end{bmatrix}\}$. $x_1$, $x_2$, $y_1$, $y_2$, $r_1$ and $r_2$ are all given. As some of you may have guessed, I'm trying to represent $v$ in terms of two orthogonal vectors that are "skewed" by an angle $\alpha$ from the normal $x$ and $y$ axes. The orthogonal vectors, for your information, are $\begin{bmatrix}\cos\alpha \\\sin\alpha\end{bmatrix}$ and $\begin{bmatrix}\sin\alpha \\\cos\alpha\end{bmatrix}$, which are equivalent to the two vectors in $B$. I've understood that in order to write $v$ with respect to the basis $B$, I can use a transformational matrix. The problem is, I'm not sure which matrix to use to get from normal $\{\hat{x},\hat{y}\}$ basis to $B$. I have two matrices; 
$$C = \frac{1}{r_1+r_2}\begin{bmatrix}
x_2-x_1 & y_2-y_1 \\
y_2-y_1& x_2-x_1\\
\end{bmatrix}$$ 
and its inverse;
$$D = \frac{r_1+r_2}{(x_2-x_1)^2-(y_2-y_1)^2} \begin{bmatrix}
x_2-x_1 & y_2-y_1\\
y_2-y_1& x_2-x_1\\
\end{bmatrix}$$
My question is, which of the matrices do I need to use in $M\overrightarrow{v}$ to get $\overrightarrow{v}$ with respect to $B$?
I hope you understand my question, it's been a while since I took linear algebra.
 A: Let $\{\vec x_1,\vec x_2\}$ be a  bases. We can define a new basis $\{\vec y_1,\vec y_2\}$ in term of the previous one by specifying the components of the new basis vectors in the old basis:
$$\vec y_1=\Lambda_{11}\vec x_1+\Lambda_{21}\vec x_2$$
$$\vec y_2=\Lambda_{12}\vec x_1+\Lambda_{22}\vec x_2$$
The equation above is purely geometric. If we choose a particular basis, we can write it as a matrix equation.
$$Y^T=\Lambda X^T,\ \ \ \Lambda=\begin{bmatrix}
\Lambda_{11} & \Lambda_{12} \\
\Lambda_{21} & \Lambda_{22}
\end{bmatrix}$$
where the columns of $X$ and $Y$ are the components of their respective vectors in the chosen basis. Regardless of our choice of basis, the matrix $\Lambda$ will be the same. It defines a change of basis from $\{\vec x_1,\vec x_2\}$ to $\{\vec y_1,\vec y_2\}$. If we choose $\{\vec x_1,\vec x_2\}$ as our basis, the matrix $X$ is the identity, and we see that $\Lambda$ is a matrix whose rows are the components of $\{\vec y_1,\vec y_2\}$ represented in the basis $\{\vec x_1,\vec x_2\}$.
Let $\vec v$ be a vector. we can represent it in each basis as:
$$\vec v=v_{x1}\ \vec x_1+v_{x2}\ \vec x_2=v_{y1}\ \vec y_1+v_{y2}\ \vec y_2$$
Since we know the components of $\{\vec y_1,\vec y_2\}$ in terms of $\{\vec x_1,\vec x_2\}$, we can plug those in.
$$v_{x1}\ \vec x_1+v_{x2}\ \vec x_2=v_{y1}(\Lambda_{11}\vec x_1+\Lambda_{21}\vec x_2)+v_{y2}(\Lambda_{12}\vec x_1+\Lambda_{22}\vec x_2)$$
$$v_{x1}\ \vec x_1+v_{x2}\ \vec x_2=(\Lambda_{11}v_{y1}+\Lambda_{21}v_{y2})\vec x_1+(\Lambda_{12}v_{y1}+\Lambda_{22}v_{y2})\vec x_2$$
Now everything is represented in the basis $\{\vec x_1,\vec x_2\}$, so the components of both sides must be equal. This gives us a matrix equality.
$$\begin{bmatrix}
v_{x1} \\
v_{x2}
\end{bmatrix}=\begin{bmatrix}
\Lambda_{11} & \Lambda_{21} \\
\Lambda_{12} & \Lambda_{22}\end{bmatrix}\begin{bmatrix}
v_{y1} \\
v_{y2}
\end{bmatrix}$$
$$\vec v_{_X}=\Lambda^T\vec v_{_Y}$$
We see the transformation of components looks a bit different. The transpose $\Lambda^T$ defines the change of basis in the opposite direction. We can solve for $\vec v_{_Y}$ by left multiplying by the inverse.
$$\vec v_{_Y}=\left(\Lambda^T\right)^{-1}\vec v_{_X}$$
Here we obtain a general rule. If $\Lambda$ defines a transformation of basis vectors, then the components of vectors are transformed by $\left(\Lambda^T\right)^{-1}$ under that change of basis.
In your case, the columns of $C$ are the new basis vectors, so $C$ is analogous to $\Lambda^T$. The transformation of components is thus $C^{-1}=D$ since transpose and inverse commute.
