6.3. Rotation, reflection and scaling#

Three of the most common geometrical linear transformations is rotation of vectors about the origin, reflection of vectors about a line and translation of vectors from one position to another.

6.3.1. Rotation#

Definition 6.6 (Rotation transformation)

The linear transformation \(Rot(\theta): \mathbb{R}^2 \to \mathbb{R}^2\) applied to the vector \(\vec{u}\) rotates \(\vec{u}\) by an angle \(\theta\) anti-clockwise about the origin.

../_images/6_rotation.svg

Fig. 6.2 Rotation of the vector \(\vec{u}\) anti-clockwise about the origin.#

Consider the diagram in Fig. 6.2. Here we have the vector \(\vec{u}\) which is rotated by angle \(\theta\) anti-clockwise about the origin to give the vector \(\vec{v}\). To determine the linear mapping \(Rot(\theta): \vec{u} \mapsto \vec{v}\) we first consider the rotation from the vector \(\vec{e}_1|\vec{u}|\), which points along the \(x\)-axis and has the same magnitude as \(\vec{u}\), by angle \(\phi\) anti-clockwise about the original to \(\vec{u}=(u_x, u_y)^\mathsf{T}\). Forming a right-angled triangle (the blue triangle) with the angle \(\phi\) and hypotenuse of length \(|\vec{u}|\) then

(6.6)#\[\begin{split} \begin{align*} \cos(\phi) &= \frac{u_x}{|\vec{u}|} & \therefore u_x &= |\vec{u}| \cos(\phi), \\ \sin(\phi) &= \frac{u_y}{|\vec{u}|} & \therefore u_y &= |\vec{u}| \sin(\phi). \end{align*} \end{split}\]

Doing similar for \(\vec{v} = (v_x, v_y)^\mathsf{T}\) (the red triangle) we have

\[\begin{split} \begin{align*} v_x &= |\vec{u}| \cos(\phi + \theta), \\ v_y &= |\vec{u}| \sin(\phi + \theta), \end{align*} \end{split}\]

using the angle sum identities

\[\begin{split} \begin{align*} \cos(\phi + \theta) &= \cos(\phi) \cos(\theta) - \sin(\phi) \sin(\theta), \\ \sin(\phi + \theta) &= \sin(\phi) \cos(\theta) + \cos(\phi) \sin(\theta), \end{align*} \end{split}\]

then

(6.7)#\[\begin{split} \begin{align*} v_x &= |\vec{u}| \cos(\phi) \cos(\theta) - |\vec{u}|\sin(\phi) \sin(\theta) \\ v_y &= |\vec{u}| \sin(\phi) \cos(\theta) + |\vec{u}|\cos(\phi) \sin(\theta). \end{align*} \end{split}\]

Substituting equation (6.6) into equation (6.7)

\[\begin{split} \begin{align*} v_x &= u_x \cos(\theta) - u_y \sin(\theta), \\ v_y &= u_y \cos(\theta) + u_x \sin(\theta). \end{align*} \end{split}\]

Therefore the vector \(\vec{u}\) rotated by angle \(\theta\) anti-clockwise about the original is

