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

## Monday, June 24, 2013

1. Math Wars: NYT Opinionater piece by Alice Crary and Stephen Wilson making the case for teaching algorithms. (H/T Alexandre Borovik). The comments section, as usual, is very entertaining.

2. How not to shoot a monkey (Empirical Zeal).

3. The footnotes to (2) above reference the excellent Radiolab segment "Escape", which talks about Newton's "moon problem": Why does the moon, unlike an apple fall, not fall straight towards the earth?

I had heard before that the Newton's apple story was probably apocryphal. Apparently, it was perpetuated by Newton himself as a cunning ruse to claim primacy over the concept of gravitation (from rival Robert Hooke). It turns out that the real story was far more interesting, and I wish it received as much air-time as that darned apple. If you don't want to listen to the Radiolab episode, this link explains the idea.

## Thursday, June 20, 2013

### Exploring GeoGebra

I've known about the existence of GeoGebra for a while now, but this summer I've spent some time taking it out for longer rides. I really like the program - it is very intuitive to use, and there is a lot of help available online.

It does make math (algebra, calculus, geometry) very interactive and fun.

One thing I am very excited about is the ability to export GeoGebra worksheets into dynamic HTML5 webpages with the press of a button. This means you can make all those interactive JavaScript or HTML5 applets *very* easily.

You can already go to GeoGebraTube, and explore many shared worksheets either as Java or HTML5 applets, or download the "ggb" files and open them using GeoGebra installed on your computer.

I could not help but notice that its creator Markus Hohenwarter was at Florida State University (where I work) between 2008–2009. It is unfortunate that I did not get to meet him then.

## Friday, June 14, 2013

### HFT in decline?

Interesting story entitled "How the Robots Lost: High-Frequency Trading's Rise and Fall" in BusinessWeek on how speed is becoming increasingly commoditized!
For the first time since its inception, high-frequency trading, the bogey machine of the markets, is in retreat. According to estimates from Rosenblatt Securities, as much as two-thirds of all stock trades in the U.S. from 2008 to 2011 were executed by high-frequency firms; today it’s about half. In 2009, high-frequency traders moved about 3.25 billion shares a day. In 2012, it was 1.6 billion a day. Speed traders aren’t just trading fewer shares, they’re making less money on each trade. Average profits have fallen from about a tenth of a penny per share to a twentieth of a penny.

## Thursday, June 13, 2013

### Rotating Vectors

Teacher: Let's start simple, and consider a vector $u_o = (1,1)$, with the usual standard basis vectors $e_1 = (1,0)$ and $e_2 = (0,1)$ in 2D.

Student: Are we going to stay in 2D thoughout?

Teacher: For now, at least. It makes visualization much easier. To begin with, we are going to consider rotation of the vector $u_o$ by an angle $\theta$ to the new vector $u_n$.

Student: I guess the subscripts "o" and "n" stand for "old" and "new". So you mean I should conjure a picture like this?

Teacher: That's excellent. What do we really mean by the vector  $u_o = (1,1)$ in terms of the bases?

Student: I know. I know. We mean $u_0 = 1 e_1 + 1 e_2$. The "co-ordinates" of a vector tell me what linear combination of the basis I should take.

Teacher: Very impressive! You can also write the vector in "matrix notation" as $u_0 = \begin{bmatrix} 1 \\ 1 \end{bmatrix}.$ Remember that the matrix notation implicitly assumes a certain basis. We will revisit this subtle but confusing point later, when we talk about non-standard bases.

Student: Okay. So as long as I use the same basis or co-ordinate system throughout a problem, I don't have to spend too much time thinking about it?

Teacher: Right. Now let us consider the 2 by 2 rotation matrix $Q$, which performs the rotation. One can derive it from pure geometrical considerations. This magic matrix looks like:
$Q = \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \\ \end{bmatrix}$
Student: How do I use it?

