# Examples of Basis transformation in 2D

A set of examples and explanations for basis transformations in two dimensions.

## Transformation with known basis vectors

This transformation is by far the most straight forward.

Using the dark blue basis vectors as a basis for \(S\) and the light blue vectors as a basis for \(S'\) we can write the basis vectors of \(S'\) in the coordinates of \(S\).

\(P = \begin{pmatrix} 1 \\ 1 \end{pmatrix}\) in \(S'\). Using the knowledge of the transformation between \(S\) and \(S'\) we can then express \(P\) in terms of it's \(S\) coordinates.

The \(S'\) basis vectors have the \(S\) coordinates:

$$ x'_1 = \begin{pmatrix} -1 \\ 2 \end{pmatrix}$$ $$x'_2 = \begin{pmatrix} -1 \\ -1 \end{pmatrix} $$

We can see that this means that while \(P\) in \(S'\) is written as:

$$ P_{S'} = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$$

then because we know what \(x'_1\) and \(x'_2\) are in \(S\), we can write \(P\) in \(S\) as:

$$P_S = 1\cdot x'_1 + 1\cdot x'_2 = 1 \cdot \begin{pmatrix} -1 \\ 2 \end{pmatrix} + 1 \cdot \begin{pmatrix} -1 \\ -1 \end{pmatrix} = \begin{pmatrix} -2 \\ 1 \end{pmatrix}$$

Now this can also be written using the matrix formalism. From the above calculation we can see that the coordinates of \(P\) in \(S'\) are used as a weights for the vectors representing \(x'_1\) and \(x'_2\) in the new system as we would expect. This is directly representable in matrix formalism. As a result we get:

$$P_S = \begin{pmatrix} -2 \\ 1 \end{pmatrix} = \begin{pmatrix} -1 & -1 \\ 2 & -1 \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 1 \end{pmatrix} = \mathbf{T_{S'\to S}} P_{S'}$$

So we can see from this that to construct a transformation matrix from \(S' \to S\) is simple if we have a description of the basis vectors of \(S'\) in \(S\). Consrtucting the transformations simply becomes writing down the \(S'\) basis vectors in the order of appearance, \(\left(x'_1 x'_2 ... x'_n\right)\) so that an \(N\times N\) matrix is constructed.

Swapping the order of the basis vectos therefore swaps the 'name' of the basis vectors, and thus the vertical order of the coordinates of \(P\). This is technically a different reference system

So to get the transformation from \(S'\to S\), we can invert the \(\mathbf{T_{S'\to S}}\) because:

$$P_S = \mathbf{T_{S'\to S}} P_{S'} $$

which implies:

$$\mathbf{T_{S'\to S}}^{-1} P_S = \mathbf{T_{S'\to S}}^{-1}\mathbf{T_{S'\to S}} P_{S'} = \mathbf{I} P_{S'} = P_{S'} $$

This shows that:

$$ \mathbf{T_{S'\to S}}^{-1} = \mathbf{T_{S \to S'}} $$

transforming a vector to a Point \(P\) from the reference system \(S\) to a vector to \(P\) in reference system \(S'\). In our example we have:

$$ \mathbf{T_{S'\to S}}^{-1} = \begin{pmatrix} -1/3 & 1/3 \\ -2/3 & -1/3 \end{pmatrix}$$

With which we can easily show:

$$ \mathbf{T_{S'\to S}}^{-1}P_S = \begin{pmatrix} -1/3 & 1/3 \\ -2/3 & -1/3 \end{pmatrix} \begin{pmatrix} -2 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 1 \end{pmatrix} = P_{S'} $$

### Side Notes

- So \(P_S\) denotes the point P as described in the basis of \(S\) and \(P_{S'}\) denotes \(P\) as described in \(S'\).