Transformations in a Plane Transformations are operations that move or change a geometric figure. In a 2D plane, common transformations include rotation, translation, and reflection. These can be represented using matrices. Rotation Rotating points around an origin or a fixed point. A point $(x, y)$ rotated counterclockwise by an angle $\theta$ about the origin transforms to $(x', y')$: $$ \begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} $$ 90° Counterclockwise Rotation: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$ 180° Rotation: $\begin{pmatrix} -1 & 0 \\ 0 & -1 \end{pmatrix}$ 270° Counterclockwise Rotation (or 90° Clockwise): $\begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}$ Translation Shifting points by adding a constant vector. A point $(x, y)$ translated by a vector $\vec{v} = (v_x, v_y)$ transforms to $(x', y')$: $$ \begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix} + \begin{pmatrix} v_x \\ v_y \end{pmatrix} $$ In homogeneous coordinates, translation can be represented by a matrix: $$ \begin{pmatrix} x' \\ y' \\ 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & v_x \\ 0 & 1 & v_y \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x \\ y \\ 1 \end{pmatrix} $$ Reflection Mirroring points across a line. Across x-axis: $(x, y) \to (x, -y)$. Matrix: $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$ Across y-axis: $(x, y) \to (-x, y)$. Matrix: $\begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix}$ Across line $y=x$: $(x, y) \to (y, x)$. Matrix: $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$ Across line $y=-x$: $(x, y) \to (-y, -x)$. Matrix: $\begin{pmatrix} 0 & -1 \\ -1 & 0 \end{pmatrix}$ Across horizontal line $y=k$: $(x, y) \to (x, 2k-y)$ Across vertical line $x=h$: $(x, y) \to (2h-x, y)$ Practice Questions - Transformations Problem 1: Composite Transformation Given a point $P(2, 3)$ in the plane, perform the following transformations: Rotate $P$ by $90^\circ$ counterclockwise about the origin. Translate the rotated point by $\vec{v} = 3\vec{i} - 2\vec{j}$. Reflect the translated point across the line $y=x$. Solution: Rotation: $P(2,3)$ rotated by $90^\circ$ CCW. $$ \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 2 \\ 3 \end{pmatrix} = \begin{pmatrix} -3 \\ 2 \end{pmatrix} $$ Rotated point: $(-3, 2)$. Translation: $(-3, 2)$ translated by $\vec{v} = (3, -2)$. $$ \begin{pmatrix} -3 \\ 2 \end{pmatrix} + \begin{pmatrix} 3 \\ -2 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \end{pmatrix} $$ Translated point: $(0, 0)$. Reflection: $(0, 0)$ reflected across $y=x$. The reflection of $(x, y)$ across $y=x$ is $(y, x)$. Since the point is $(0,0)$, it remains $(0,0)$. Answer: The final point is $(0,0)$. Problem 2: Rotation of a Triangle Rotate the vertices of a triangle $A(1, 2)$, $B(3, 4)$, and $C(-1, 1)$ by $90^\circ$ counterclockwise about the origin. Solution: The rotation matrix for $90^\circ$ counterclockwise is $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$. For vertex $A(1, 2)$: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 1 \\ 2 \end{pmatrix} = \begin{pmatrix} -2 \\ 1 \end{pmatrix}$. So, $A'(-2, 1)$. For vertex $B(3, 4)$: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 3 \\ 4 \end{pmatrix} = \begin{pmatrix} -4 \\ 3 \end{pmatrix}$. So, $B'(-4, 3)$. For vertex $C(-1, 1)$: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} -1 \\ 1 \end{pmatrix} = \begin{pmatrix} -1 \\ -1 \end{pmatrix}$. So, $C'(-1, -1)$. Answer: The rotated vertices are $A'(-2, 1)$, $B'(-4, 3)$, $C'(-1, -1)$. Problem 3: Finding Rotation Angle Find the angle of rotation if the point $P(5,0)$ is rotated to $Q(0, -5)$ about the origin. Solution: For a point $(x, y)$ rotated by $\theta$ counterclockwise, the new coordinates are $(x \cos \theta - y \sin \theta, x \sin \theta + y \cos \theta)$. For $P(5,0)$ rotated to $Q(0, -5)$: $x' = 5 \cos \theta - 0 \sin \theta = 5 \cos \theta = 0 \implies \cos \theta = 0$ $y' = 5 \sin \theta + 0 \cos \theta = 5 \sin \theta = -5 \implies \sin \theta = -1$ Both conditions $\cos \theta = 0$ and $\sin \theta = -1$ are satisfied by $\theta = 270^\circ$ (or $-90^\circ$). Answer: The angle of rotation is $270^\circ$ counterclockwise (or $90^\circ$ clockwise). Problem 4: Reflection Across a Line Find the reflection of the point $(3,5)$ across the line $y=2$. Solution: To reflect a point $(x,y)$ across a horizontal line $y=k$, the new point is $(x, 2k-y)$. Given $P(3,5)$ and $k=2$, the reflection is $(3, 2(2)-5) = (3, 4-5) = (3, -1)$. Answer: Reflection: $(3, -1)$. Quaternions Quaternions are an extension of complex numbers to four dimensions, often used to represent 3D rotations in computer graphics and robotics. A quaternion $q$ is expressed as: $$ q = a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k} $$ where $a, b, c, d$ are real numbers, and $\mathbf{i}, \mathbf{j}, \mathbf{k}$ are fundamental quaternion units with the following multiplication rules: $$ \mathbf{i}^2 = \mathbf{j}^2 = \mathbf{k}^2 = \mathbf{ijk} = -1 $$ $$ \mathbf{ij} = \mathbf{k}, \quad \mathbf{jk} = \mathbf{i}, \quad \mathbf{ki} = \mathbf{j} $$ $$ \mathbf{ji} = -\mathbf{k}, \quad \mathbf{kj} = -\mathbf{i}, \quad \mathbf{ik} = -\mathbf{j} $$ Quaternion Arithmetic Addition: Quaternions are added component-wise. If $q_1 = a_1 + b_1\mathbf{i} + c_1\mathbf{j} + d_1\mathbf{k}$ and $q_2 = a_2 + b_2\mathbf{i} + c_2\mathbf{j} + d_2\mathbf{k}$, then $$ q_1 + q_2 = (a_1+a_2) + (b_1+b_2)\mathbf{i} + (c_1+c_2)\mathbf{j} + (d_1+d_2)\mathbf{k} $$ Multiplication: The product $q_1 q_2$ is: $$ q_1 q_2 = (a_1 a_2 - b_1 b_2 - c_1 c_2 - d_1 d_2) \\ + (a_1 b_2 + b_1 a_2 + c_1 d_2 - d_1 c_2)\mathbf{i} \\ + (a_1 c_2 - b_1 d_2 + c_1 a_2 + d_1 b_2)\mathbf{j} \\ + (a_1 d_2 + b_1 c_2 - c_1 b_2 + d_1 a_2)\mathbf{k} $$ Conjugate: The conjugate of $q = a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}$ is: $$ q^* = a - b\mathbf{i} - c\mathbf{j} - d\mathbf{k} $$ Norm (Magnitude): The norm of $q$ is: $$ |q| = \sqrt{a^2 + b^2 + c^2 + d^2} $$ A quaternion is a unit quaternion if $|q|=1$. Inverse: The inverse of a non-zero quaternion $q$ is: $$ q^{-1} = \frac{q^*}{|q|^2} $$ Matrix Representation (2x2 Complex Matrix): $$ q = \begin{pmatrix} a+b\mathbf{i} & c+d\mathbf{i} \\ -c+d\mathbf{i} & a-b\mathbf{i} \end{pmatrix} $$ Matrix Representation (4x4 Real Matrix - Left Multiplication): If $q = a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}$ and $v = x\mathbf{i} + y\mathbf{j} + z\mathbf{k}$ (a pure quaternion representing a vector), then $qv$ can be represented as $L_q V$, where $V$ is a column vector $(0, x, y, z)^T$ and $$ L_q = \begin{pmatrix} a & -b & -c & -d \\ b & a & -d & c \\ c & d & a & -b \\ d & -c & b & a \end{pmatrix} $$ Quaternion Rotation A rotation of an angle $\theta$ about an axis defined by the unit vector $\mathbf{u} = (u_x, u_y, u_z)$ can be represented by a unit quaternion $q_{rot}$: $$ q_{rot} = \cos\left(\frac{\theta}{2}\right) + \sin\left(\frac{\theta}{2}\right)(u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) $$ To rotate a 3D vector $\vec{v} = (x, y, z)$ (represented as a pure quaternion $p = x\mathbf{i} + y\mathbf{j} + z\mathbf{k}$), the rotated vector $p'$ is given by: $$ p' = q_{rot} p q_{rot}^{-1} $$ For a unit quaternion, $q_{rot}^{-1} = q_{rot}^*$. So, $p' = q_{rot} p q_{rot}^*$. Practice Questions - Quaternions Problem 1: Quaternion Multiplication Compute the product of the quaternions $q_1 = 1 + 2\mathbf{i} + 3\mathbf{j} + 4\mathbf{k}$ and $q_2 = 5 + 6\mathbf{i} + 7\mathbf{j} + 8\mathbf{k}$. Solution: Using the multiplication formula: $$ q_1 q_2 = (1 \cdot 5 - 2 \cdot 6 - 3 \cdot 7 - 4 \cdot 8) \\ + (1 \cdot 6 + 2 \cdot 5 + 3 \cdot 8 - 4 \cdot 7)\mathbf{i} \\ + (1 \cdot 7 - 2 \cdot 8 + 3 \cdot 5 + 4 \cdot 6)\mathbf{j} \\ + (1 \cdot 8 + 2 \cdot 7 - 3 \cdot 6 + 4 \cdot 5)\mathbf{k} $$ $$ q_1 q_2 = (5 - 12 - 21 - 32) + (6 + 10 + 24 - 28)\mathbf{i} + (7 - 16 + 15 + 24)\mathbf{j} + (8 + 14 - 18 + 20)\mathbf{k} $$ $$ q_1 q_2 = -60 + 12\mathbf{i} + 30\mathbf{j} + 24\mathbf{k} $$ Answer: $q_1 q_2 = -60 + 12\mathbf{i} + 30\mathbf{j} + 24\mathbf{k}$. Problem 2: Conjugate, Norm, and Inverse Given the quaternion $q = 3 - 4\mathbf{i} + 2\mathbf{j} + \mathbf{k}$, find its conjugate, norm, and inverse. Solution: Conjugate: $q^* = 3 + 4\mathbf{i} - 2\mathbf{j} - \mathbf{k}$ Norm: $|q| = \sqrt{3^2 + (-4)^2 + 2^2 + 1^2} = \sqrt{9 + 16 + 4 + 1} = \sqrt{30}$ Inverse: $q^{-1} = \frac{q^*}{|q|^2} = \frac{3 + 4\mathbf{i} - 2\mathbf{j} - \mathbf{k}}{30} = \frac{3}{30} + \frac{4}{30}\mathbf{i} - \frac{2}{30}\mathbf{j} - \frac{1}{30}\mathbf{k} = \frac{1}{10} + \frac{2}{15}\mathbf{i} - \frac{1}{15}\mathbf{j} - \frac{1}{30}\mathbf{k}$ Answer: $q^* = 3 + 4\mathbf{i} - 2\mathbf{j} - \mathbf{k}$, $|q| = \sqrt{30}$, $q^{-1} = \frac{1}{10} + \frac{2}{15}\mathbf{i} - \frac{1}{15}\mathbf{j} - \frac{1}{30}\mathbf{k}$. Problem 3: Quaternion as a Rotation A rotation of $90^\circ$ about the z-axis can be represented by the quaternion $q = \cos(\frac{\pi}{4}) + \sin(\frac{\pi}{4})\mathbf{k}$. Find the quaternion representing this rotation and apply it to the point $P(1,0,0)$. Solution: Quaternion for Rotation: For $\theta = 90^\circ = \frac{\pi}{2}$, $\frac{\theta}{2} = \frac{\pi}{4}$. Since it's about the z-axis, $\mathbf{u} = (0,0,1)$. $q_{rot} = \cos(\frac{\pi}{4}) + \sin(\frac{\pi}{4})\mathbf{k} = \frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}\mathbf{k}$. Conjugate of $q_{rot}$: $q_{rot}^* = \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}\mathbf{k}$. (Since $|q_{rot}|=1$, $q_{rot}^{-1} = q_{rot}^*$). Point as pure quaternion: $p = 1\mathbf{i} + 0\mathbf{j} + 0\mathbf{k} = \mathbf{i}$. Applying the rotation: $p' = q_{rot} p q_{rot}^*$. First, calculate $q_{rot} p$: $$ \left(\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}\mathbf{k}\right) \mathbf{i} = \frac{\sqrt{2}}{2}\mathbf{i} + \frac{\sqrt{2}}{2}\mathbf{ki} $$ Since $\mathbf{ki} = \mathbf{j}$: $$ \frac{\sqrt{2}}{2}\mathbf{i} + \frac{\sqrt{2}}{2}\mathbf{j} $$ Now, multiply by $q_{rot}^*$: $$ \left(\frac{\sqrt{2}}{2}\mathbf{i} + \frac{\sqrt{2}}{2}\mathbf{j}\right) \left(\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}\mathbf{k}\right) $$ $$ = \frac{\sqrt{2}}{2}\mathbf{i}\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}\mathbf{i}\frac{\sqrt{2}}{2}\mathbf{k} + \frac{\sqrt{2}}{2}\mathbf{j}\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}\mathbf{j}\frac{\sqrt{2}}{2}\mathbf{k} $$ $$ = \frac{1}{2}\mathbf{i} - \frac{1}{2}\mathbf{ik} + \frac{1}{2}\mathbf{j} - \frac{1}{2}\mathbf{jk} $$ Since $\mathbf{ik} = -\mathbf{j}$ and $\mathbf{jk} = \mathbf{i}$: $$ = \frac{1}{2}\mathbf{i} - \frac{1}{2}(-\mathbf{j}) + \frac{1}{2}\mathbf{j} - \frac{1}{2}\mathbf{i} $$ $$ = \frac{1}{2}\mathbf{i} + \frac{1}{2}\mathbf{j} + \frac{1}{2}\mathbf{j} - \frac{1}{2}\mathbf{i} = \mathbf{j} $$ Answer: The rotated point is $(0,1,0)$. Problem 4: Unit Quaternion Check Determine whether the quaternion $q = 0 + 0\mathbf{i} + 1\mathbf{j} + 0\mathbf{k}$ is a unit quaternion. Solution: Calculate the norm: $$ |q| = \sqrt{0^2 + 0^2 + 1^2 + 0^2} = \sqrt{1} = 1 $$ Since $|q|=1$, $q$ is a unit quaternion. Answer: Yes, it is a unit quaternion.