\[\begin{split} Rot(\theta) \cdot \vec{u} = \begin{pmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{pmatrix} \begin{pmatrix} u_x \\ u_y \end{pmatrix} = \begin{pmatrix} u_x \cos(\theta) - u_y \sin(\theta) \\ u_x \sin(\theta) + u_y \cos(\theta) \end{pmatrix} \end{split}\]

Theorem 6.3 (Rotation in \(\mathbb{R}^2\))

The rotation of a vector \(\vec{u} = (u_x, u_y)^\mathsf{T} \in \mathbb{R}^2\) anti-clockwise by an angle \(\theta\) is the linear transformation \(Rot(\theta): \mathbb{R}^2 \to \mathbb{R}^2\) defined by

\[\begin{split} Rot(\theta) : \begin{pmatrix} u_x \\ u_y \end{pmatrix} \mapsto \begin{pmatrix} u_x \cos(\theta) - u_y \sin(\theta) \\ u_x \sin(\theta) + u_y \cos(\theta) \end{pmatrix}. \end{split}\]

The transformation matrix for rotation in \(\mathbb{R}^2\) is

(6.8)#\[\begin{split} Rot(\theta) = \begin{pmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{pmatrix}. \end{split}\]

6.3.1.1. Inverse rotation transformation#

The inverse transformation of rotating a vector anti-clockwise by an angle \(\theta\) is rotating clockwise by the same angle. This can be achieved by negating \(\theta\), since \(\cos(-\theta) = \cos(\theta)\) and \(\sin(-\theta) = -\sin(\theta)\) then

\[\begin{split} Rot(\theta)^{-1} = \begin{pmatrix} \cos(-\theta) & -\sin(-\theta) \\ \sin(-\theta) & \cos(-\theta) \end{pmatrix} = \begin{pmatrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{pmatrix}. \end{split}\]

We could have also calculated the inverse of the rotation matrix to give the same result

\[\begin{split} \begin{align*} Rot(\theta)^{-1} &= \frac{1}{\cos^2(\theta) + \sin^2(\theta)} \begin{pmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{pmatrix}^\mathsf{T} = \begin{pmatrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{pmatrix}. \end{align*} \end{split}\]

Example 6.7

Rotate the vector \(\vec{u} = (2, 1)^\mathsf{T}\) by angle \(\theta = \frac{\pi}{2}\) anti-clockwise about the origin.

Solution

The transformation matrix for this rotation is

\[\begin{split} Rot \left( \frac{\pi}{2} \right) = \begin{pmatrix} \cos({\pi}/{2}) & -\sin({\pi}/{2}) \\ \sin({\pi}/{2}) & \cos({\pi}/{2}) \end{pmatrix} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}. \end{split}\]

Applying the transformation to \(\vec{u} = (2, 1)^\mathsf{T}\)

\[\begin{split} Rot\left( \frac{\pi}{2} \right) \cdot \vec{u} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 2 \\ 1 \end{pmatrix} = \begin{pmatrix} -1 \\ 2 \end{pmatrix}. \end{split}\]

This rotation is illustrated in the diagram below

../_images/6_rotation_example.svg

6.3.2. Reflection#

Definition 6.7 (Reflection about a line)

The linear transformation \(Re\!f(\theta): \mathbb{R}^2 \to \mathbb{R^2}\) is the reflection of a vector \(\vec{u} \in \mathbb{R}^2\) about the line which passes through the origin and makes an angle of \(\theta\) with the \(x\)-axis such that the distance of the head of the image vector \(\vec{v}\) is the same as that of \(\vec{u}\).

../_images/6_reflection.svg

Fig. 6.3 The reflection of the vector \(\vec{u}\) about a line that passes through the origin.#

The simplest reflection we can perform is to reflect a vector \(\vec{u} =(u_x, u_y)^\mathsf{T}\) about the \(x\)-axis or \(y\)-axis (Fig. 6.4).

../_images/6_reflection_about_x.svg

Fig. 6.4 Reflection of the vector \(\vec{u}\) about the \(x\) axis.#

To reflect about the \(x\)-axis we simply change the sign of the \(y\) co-ordinate

\[\begin{split} Re\!f(0) \cdot \vec{u} = \begin{pmatrix} u_x \\ -u_y \end{pmatrix}, \end{split}\]

and the transformation matrix is

(6.9)#\[\begin{split} Re\!f(0) = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}. \end{split}\]

Note that here the line of reflection makes an angle of \(\theta=0\) with the \(x\)-axis.

The determine the reflection about a line that makes and arbitrary angle \(\theta\) with the \(x\)-axis we first perform a rotation by \(-\theta\) so that the line of reflection is on the \(x\)-axis (Fig. 6.5). This means we can then use equation (6.9) to reflect the rotated \(\vec{u}\) vector to give the vector \(\vec{v}\) (Fig. 6.6) before rotating by \(\theta\) so that the line of reflection is back to its original position (Fig. 6.7).

../_images/6_reflection_about_line_1.svg

Fig. 6.5 Rotate by \(-\theta\).#

../_images/6_reflection_about_line_2.svg

Fig. 6.6 Reflect about the \(x\)-axis.#

../_images/6_reflection_about_line_3.svg

Fig. 6.7 Rotate by \(\theta\).#

Using composite transformations we can calculate the transformation matrix for reflection about a line

\[ Re\!f(\theta) = Rot(\theta) \cdot Re\!f(0) \cdot Rot(-\theta), \]

therefore

\[\begin{split} \begin{align*} Re\!f(\theta) &= \begin{pmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \begin{pmatrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{pmatrix} \\ &= \begin{pmatrix} \cos^2(\theta) - \sin^2(\theta) & 2\cos(\theta)\sin(\theta) \\ 2\cos(\theta)\sin(\theta) & \sin^2(\theta) - \cos^2(\theta) \end{pmatrix}. \end{align*} \end{split}\]

Using double angle formulae

\[\begin{split} \begin{align*} \cos(2\theta) &= \cos^2(\theta) - \sin^2(\theta), \\ \sin(2\theta) &= 2\cos(\theta) \sin(\theta), \end{align*} \end{split}\]

then

\[\begin{split} \begin{align*} Re\!f(\theta) &= \begin{pmatrix} \cos(2\theta) & \sin(2\theta) \\ \sin(2\theta) & -\cos(2\theta) \end{pmatrix}. \end{align*} \end{split}\]

Theorem 6.4 (Reflection in \(\mathbb{R}^2\))

The reflection of a vector \(\vec{u} = (u_x, u_y)^\mathsf{T} \in \mathbb{R}^2\) about a line which passes through the origin and makes an angle \(\theta\) with the \(x\)-axis (i.e., \(y = \tan(\theta)x\)) is the linear transformation \(Re\!f(\theta) : \mathbb{R}^2 \to \mathbb{R}^2\) defined by

\[\begin{split} \begin{align*} Re\!f(\theta) : \begin{pmatrix} u_x \\ u_y \end{pmatrix} \mapsto \begin{pmatrix} u_x \cos (2\theta) + u_y \sin(2 \theta) \\ u_x \sin(2\theta) - u_y \cos (2\theta) \end{pmatrix}. \end{align*} \end{split}\]

The transformation matrix for reflection in \(\mathbb{R}^2\) is

(6.10)#\[\begin{split} Re\!f(\theta) = \begin{pmatrix} \cos(2\theta) & \sin(2 \theta) \\ \sin(2\theta) & -\cos(2\theta) \end{pmatrix}. \end{split}\]

6.3.2.1. Inverse reflection transformation#

The inverse of reflecting about a line is to simply perform the reflection again, i.e.,

\[Re\!f^{-1}(\theta) = Re\!f(\theta).\]

Example 6.8

Reflect the vector \(\vec{u} = (3, -1)^\mathsf{T}\) about the line that passes through the origin and has gradient of 1.

Solution

Since the line of reflection has gradient 1 then \(\theta = \tan^{-1}(1) = \pi/4\) and the reflection matrix is

\[\begin{split} \begin{align*} Re\!f\left( \frac{\pi}{4} \right) = \begin{pmatrix} \cos(\pi/2) & \sin(\pi/2) \\ \sin(\pi/2) & -\cos(\pi/2) \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. \end{align*} \end{split}\]

Applying the transformation to \(\vec{u} = \begin{pmatrix} 3 \\ -1 \end{pmatrix}\)

\[\begin{split} \begin{align*} Re\!f\left(\frac{\pi}{4}\right) = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 3 \\ -1 \end{pmatrix} = \begin{pmatrix} -1 \\ 3 \end{pmatrix}. \end{align*} \end{split}\]
../_images/6_reflection_example.svg

6.3.3. Scaling#

Definition 6.8 (Scaling transformation)

The linear transformation \(S(\vec{s}) : \mathbb{R}^n \to \mathbb{R}^n\) where \(\vec{s} \in \mathbb{R}^n\) applied to the position vector \(\vec{u} \in \mathbb{R}^n\) scales \(\vec{u}\) so that the head is moved closer or further away from the origin.

../_images/6_scaling.svg

Fig. 6.8 The scaling of the vector \(\vec{u}\) by the scaling vector \(\vec{s}\).#

The scaling of a vector \(\vec{u} = (u_1, u_2, \ldots, u_n)^\mathsf{T} \in \mathbb{R}^n\) by a scaling vector \(\vec{s} = (s_1, s_2, \ldots, s_n)^\mathsf{T}\) is achieved by multiplying the corresponding elements in \(\vec{u}\) and \(\vec{s}\).

Theorem 6.5 (Scaling transformation)

The scaling of a vector \(\vec{u} \in \mathbb{R}^n\) by the scaling vector \(\vec{s}\) is the linear transformation \(S(\vec{s}): \vec{u} \mapsto \vec{v}\) calculated using

\[\begin{split} \begin{align*} S(\vec{s}): \begin{pmatrix} u_1 \\ u_2 \\ \vdots \\ u_n \end{pmatrix} \mapsto \begin{pmatrix} s_1 u_1 \\ s_2 u_2 \\ \vdots \\ s_n u_n \end{pmatrix}. \end{align*} \end{split}\]

The transformation matrix for scaling is

(6.11)#\[\begin{split} \begin{align*} S(\vec{s}) = \begin{pmatrix} s_1 & 0 & \cdots & 0 \\ 0 & s_2 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 0 \\ 0 & \cdots & 0 & s_n \end{pmatrix}. \end{align*} \end{split}\]

6.3.3.1. Inverse scaling transformation#

Since the inverse operation of scalar multiplication is scalar division then the inverse scaling matrix is

\[\begin{split} \begin{align*} S^{-1}(\vec{s}) = \begin{pmatrix} 1/s_1 & 0 & \cdots & 0 \\ 0 & 1/s_2 & \ddots & \vdots \\ \vdots & \ddots & \ddots & 0 \\ 0 & \cdots & 0 & 1/s_n \end{pmatrix}. \end{align*} \end{split}\]

Example 6.9

Scale the point with position vector \(\vec{u} = (2, 1)^\mathsf{T}\) by scaling scaling vector \(\vec{s} = (2, 3)^\mathsf{T}\).

Solution

The transformation matrix is

\[\begin{split} S\begin{pmatrix} 2 \\ 3 \end{pmatrix} = \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix}. \end{split}\]

Applying the transformation to \(\vec{u} = \begin{pmatrix} 2 \\ 1 \end{pmatrix}\)

\[\begin{split} S\begin{pmatrix} 2 \\ 3 \end{pmatrix} \cdot \vec{u} = \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix} \begin{pmatrix} 2 \\ 1 \end{pmatrix} = \begin{pmatrix} 4 \\ 3 \end{pmatrix}. \end{split}\]
../_images/6_scaling_example.svg