# 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.

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.

• Thanks for your answer! How come this looks so different that what I've read previously about change of bases, where you just use the matrix whose column vectors are the basis vectors to transform in some direction? – Sandi Sep 19 '17 at 11:17
• My apologies, I made a mistake in the derivation. The matrix $\Lambda$ defines a transformation of matrices whose rows are basis vectors. Because your matrix $C$ has basis vectors as columns, it corresponds to $\Lambda^T$, not $\Lambda$. – Kajelad Sep 19 '17 at 22:02
• But this conflicts with what I've been reading elsewhere. For example, on wikipedia: "This means that given a matrix $M$ whose columns are the vectors of the new basis of the space (new basis matrix), the new coordinates for a column vector $v$ are given by the matrix product $M^{-1}v$. For this reason, it is said that ordinary vectors are contravariant objects." – Sandi Sep 19 '17 at 22:11
• It clearly says that the transformations can be done with the matrix whose COLUMNS are the basis vectors and the inverse of that matrix. Again, you've proven that you're right in my case, but it feels like it's conflicting with other knowledge I've encountered, such as that wikipedia excerpt. It would be great if you could provide some clarity in this. – Sandi Sep 19 '17 at 22:14
• Basically, $\Lambda$ defines how the basis vectors themselves transform, by the equation $$Y^T=\Lambda X^T$$. The matrix $M$ defines how coordinate vectors transform under this change in basis, by the equation $$\vec v_{_X} = M\vec v_{_Y}$$ or equivalently $$\vec v_{_Y} = M^{-1}\vec v_{_X}$$ These two transformation laws look different because coordinate vectors are contravariant objects. It turns out we can write both transform in terms of one matrix, since $\Lambda=M^T$. $M$ is a matrix whose columns are the new basis vectors. – Kajelad Sep 19 '17 at 22:43