Linear Algebra

4.9 Basic Matrix Transformations in \(R^{2}\) and \(R^{3}\)

Imron Rosyadi

Basic Matrix Transformations in \(R^{2}\) and \(R^{3}\)

Overview of Transformations

This lecture explores fundamental matrix transformations in \(R^{2}\) and \(R^{3}\).
These transformations have simple geometric interpretations.
They are crucial in fields like computer graphics, engineering, and physics.
We will cover reflections, projections, rotations, dilations, contractions, expansions, compressions, and shears.

Reflection Operators

Reflection operators map each point to its symmetric image about a fixed line or plane through the origin.
These are fundamental in geometry and computer graphics.

Note

Remember that these reflections are about lines or planes that contain the origin.
This ensures they are linear transformations.

Reflection Operators in \(R^{2}\)

Here are the standard matrices for reflections about coordinate axes and the line \(y=x\) in \(R^{2}\).

Reflection about the x-axis
\(T(x,y) = (x,-y)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}1 & 0 \\ 0 & -1 \end{array} \right] \]

Reflection about the y-axis
\(T(x,y) = (-x,y)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}-1 & 0 \\ 0 & 1 \end{array} \right] \]

Reflection about the line \(y=x\)
\(T(x,y) = (y,x)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}0 & 1 \\ 1 & 0 \end{array} \right] \]

Interactive \(R^{2}\) Reflection

Visualize how a point is reflected across different lines in \(R^{2}\).
Adjust the coordinates of the point and observe its reflection.

Reflection Operators in \(R^{3}\)

Reflections in \(R^{3}\) occur about coordinate planes.

Reflection about the \(xy\)-plane
\(T(x,y,z) = (x,y,-z)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \end{array} \right] \]

Reflection about the \(xz\)-plane
\(T(x,y,z) = (x,-y,z)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{array} \right] \]

Reflection about the \(yz\)-plane
\(T(x,y,z) = (-x,y,z)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}-1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] \]

Projection Operators

Projection operators map each point to its orthogonal projection onto a fixed line or plane through the origin. These are also called orthogonal projection operators.

Important

Orthogonal projection means the projected point is the closest point on the line/plane to the original point. The line segment connecting the original point and its projection is perpendicular to the line/plane.

Projection Operators in \(R^{2}\)

Standard matrices for orthogonal projections onto coordinate axes in \(R^{2}\).

Orthogonal projection onto the x-axis
\(T(x,y)=(x,0)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}1 & 0 \\ 0 & 0 \end{array} \right] \]

Orthogonal projection onto the y-axis
\(T(x,y)=(0,y)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}0 & 0 \\ 0 & 1 \end{array} \right] \]

Interactive \(R^{2}\) Projection

Visualize how a point is projected onto different lines in \(R^{2}\).
Adjust the point and observe its projection.

Projection Operators in \(R^{3}\)

Standard matrices for orthogonal projections onto coordinate planes in \(R^{3}\).

Orthogonal projection onto the \(xy\)-plane
\(T(x,y,z) = (x,y,0)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{array} \right] \]

Orthogonal projection onto the \(xz\)-plane
\(T(x,y,z) = (x,0,z)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{array} \right] \]

Orthogonal projection onto the \(yz\)-plane
\(T(x,y,z) = (0,y,z)\)
Standard Matrix:
\[ \left[ \begin{array}{ccc}0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array} \right] \]

Rotation Operators

Rotation operators move points along arcs of circles centered at the origin.
We focus on counterclockwise rotations for positive angles \(\theta\).

Rotation in \(R^{2}\)

The images of the standard basis vectors \(\mathbf{e}_{1}=(1,0)\) and \(\mathbf{e}_{2}=(0,1)\) are:
\(T(\mathbf{e}_{1}) = (\cos \theta ,\sin \theta)\)
\(T(\mathbf{e}_{2}) = (-\sin \theta ,\cos \theta)\)

This gives the standard rotation matrix \(R_{\theta}\): \[ R_{\theta} = \left[ \begin{array}{cc}\cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{array} \right] \tag{1} \]

Visualizing \(R^{2}\) Rotation

Let’s visualize the transformation of basis vectors.

graph LR
    subgraph "Original Basis"
        e1_orig["e1 $$(1,0)$$"]
        e2_orig["e2 $$(0,1)$$"]
    end

    subgraph "Rotation Matrix"
        R_theta["$$R_{\theta}$$"]
    end

    subgraph "Rotated Basis"
        e1_rot["T(e1) $$(\cos\theta, \sin\theta)$$"]
        e2_rot["T(e2) $$(-\sin\theta, \cos\theta)$$"]
    end

    e1_orig --> R_theta
    e2_orig --> R_theta
    R_theta --> e1_rot
    R_theta --> e2_rot

    style e1_orig fill:#fff,stroke:#333,stroke-width:2px,color:#333
    style e2_orig fill:#fff,stroke:#333,stroke-width:2px,color:#333
    style e1_rot fill:#f9f,stroke:#333,stroke-width:2px,color:#333
    style e2_rot fill:#f9f,stroke:#333,stroke-width:2px,color:#333
    style R_theta fill:#ccf,stroke:#333,stroke-width:2px,color:#333

