Geometry • Linear Algebra • Transformations Flagship

2D Rotation Matrix Generator

Generate the standard $2\times 2$ orthogonal rotation matrix $R(\theta)$ for any angle in degrees or radians, transform vectors $(x, y) \to (x', y')$, and inspect dynamic basis vector rotations on the Cartesian plane.

|
Last Updated: September 2026
|
Verified SO(2) Orthogonal Group Transformation
2D Rotation Matrix Generator R(θ) SO(2) Orthogonal Group
Rotation Angle & Orientation
0° θ = 45° 360°
Optional Vector to Transform: v = (x, y)
Standard Geometric Angles:
Generated 2×2 Transformation Matrix R(θ) det(R) = 1.000
[
cos θ 0.7071
−sin θ -0.7071
sin θ 0.7071
cos θ 0.7071
]
Rotated Vector v' = R(θ) ⋅ v
(0.707, 3.536)
Original |v| = 3.606 → Rotated |v'| = 3.606 (Isometric)

2D Coordinate Transformation Canvas

Basis i → i', j → j'
Original v
Rotated v'
Rotated i'
Rotated j'

Matrix Multiplication & Coordinate Rotation Derivation Formula: x' = x⋅cosθ − y⋅sinθ | y' = x⋅sinθ + y⋅cosθ

Direct Answer & Overview
Verified Educational Guide

How to Construct and Apply a 2D Rotation Matrix

To rotate any 2D vector or point (x, y) counter-clockwise by an angle θ around the origin, construct the 2×2 rotation matrix R(θ) = [[cos θ, -sin θ], [sin θ, cos θ]]. Then multiply this matrix by the column vector [x; y] to find the rotated coordinates: x' = x·cos(θ) - y·sin(θ) and y' = x·sin(θ) + y·cos(θ). Because R(θ) is an orthogonal matrix with determinant = 1, it perfectly preserves distances, angles, and shapes (isometry).

Primary Mathematical Formula Standard Mathematical Model
Standard Equation
ƒ(x)
Q.E.D.
R(θ) = [[cos θ, -sin θ], [sin θ, cos θ]] | x' = x·cos θ - y·sin θ | y' = x·sin θ + y·cos θ | det(R) = 1
Evaluated with exact mathematical formulation • Rigorously verified
Exact Formula
Input Parameters
Required
1
Rotation Angle (θ): Angle in degrees (°) or radians (rad)
2
Direction: Counter-Clockwise (+θ) or Clockwise (-θ)
3
Vector to Rotate (x, y): Initial point coordinates to transform
Expected Outputs
Calculated
2×2 Rotation Matrix: Exact trigonometric and decimal values with LaTeX export
Transformed Vector (x', y'): New coordinates after applying matrix multiplication
Vector Norm Preserved: Verifies that length |v'| = |v|
Interactive SVG Canvas: Visualizes rotated basis vectors i' and j'
Worked Numerical Example
Instant Verification
Rotate point v = (3, 2) counter-clockwise by θ = 90°
→ cos(90°) = 0, sin(90°) = 1. R(90°) = [[0, -1], [1, 0]]. x' = 3(0) - 2(1) = -2. y' = 3(1) + 2(0) = 3
Rotated Vector v' = (-2.000, 3.000) | Length |v'| = 3.606 (Preserved)

Anatomy of the 2D Rotation Matrix & Group Theory

In linear algebra and computer graphics, a 2D rotation matrix is an operator that rotates the Cartesian basis vectors $\mathbf{i} = (1, 0)$ and $\mathbf{j} = (0, 1)$ by an angle $\theta$ around the coordinate origin $(0, 0)$.

The rotated basis vectors form the columns of the transformation matrix:

R(θ) = [ [ cos θ, −sin θ ], [ sin θ, cos θ ] ]

Column 1: Rotated x-basis vector $\mathbf{i}' = (\cos\theta, \sin\theta)^T$.
Column 2: Rotated y-basis vector $\mathbf{j}' = (-\sin\theta, \cos\theta)^T$.

Determinant = +1
det(R) = cos²θ + sin²θ = 1

Area scaling factor is 1; no stretching or flipping.

Orthogonal Inverse
R⁻¹(θ) = Rᵀ(θ) = R(−θ)

The inverse matrix is simply its matrix transpose.

Rigid Isometry
|v'| = |v|

Preserves all Euclidean distances and interior angles.

Vector Transformation Formula (x', y')

To rotate an arbitrary point $P(x, y)$ by an angle $\theta$ around the origin $(0, 0)$:

New X-Coordinate
x' = x⋅cos(θ) − y⋅sin(θ)

First row of matrix dot product with [x; y].

New Y-Coordinate
y' = x⋅sin(θ) + y⋅cos(θ)

