# Nakafa Framework: LLM

URL: /en/subject/high-school/11/mathematics/geometric-transformation/rotation-matrix
Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/high-school/11/mathematics/geometric-transformation/rotation-matrix/en.mdx

Output docs content for large language models.

---

import { getColor } from "@repo/design-system/lib/color";
import { LineEquation } from "@repo/design-system/components/contents/line-equation";

export const metadata = {
  title: "Rotation Matrix",
  description: "Learn rotation matrices for 2D transformations with derivation, formulas, and practical examples. Master rotations about origin and arbitrary points.",
  authors: [{ name: "Nabil Akbarazzima Fatih" }],
  date: "05/10/2025",
  subject: "Geometric Transformation",
};

## Finding the Rotation Matrix about the Origin

The image of a point <InlineMath math="(x,y)" /> rotated about the origin <InlineMath math="(0,0)" /> by an angle <InlineMath math="\theta" /> is <InlineMath math="(x \cos \theta - y \sin \theta, x \sin \theta + y \cos \theta)" />.

We want to find a <InlineMath math="2 \times 2" /> matrix, say <InlineMath math="\begin{pmatrix} r & s \\ t & u \end{pmatrix}" />, that represents this rotation transformation.

This matrix must satisfy:

<BlockMath math="\begin{pmatrix} r & s \\ t & u \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x \cos \theta - y \sin \theta \\ x \sin \theta + y \cos \theta \end{pmatrix}" />

From the matrix multiplication on the left side, we get:

<BlockMath math="\begin{pmatrix} rx + sy \\ tx + uy \end{pmatrix} = \begin{pmatrix} x \cos \theta - y \sin \theta \\ x \sin \theta + y \cos \theta \end{pmatrix}" />

By equating the corresponding components:

- First row: <InlineMath math="rx + sy = x \cos \theta - y \sin \theta" />.

  For this equation to hold for all <InlineMath math="x" /> and <InlineMath math="y" />, the coefficients of <InlineMath math="x" /> must be equal and the coefficients of <InlineMath math="y" /> must be equal. Thus, <InlineMath math="r = \cos \theta" /> and <InlineMath math="s = -\sin \theta" />.

- Second row: <InlineMath math="tx + uy = x \sin \theta + y \cos \theta" />.

  Similarly, <InlineMath math="t = \sin \theta" /> and <InlineMath math="u = \cos \theta" />.

### Rotation Matrix about the Origin

The matrix associated with a rotation by an angle <InlineMath math="\theta" /> radians (or degrees) about the origin <InlineMath math="O(0,0)" /> is:

<BlockMath math="R_\theta = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix}" />

## Matrix Operation for Rotation about an Arbitrary Point

To rotate a point <InlineMath math="(x,y)" /> about an arbitrary point <InlineMath math="P(a,b)" /> by an angle <InlineMath math="\theta" />, we perform three steps:

1. Translate the point <InlineMath math="(x,y)" /> so that <InlineMath math="P(a,b)" /> becomes the origin: <InlineMath math="(x-a, y-b)" />.
2. Rotate the translated point about the origin by <InlineMath math="\theta" /> using the matrix <InlineMath math="R_\theta" />.
3. Translate the rotated point back by adding <InlineMath math="(a,b)" />.

### Matrix Operation for Rotation about an Arbitrary Point

The operation associated with rotation by an angle <InlineMath math="\theta" /> radians about the point <InlineMath math="(a,b)" /> is:

<BlockMath math="\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{pmatrix} \begin{pmatrix} x-a \\ y-b \end{pmatrix} + \begin{pmatrix} a \\ b \end{pmatrix}" />

## Finding a Specific Rotation Matrix

The matrix associated with a rotation by <InlineMath math="\theta = \frac{1}{4}\pi" /> radians (<InlineMath math="45^\circ" />) about the origin is:

We know <InlineMath math="\cos(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}" /> and <InlineMath math="\sin(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}" />.

<BlockMath math="R_{\frac{\pi}{4}} = \begin{pmatrix} \cos(\frac{\pi}{4}) & -\sin(\frac{\pi}{4}) \\ \sin(\frac{\pi}{4}) & \cos(\frac{\pi}{4}) \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{pmatrix}" />

This is the required matrix.