Rotation Equations for \(R^{2}\)

If \(\mathbf{x} = (x,y)\) is a vector in \(R^{2}\), and \(\mathbf{w} = (w_{1},w_{2})\) is its image, then \(\mathbf{w} = R_{\theta}\mathbf{x}\) gives: \[ \begin{array}{l}w_{1} = x\cos \theta -y\sin \theta \\ w_{2} = x\sin \theta +y\cos \theta \end{array} \tag{2} \]

These are the rotation equations for \(R^{2}\).

Tip

For clockwise rotations, replace \(\theta\) with \(-\theta\) in the matrix. Since \(\cos(-\theta) = \cos\theta\) and \(\sin(-\theta) = -\sin\theta\), the matrix becomes: \[ R_{-\theta} = \left[ \begin{array}{cc}\cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{array} \right] \]

Example 1: A Rotation Operator

Find the image of \(\mathbf{x} = (1,1)\) under a rotation of \(\pi /6\) radians (\(30^{\circ}\)) about the origin.

Interactive \(R^{2}\) Rotation

Rotate a shape (unit square) in \(R^{2}\) by varying the angle.

Rotations in \(R^{3}\)

Rotations in \(R^{3}\) are described relative to an axis of rotation and a unit vector \(\mathbf{u}\) along that line. The right-hand rule determines the sign of the angle.

For coordinate axes, positive angles are counterclockwise when looking towards the origin along the positive axis.

Standard Matrices for \(R^{3}\) Rotations

About the positive x-axis \[ \left[ \begin{array}{ccc}1 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta \\ 0 & \sin\theta & \cos\theta \end{array} \right] \]

About the positive y-axis \[ \left[ \begin{array}{ccc}\cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{array} \right] \]

About the positive z-axis \[ \left[ \begin{array}{ccc}\cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{array} \right] \]

Yaw, Pitch, and Roll

These angles describe the orientation of an aircraft or space shuttle relative to an \(xyz\)-coordinate system.

  • Yaw: Rotation about the \(z\)-axis (side-to-side).
  • Pitch: Rotation about the \(x\)-axis (nose up/down).
  • Roll: Rotation about the \(y\)-axis (wing up/down).

A combination of these can be achieved by a single rotation about some axis through the origin.

General \(R^{3}\) Rotation

For completeness, the standard matrix for a counterclockwise rotation through an angle \(\theta\) about an axis determined by an arbitrary unit vector \(\mathbf{u} = (a, b, c)\) is:

\[ \left[ \begin{array}{llll}a^2 (1 - \cos \theta) + \cos \theta & ab(1 - \cos \theta) - c\sin \theta & ac(1 - \cos \theta) + b\sin \theta \\ ab(1 - \cos \theta) + c\sin \theta & b^2 (1 - \cos \theta) + \cos \theta & bc(1 - \cos \theta) - a\sin \theta \\ ac(1 - \cos \theta) - b\sin \theta & bc(1 - \cos \theta) + a\sin \theta & c^2 (1 - \cos \theta) + \cos \theta \end{array} \right] \tag{3} \]

Note

You can derive the axis-specific rotation matrices (Table 6) as special cases of this general formula by setting \(a,b,c\) to \((1,0,0)\), \((0,1,0)\), or \((0,0,1)\) respectively.

Dilations and Contractions

These operators scale the length of vectors. \(T(\mathbf{x}) = k\mathbf{x}\) for a nonnegative scalar \(k\).

  • Contraction: If \(0 \leq k < 1\), the operator shrinks vectors.
  • Dilation: If \(k > 1\), the operator stretches vectors.

Figure 4.9.3 (a) \(0 \leq k < 1\) (b) \(k > 1\)

If \(k=1\), it’s the identity operator.

Dilations and Contractions in \(R^{2}\)

Standard matrix for dilations/contractions in \(R^{2}\): \[ \left[ \begin{array}{cc}k & 0 \\ 0 & k \end{array} \right] \]

Dilations and Contractions in \(R^{2}\)

Interactive \(R^{2}\) Scaling

Scale a shape (unit square) in \(R^{2}\) by varying the factor \(k\).

Dilations and Contractions in \(R^{3}\)

Standard matrix for dilations/contractions in \(R^{3}\): \[ \left[ \begin{array}{ccc}k & 0 & 0 \\ 0 & k & 0 \\ 0 & 0 & k \end{array} \right] \]