Second row of matrix dot product with [x; y].

Counter-Clockwise (+θ) vs Clockwise (-θ) Formulations

In mathematics, positive angles rotate counter-clockwise. For clockwise rotation, substitute $-\theta$ using trigonometric symmetries ($\cos(-\theta) = \cos\theta$, $\sin(-\theta) = -\sin\theta$):

Counter-Clockwise (CCW)

R_CCW = [ [cos θ, −sin θ], [sin θ, cos θ] ]

Clockwise (CW)

R_CW = [ [cos θ, sin θ], [−sin θ, cos θ] ]

Rotating Around an Arbitrary Center Point (h, k)

Standard rotation matrices assume the rotation pivot is the origin $(0, 0)$. To rotate around any center point $C(h, k)$, apply the three-step transformation pipeline:

  1. Translate to Origin: Shift coordinates by subtracting center $(h, k)$: $x_{rel} = x - h$, $y_{rel} = y - k$.
  2. Apply Rotation Matrix: Rotate around origin: $x'_{rel} = x_{rel}\cos\theta - y_{rel}\sin\theta$ and $y'_{rel} = x_{rel}\sin\theta + y_{rel}\cos\theta$.
  3. Translate Back: Add back the center $(h, k)$: $x' = x'_{rel} + h$ and $y' = y'_{rel} + k$.

Standard Transformation Matrices (30°, 45°, 60°, 90°, 180°)

Angle θ Radians Rotation Matrix R(θ) Vector Transformation (x', y')
90° π/2 [ [0, −1], [1, 0] ] (−y, x)
180° π [ [−1, 0], [0, −1] ] (−x, −y)
270° 3π/2 [ [0, 1], [−1, 0] ] (y, −x)
45° π/4 [ [√2/2, −√2/2], [√2/2, √2/2] ] ((x−y)√2/2, (x+y)√2/2)

Step-by-Step Worked Matrix Transformation Problems

Computer Graphics Rotation Example Level: Applied Linear Algebra

Rotate vector v = (4, 1) by θ = 90° counter-clockwise.

1. Form matrix R(90°) = [ [cos 90°, −sin 90°], [sin 90°, cos 90°] ] = [ [0, −1], [1, 0] ].

2. Multiply: x' = 4(0) − 1(1) = −1.

3. Multiply: y' = 4(1) + 1(0) = 4.

4. Rotated point v' = (−1, 4). Length |v'| = √((-1)² + 4²) = √17 ≈ 4.123 (Preserved!).

Common Pitfalls: Sign Errors & Coordinate Transpose

Pitfall 1: Placing Minus Sign on the Wrong Sine

In standard counter-clockwise rotation, the negative sign belongs in Row 1, Column 2 ($-\sin\theta$). Putting the minus sign in Row 2 Column 1 produces a clockwise rotation instead!

Pitfall 2: Row Vector vs Column Vector Order

If your codebase uses row vectors $[x, y]$, you must multiply on the right by the transpose: $[x, y] \cdot R^T(\theta)$.

Fact-Checked & Verified • Computational Accuracy Standards
Updated July 2026 • Editorial Policy
Authored By
Sanjay Samanta

Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

Reviewed & Verified By
Academic Review Board

Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

Found an error or have an improvement suggestion? Report a calculation issue

Frequently Asked Questions

What is a 2D rotation matrix?
A 2D rotation matrix is a 2×2 transformation matrix that rotates any vector or coordinate pair in the Cartesian plane by an angle θ around the origin: R(θ) = [[cos θ, -sin θ], [sin θ, cos θ]].
How do you rotate a point (x, y) by an angle θ?
Multiply the rotation matrix by the coordinate vector: x' = x·cos(θ) - y·sin(θ) and y' = x·sin(θ) + y·cos(θ).
What are the properties of a 2D rotation matrix?
Every 2D rotation matrix belongs to the Special Orthogonal Group SO(2). Its determinant is always exactly +1, its columns are orthonormal unit vectors, and its inverse equals its transpose: R⁻¹(θ) = R(-θ) = Rᵀ(θ).
What is the difference between clockwise and counter-clockwise rotation?
Standard mathematical counter-clockwise rotation uses angle +θ: R(+θ) = [[cos θ, -sin θ], [sin θ, cos θ]]. Clockwise rotation uses -θ: R(-θ) = [[cos θ, sin θ], [-sin θ, cos θ]].
How do you rotate a point around an arbitrary center (h, k) instead of the origin (0, 0)?
First translate the point so (h, k) becomes the origin: (x - h, y - k). Second, apply the rotation matrix. Third, translate back by adding (h, k): x' = (x - h)cos θ - (y - k)sin θ + h, and y' = (x - h)sin θ + (y - k)cos θ + k.