# 2D Rotations in Space

Rather than representing an arbitrary vector as a combination of two basis vectors: $$\mathbf{a} = a_x\mathbf{x} + a_y\mathbf{y}$$, in this section we will see that we can simplify the algebra by representing an arbitrary vector as a scale and rotation of a single basis vector: $$\mathbf{a} = r_a\mathbf{x}e^{\mathbf{xy}\theta_a}$$

## Summary so far

### A basis for Geometric Algebra in two dimensions

In the introduction to Geometric Algebra we saw that we can define a 2D space using the basis vectors $$\mathbf{x}$$ and $$\mathbf{y}$$, where each basis vector's magnitude-squared is 1:

$\mathbf{x}^2 = \mathbf{y}^2 = 1$

and where each basis vector is orthogonal to the other, which we represented by their anti-commutativity:

$\mathbf{x}\mathbf{y} = -\mathbf{y}\mathbf{x}$

so that any 2D vector constructed as a combination of these basis vectors:

$\mathbf{a} = x_a\mathbf{x} + y_a\mathbf{y}$

still satisfies the requirement that the magnitude-squared of the vector is simply the square of the vector: $$|\mathbf{a}|^2 = \mathbf{a}^2$$.

### Using Euler's formula to rotate vectors in two dimensions

After some background on Euler's formula itself, we then investigated combining Euler's formula with Geometric Algebra, to see that

$e^{\mathbf{xy}\theta} = \cos\theta + \mathbf{xy}\sin\theta$

defines a rotation in two-dimensional space, which can be applied to an arbitrary vector to rotate it by $$\theta$$ in the $$\mathbf{xy}$$ plane:

$\mathbf{a}e^{\mathbf{xy}\theta}$

## Representing vectors as scaled rotations of a basis

This rotation provided by Euler's formula also allows us another way to represent arbitrary vectors. So far we have been representing an arbitrary vector $$\mathbf{a}$$ as a combination of the two basis vectors for the two-dimensional space:

$\mathbf{a} = x_a\mathbf{x} + y_a\mathbf{y}$

But we can now additionally represent an arbitrary vector as a magnitude and orientation applied to a basis vector:

$\mathbf{a} = r_a \mathbf{x}e^{\mathbf{xy}\theta_a} = r_a e^{-\mathbf{xy}\theta_a}\mathbf{x}$

where $$r_a$$ is the magnitude and $$\theta_a$$ the orientation of $$\mathbf{a}$$.

## Properties

Using the properties of spatial rotations which we noted earlier, this allows more intuitive results, such as the magnitude-squared of a vector:

\begin{aligned} \mathbf{a}^2 &= (r_a e^{-\mathbf{xy}\theta_a}\mathbf{x})(r_a e^{-\mathbf{x}\mathbf{y}\theta_a}\mathbf{x}) \\ &= r_a^2 e^{-\mathbf{xy}\theta_a} e^{\mathbf{xy}\theta_a}\mathbf{xx} \\ &= r_a^2 \end{aligned}

or the product of two vectors:

\begin{aligned} \mathbf{a}\mathbf{b} &= r_a r_b \mathbf{x}e^{\mathbf{x}\mathbf{y}\theta_a} \mathbf{x}e^{\mathbf{x}\mathbf{y}\theta_b} \\ &= r_a r_b \mathbf{x}^2 e^{-\mathbf{x}\mathbf{y}\theta_a} e^{\mathbf{x}\mathbf{y}\theta_b} \\ &= r_a r_b e^{\mathbf{x}\mathbf{y}(\theta_b -\theta_a)} \end{aligned}

This product of two vectors is now more intuitively recognised, without expanding, as a scale ($$r_a r_b$$) and rotation in the $$\mathbf{x}\mathbf{y}$$ plane by $$\theta_b - \theta_a$$ which we will apply in the next section.

This also makes other properties more intuitive, such as

\begin{aligned} \mathbf{ab} + \mathbf{ba} &= r_a r_b e^{\mathbf{x}\mathbf{y}(\theta_b -\theta_a)} + r_a r_b e^{\mathbf{x}\mathbf{y}(\theta_a -\theta_b)} \\ &= r_a r_b (e^{\mathbf{x}\mathbf{y}(\theta_b -\theta_a)} + e^{-\mathbf{x}\mathbf{y}(\theta_b -\theta_a)}) \\ &= 2 r_a r_b \cos (\theta_b - \theta_a) \end{aligned}

and

\begin{aligned} \mathbf{ab} - \mathbf{ba} &= r_a r_b e^{\mathbf{x}\mathbf{y}(\theta_b -\theta_a)} - r_a r_b e^{\mathbf{x}\mathbf{y}(\theta_a -\theta_b)} \\ &= r_a r_b (e^{\mathbf{x}\mathbf{y}(\theta_b -\theta_a)} - e^{-\mathbf{x}\mathbf{y}(\theta_b -\theta_a)}) \\ &= 2 r_a r_b \sin (\theta_b - \theta_a) \end{aligned}

which in turn allows a very simple derivation of the cosine rule for the magnitude of the third side of an arbitrary triangle given two sides:

\begin{aligned} (\mathbf{a} + \mathbf{b})^2 &= \mathbf{a}^2 + \mathbf{ab} + \mathbf{ba} + \mathbf{b}^2 \\ &= r_a^2 + r_b^2 + 2r_a r_b \cos(\theta_b - \theta_a) \\ &= r_a^2 + r_b^2 - 2r_a r_b \cos(\pi -(\theta_b - \theta_a)) \end{aligned}

## Rotating a vector in two dimensions

With this definition of arbitrary vectors, it is much easier to see that the product of two vectors defines a scale and rotation, which can be applied to a third vector:

\begin{aligned} \mathbf{abc} &= r_a\mathbf{x}e^{\mathbf{xy}\theta_a}r_b\mathbf{x}e^{\mathbf{xy}\theta_b}\mathbf{c} \\ &= r_a r_b e^{-\mathbf{xy}\theta_a}e^{\mathbf{xy}\theta_b}\mathbf{c} \\ &= r_a r_b e^{\mathbf{xy}(\theta_b - \theta_a)}\mathbf{c} \end{aligned}

We can see this is in fact a scale and rotation if we also expand $$\mathbf{c}$$

\begin{aligned} \mathbf{abc} &= r_a r_b e^{\mathbf{xy}(\theta_b - \theta_a)}r_c\mathbf{x}e^{\mathbf{xy}\theta_c} \\ &= r_a r_b r_c \mathbf{x}e^{\mathbf{xy}(\theta_c - (\theta_b - \theta_a))} \end{aligned}

showing that $$\mathbf{c}$$ is scaled by a factor of $$r_a r_b$$ and rotated by an amount $$\theta_b - \theta_a$$.

This can also be viewed as the vector $$\mathbf{a}$$ being scaled by an amount $$r_b r_c$$ and rotated by an amount $$\theta_b - \theta_c$$, as we can rearrange the above to the equivalent:

$\mathbf{abc} = r_a r_b r_c \mathbf{x}e^{\mathbf{xy}(\theta_a - (\theta_b - \theta_c))}$

So we can represent a vector in two dimensional space. We can add, scale and rotate such vectors. But is there a way to inherently represent a vector in space-time?