<LineEquation
  title={
    <>
      Visualization of Rotating Point (2,0) by <InlineMath math="45^\circ" />{" "}
      about the Origin
    </>
  }
  description={
    <>
      Point <InlineMath math="A(2,0)" /> is rotated by{" "}
      <InlineMath math="45^\circ" /> to become{" "}
      <InlineMath math="A'(\sqrt{2}, \sqrt{2})" />.{" "}
      <InlineMath math="\sqrt{2} \approx 1.414" />.
    </>
  }
  data={[
    {
      points: [{ x: 0, y: 0, z: 0 }],
      color: getColor("ROSE"),
      showPoints: true,
      labels: [{ text: "O", at: 0, offset: [0.3, -0.3, 0] }],
    },
    {
      points: [{ x: 2, y: 0, z: 0 }],
      color: getColor("SKY"),
      showPoints: true,
      labels: [{ text: "A(2,0)", at: 0, offset: [0.3, -0.3, 0] }],
    },
    {
      points: [{ x: Math.sqrt(2), y: Math.sqrt(2), z: 0 }],
      color: getColor("EMERALD"),
      showPoints: true,
      labels: [{ text: "A'(√2, √2)", at: 0, offset: [0.3, 0.3, 0] }],
    },
    {
      points: [
        { x: 0, y: 0, z: 0 },
        { x: 2, y: 0, z: 0 },
      ],
      color: getColor("INDIGO"),
    },
    {
      points: [
        { x: 0, y: 0, z: 0 },
        { x: Math.sqrt(2), y: Math.sqrt(2), z: 0 },
      ],
      color: getColor("INDIGO"),
    },
  ]}
  showZAxis={false}
  cameraPosition={[0, 0, 8]}
/>

## Exercises

1.  Determine the matrices associated with a rotation about the origin <InlineMath math="O(0,0)" /> by <InlineMath math="\frac{1}{6}\pi" /> radians.
2.  Determine the image of point <InlineMath math="P(4,2)" /> if it is rotated about the origin <InlineMath math="O(0,0)" /> by <InlineMath math="60^\circ" />.
3.  Determine the image of point <InlineMath math="Q(3,1)" /> if it is rotated about the point <InlineMath math="C(1,-2)" /> by <InlineMath math="90^\circ" />.

### Key Answers

1.  Given <InlineMath math="\theta = \frac{\pi}{6}" /> or <InlineMath math="30^\circ" />:

    <div className="flex flex-col gap-4">
      <BlockMath math="\cos(\frac{\pi}{6}) = \frac{\sqrt{3}}{2}" />
      <BlockMath math="\sin(\frac{\pi}{6}) = \frac{1}{2}" />
    </div>

    Rotation matrix:

    <BlockMath math="\begin{pmatrix} \frac{\sqrt{3}}{2} & -\frac{1}{2} \\ \frac{1}{2} & \frac{\sqrt{3}}{2} \end{pmatrix}" />

2.  Point <InlineMath math="P(4,2)" />, <InlineMath math="\theta = 60^\circ" />. <InlineMath math="\cos 60^\circ = \frac{1}{2}" />, <InlineMath math="\sin 60^\circ = \frac{\sqrt{3}}{2}" />.

    <BlockMath math="\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} \frac{1}{2} & -\frac{\sqrt{3}}{2} \\ \frac{\sqrt{3}}{2} & \frac{1}{2} \end{pmatrix} \begin{pmatrix} 4 \\ 2 \end{pmatrix} = \begin{pmatrix} (4)(\frac{1}{2}) - (2)(\frac{\sqrt{3}}{2}) \\ (4)(\frac{\sqrt{3}}{2}) + (2)(\frac{1}{2}) \end{pmatrix} = \begin{pmatrix} 2 - \sqrt{3} \\ 2\sqrt{3} + 1 \end{pmatrix}" />

    Image: <InlineMath math="P'(2-\sqrt{3}, 2\sqrt{3}+1)" />.

3.  Given point <InlineMath math="Q(3,1)" />, center <InlineMath math="C(1,-2)" />, <InlineMath math="\theta = 90^\circ" />. <InlineMath math="(a,b)=(1,-2)" />.

    <div className="flex flex-col gap-4">
      <BlockMath math="\cos 90^\circ = 0" />
      <BlockMath math="\sin 90^\circ = 1" />
      <BlockMath math="\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 3-1 \\ 1-(-2) \end{pmatrix} + \begin{pmatrix} 1 \\ -2 \end{pmatrix}" />
      <BlockMath math="= \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 2 \\ 3 \end{pmatrix} + \begin{pmatrix} 1 \\ -2 \end{pmatrix} = \begin{pmatrix} -3 \\ 2 \end{pmatrix} + \begin{pmatrix} 1 \\ -2 \end{pmatrix} = \begin{pmatrix} -2 \\ 0 \end{pmatrix}" />
    </div>

    Image: <InlineMath math="Q'(-2,0)" />.