Expansions and Compressions

These operators scale only one coordinate by a factor \(k\). - Compression: \(0 \leq k < 1\). - Expansion: \(k > 1\).

Compression/Expansion in x-direction \(T(x,y) = (kx,y)\) Standard Matrix: \[ \left[ \begin{array}{cc}k & 0 \\ 0 & 1 \end{array} \right] \]

Compression/Expansion in y-direction \(T(x,y) = (x,ky)\) Standard Matrix: \[ \left[ \begin{array}{cc}1 & 0 \\ 0 & k \end{array} \right] \]

Interactive \(R^{2}\) Expansion/Compression

Scale a shape (unit square) along a specific axis in \(R^{2}\).

Shears

A shear transformation shifts points parallel to one axis, proportional to their distance from that axis.

Shear in the x-direction by factor \(k\)
\(T(x,y) = (x+ky,y)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}1 & k \\ 0 & 1 \end{array} \right] \]

Shear in the y-direction by factor \(k\)
\(T(x,y) = (x,y+kx)\)
Standard Matrix:
\[ \left[ \begin{array}{cc}1 & 0 \\ k & 1 \end{array} \right] \]

Tip

A shear leaves points on the axis of the shear fixed. For an x-shear, points on the x-axis (\(y=0\)) remain unchanged. For a y-shear, points on the y-axis (\(x=0\)) remain unchanged.

Example 2: Effect of Matrix Operators on the Unit Square

Describe the matrix operator and show its effect on the unit square.

Matrix \(A_{1}\) \[ A_{1}={\left[\begin{array}{l l}{1}&{2}\\ {0}&{1}\end{array}\right]} \] This is a shear in the x-direction by a factor 2.

Matrix \(A_{2}\) \[ A_{2}={\left[\begin{array}{l l}{1}&{-2}\\ {0}&{1}\end{array}\right]} \] This is a shear in the x-direction by a factor -2.

Matrix \(A_{3}\) \[ A_{3}={\left[\begin{array}{l l}{2}&{0}\\ {0}&{2}\end{array}\right]} \] This is a dilation with factor 2.

Matrix \(A_{4}\) \[ A_{4}={\left[\begin{array}{l l}{2}&{0}\\ {0}&{1}\end{array}\right]} \] This is an expansion in the x-direction with factor 2.

Interactive \(R^{2}\) Shear

Apply a shear transformation to a unit square.

Orthogonal Projection onto a Line Through the Origin

The standard matrix \(P_{\theta}\) for orthogonal projection onto a line \(L\) through the origin, making an angle \(\theta\) with the positive \(x\)-axis, is:

\[ P_{\theta} = \left[ \begin{array}{cc}\cos^{2}\theta & \sin \theta \cos \theta \\ \sin \theta \cos \theta & \sin^{2}\theta \end{array} \right] = \left[ \begin{array}{cc}\cos^{2}\theta & \frac{1}{2}\sin 2\theta \\ \frac{1}{2}\sin 2\theta & \sin^{2}\theta \end{array} \right] \tag{4} \]

Figure 4.9.5

Example 3: Orthogonal Projection onto a Line

Find the orthogonal projection of \(\mathbf{x} = (1,5)\) onto the line through the origin that makes an angle of \(\pi /6\) (\(30^{\circ}\)) with the positive \(x\)-axis.

Reflections About Lines Through the Origin

The operator \(H_{\theta}:R^{2} \to R^{2}\) maps each point into its reflection about a line \(L\) through the origin that makes an angle \(\theta\) with the positive \(x\)-axis.

Figure 4.9.6

The standard matrix for \(H_{\theta}\) can be derived from the projection matrix \(P_{\theta}\): \(H_{\theta} = 2P_{\theta} - I\)

This leads to: \[ H_{\theta} = \left[ \begin{array}{cc}\cos 2\theta & \sin 2\theta \\ \sin 2\theta & -\cos 2\theta \end{array} \right] \tag{6} \]

Example 4: Reflection About a Line

Find the reflection of the vector \(\mathbf{x} = (1,5)\) about the line through the origin that makes an angle of \(\pi /6\) (\(30^{\circ}\)) with the \(x\)-axis.

Key Takeaways

  • Reflections: Mirror images across lines/planes.
  • Projections: “Shadows” onto lines/planes.
  • Rotations: Circular movement around an origin/axis.
    • Crucial for ECE applications like Yaw, Pitch, Roll.
  • Dilations/Contractions: Uniform scaling of objects.
  • Expansions/Compressions: Non-uniform scaling along specific axes.
  • Shears: Tilting or slanting objects.

Each transformation has a unique standard matrix. Understanding these matrices is fundamental to linear algebra and its applications.