Teacher: Very simple. To rotate $u_0$ counter-clockwise by an angle $\theta$ just multiply
$u_n = Q(\theta) u_0.$
Student: Cool. Let me try. If I set $\theta = \pi/2$. I get:
$u_n =\begin{bmatrix} 0 & -1\\ 1 & 0 \\ \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} -1 \\ 1 \end{bmatrix} .$

Teacher: Try $\theta = \pi/4$, and tell me what you see?

Student: I get $u_n = (0, \sqrt{2})$. Hmmm.
I see. I see. The length of the vector is unchanged. Both $u_0$ and $u_n$ are of length $\sqrt{2}$.

Teacher: Pure rotation, my friend. The matrix $Q$ is special. A general matrix $A$ would have been less gentle. In general, a 2 by 2 matrix rotates and stretches the vector on which it acts.

Student: Cool! Is there anything else that is special about $Q$

Teacher: Yes! I am glad you asked. $Q$ belongs to a special class of matrices called orthogonal matrices. These matrices have the interesting property that the transpose is the inverse.
$Q^{-1} = Q^T.$

Student: Does that have any relevance to our discussion?

Teacher: Sure it does! Given $u_n = Q u_0$ we can use the property of orthogonal matrices to write $u_0 = Q^T u_n$. That is, we can rotate a vector clockwise by an angle by multiplying by $Q^T$.

Student: Wait a minute. Shouldn't I have to multiply with $Q(-\theta)$, instead of $Q^T$?

Teacher: A rose by any other name is still a rose!

Student: Aha! They are the same matrix.

Teacher
: Excellent. Next time, we'll consider the problem we alluded to earlier. What happens to a vector when we change the basis.

## Monday, June 10, 2013

### The Heart-warming Story of Yitang Zhang's Proof

It's been over a month and a half since Yitang Zhang emerged from obscurity and "announced a proof that there are infinitely many pairs of consecutive primes with a gap at most 70 million" (wikipedia).

Wired in a nice piece (originally featured on Simons Science News) entitled "Unknown Mathematician Proves Elusive Property of Prime Numbers" retells the story of the announcement.
“Basically, no one knows him,” said Andrew Granville, a number theorist at the Université de Montréal. “Now, suddenly, he has proved one of the great results in the history of number theory.”
Zhang said he feels no resentment about the relative obscurity of his career thus far. “My mind is very peaceful. I don’t care so much about the money, or the honor,” he said. “I like to be very quiet and keep working by myself.”
From every angle, a feel-good science/math story (like this and this).

## Thursday, June 6, 2013

### Nipun Mehta: Commencement Speech

I enjoyed his commencement "Give, Receive and Dance" speech at Harker. Here's a transcript, and here is an amateur video:

A particularly poignant incident he talks about:
Sometime last year, I spontaneously treated a homeless woman to something she really wanted -- ice-cream. We walked into a nearby 7-11, she got her ice-cream and I paid for it. Along the way, though, we had a great 3-minute chat about generosity and as we’re leaving the store, she said something remarkable: "I'd like to buy you something. Can I buy you something?" She empties her pockets and holds up a nickel. The cashier looks on, as we all share a beautiful, awkward, empathy-filled moment of silence. Then, I heard my voice responding, “That’s so kind of you. I would be delighted to receive your offering. What if we pay-it-forward by tipping this kind cashier who has just helped us?” Her face breaks into a huge smile. “Good idea,” she says while dropping the nickel into the tip-jar.

## Tuesday, June 4, 2013

### Does skin sense temperature?

A long time ago, I remarked how we sense "heat flux" rather than temperature. I discovered two videos which articulate the same idea more eloquently.

From minute-physics:

From veritasium:

I particularly enjoyed the melting ice-cube part.

## Saturday, June 1, 2013

### Mathy Drawing

Found this two drawing programs via MathMunch

1. Recursive Drawing
Recursive Drawing is an exploration of user interface ideas towards the development of a spatially-oriented programming environment.
2. Silk:  Beautifully done. With its haunting background score, the drawing experience is almost meditative.