## Wednesday, June 26, 2013

### Vector Representation in Different Basis

Teacher: We now know how to rotate a vector $u$ counter-clockwise by an angle $\theta$ using a rotation matrix $Q$. In this lesson, we are not going to transform the vector $u$ - instead we are going to investigate how the matrix representation changes when we move from the standard basis vectors to  some other basis.

Student: Right, that last time around you did remark that in the matrix representation of a vector $u = (1,1)$ the basis was tacitly assumed. So I guess, we have to first talk about a new basis.

Teacher
: Yep. Let's again consider a vector $u = (u_1, u_2)$ and the standard basis vectors $e_1 = (1,0)$ and $e_2 = (0,1)$ in 2D. Thus,
$u = u_1 e_1 + u_2 e_2 = \begin{bmatrix} u_1 \\ u_2 \end{bmatrix}.$
Student: I notice you dropped the subscript "o" from last time, because we are not going to touch the vector per se. Also I notice that we using a general representation instead of something specific $u = (u_1, u_2)$.

Teacher
: Good observation. We will toggle between a general and a specific $u$, depending on the situation. Now let's pick two new basis vector $E_1$ and $E_2$. Just to reiterate lessons from last time, let us generate this new basis by rotating the standard basis by 90 degrees.

Student: Okay. Let me figure this part out. I set  $\theta = \pi/2$. I can compute $Q(\pi/2)$ and get:
$E_1 =Q(\pi/2) e_1 = \begin{bmatrix} 0 & -1\\ 1 & 0 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} .$

Similarly, $E_2 = Q(\pi/2) e_2 = (-1, 0)$. I guess that means I can draw a picture such as:

Teacher: Great. Now let's consider the point $u = (1,1)$ as before, and ask ourselves how its representation in the new basis $U = (U_1, U_2)$ looks like.

Student: Hang on. I thought we were not going to do anything to the vector $u$.

Teacher
: We aren't! We are simply looking at the same geometrical object $u$ with a different lens (basis). It similar to saying: "Texas is to the west", when you are in Florida, and "Texas is to the East", when you are in California. Texas hasn't moved. You have.

Student: Aha! I see what you mean. We are trying to represent the same geometrical object $u_1 e_1 + u_2 e_2 = U_1 E_1 + U_2 E_2$.

Teacher
: Great. Since we know the relationship between the old and new basis, we should be able to figure out the co-ordinates in the new basis.
$U_1 E_1 + U_2 E_2 = U_1 Q e_1 + U_2 Q e_2 = Q U_1 e_1 + Q U_2 e_2$
That is: $QU = u$, or $U = Q^T u$.

Student: Okay let me try to keep things straight. $Q$ codifies the relationship between the old and new axis. You are telling me that a point $u$ in the old basis is the same as the point $Q^T u$ in the new basis.

Teacher
: Yes! Why don't you try out the example?

Student: Okay. I already know what $Q$ is. I can get:
$U = Q^T u = \begin{bmatrix} 0 & 1\\ -1 & 0 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ -1 \end{bmatrix} .$

Teacher
: Does that look like the right answer?

Student: $U = 1 E_1 + (-1) E_2$. That looks about right from this figure!

Teacher
: Right. If you want to rotate a vector you multiply it by $Q$. If you want to represent the same vector in a different basis you multiply it by $Q^T$.

Student: Question. Here the new basis was a simple rotation of the old basis given by $Q$. What about a general new basis.

Teacher
: Good question. We can figure this out using linear algebra for a n-dimensional space. We know what the standard basis for such a space is. $e_i = [0~... 0, 1, 0, ..., 0]^T$, where the 1 is in the i-th row. Consider an alternative basis packed together as columns in the matrix C:
$C = (v_1~v_2~...v_n)$
Student: Each of the $v_i$ is a n-dimensional vector, and since they form a basis for $R^n$, they are linearly independent. And $C$ is really a n by n matrix, that is invertible.

Teacher
: Someone here remembers their linear algebra! Okay now we can write a point $u \in R^n$ in terms of the new basis
$u = U_1 v_1 + ... + U_n v_n = C \begin{bmatrix} U_1 \\ \vdots \\ U_n \end{bmatrix} = C U$
And hence, $U = C^{-1} u$.

Student: I get it! In our case, the the basis transformation was simply a rotation $C = Q$. Therefore
$U = C^{-1} u = Q^T u$. That really does tie it all in together.

Teacher
: I am so glad that it does. You know what else. Khan Academy has a bunch of nice videos on this topic.

Student: I sure will check them out.