TExcelTAD
Home › Pre-Calculus, Geometry & Trigonometry › Translations, Reflections and Rotations

Translations, Reflections and Rotations

A transformation moves every point of a figure by one rule. Translations slide, reflections flip, rotations turn, and dilations resize. These four are the moves behind every sprite, map view and 3D model you have ever seen on a screen, and in code each one is a small formula or a matrix.

Rigid motions

A transformation that keeps all distances the same is a rigid motion (an isometry). Translations, reflections and rotations are rigid, so the image of a figure is congruent to the original (Congruence and Similarity). A dilation by a factor kk multiplies all distances by kk, so it gives a similar figure instead. Reflections also reverse orientation: a shape whose corners were listed counter-clockwise comes out clockwise, like a left hand turning into a right hand in a mirror.

The coordinate rules

Transformation Rule (x,y)→(x, y) \to
translation by (a,b)(a, b) (x+a,y+b)(x + a, y + b)
reflection in the x-axis (x,−y)(x, -y)
reflection in the y-axis (−x,y)(-x, y)
reflection in the line y=xy = x (y,x)(y, x)
reflection in the line y=−xy = -x (−y,−x)(-y, -x)
rotation 90° counter-clockwise about the origin (−y,x)(-y, x)
rotation 180° about the origin (−x,−y)(-x, -y)
rotation 270° (or 90° clockwise) (y,−x)(y, -x)
rotation by θ\theta about the origin (xcos⁡θ−ysin⁡θ, xsin⁡θ+ycos⁡θ)(x\cos\theta - y\sin\theta,\ x\sin\theta + y\cos\theta)
dilation by kk from the origin (kx,ky)(kx, ky)

Positive angles turn counter-clockwise, the mathematical convention. (Screen coordinates often have y pointing down, which flips the visible direction; see Handedness.)

python · try it yourself
tri = [(1, 1), (4, 1), (1, 3)]
rules = {
    "translate (2, -3)": lambda x, y: (x + 2, y - 3),
    "reflect x-axis":    lambda x, y: (x, -y),
    "reflect y = x":     lambda x, y: (y, x),
    "rotate 90°":        lambda x, y: (-y, x),
    "rotate 180°":       lambda x, y: (-x, -y),
    "dilate ×2":         lambda x, y: (2 * x, 2 * y),
}
def signed_area(p):
    return sum(p[i][0] * p[(i + 1) % 3][1] - p[(i + 1) % 3][0] * p[i][1] for i in range(3)) / 2

print(f"{'original':18} {tri}  signed area {signed_area(tri)}")
for name, f in rules.items():
    img = [f(x, y) for x, y in tri]
    print(f"{name:18} {img}  signed area {signed_area(img)}")
original           [(1, 1), (4, 1), (1, 3)]  signed area 3.0
translate (2, -3)  [(3, -2), (6, -2), (3, 0)]  signed area 3.0
reflect x-axis     [(1, -1), (4, -1), (1, -3)]  signed area -3.0
reflect y = x      [(1, 1), (1, 4), (3, 1)]  signed area -3.0
rotate 90°         [(-1, 1), (-1, 4), (-3, 1)]  signed area 3.0
rotate 180°        [(-1, -1), (-4, -1), (-1, -3)]  signed area 3.0
dilate ×2          [(2, 2), (8, 2), (2, 6)]  signed area 12.0

The signed area (shoelace, from Polygons) tells the story: rigid motions keep the size 3, reflections flip the sign (orientation reversed), and the dilation by 2 multiplies the area by 22=42^2 = 4.

Seeing it

python · try it yourself
import matplotlib.pyplot as plt

tri = [(1, 1), (4, 1), (1, 3)]
images = {
    "original":         tri,
    "rotate 90°":       [(-y, x) for x, y in tri],
    "reflect in y = x": [(y, x) for x, y in tri],
    "translate (1, -5)": [(x + 1, y - 5) for x, y in tri],
}
plt.figure(figsize=(6, 5))
for name, pts in images.items():
    xs, ys = zip(*pts)
    plt.fill(xs, ys, alpha=0.35, label=name)
    plt.plot(xs[0], ys[0], "ko", markersize=4)       # mark the first corner to follow it
plt.plot([-4, 5], [-4, 5], "k--", linewidth=0.8)     # the mirror line y = x
plt.axhline(0, color="gray", linewidth=0.5)
plt.axvline(0, color="gray", linewidth=0.5)
plt.axis("equal")
plt.legend(loc="lower left", fontsize=8)
print("drawn:", ", ".join(images))
drawn: original, rotate 90°, reflect in y = x, translate (1, -5)

Rotation about another point, and the order of moves

To rotate about a point PP that is not the origin: translate PP to the origin, rotate, translate back. Doing several transformations in a row is composition, and its order matters.

Rotations, reflections and dilations about the origin are linear, so each is a 2×22 \times 2 matrix. Translations are not linear, so graphics code adds a third coordinate, writing the point (x,y)(x, y) as (x,y,1)(x, y, 1). In these homogeneous coordinates every move is a 3×33 \times 3 matrix and composition is matrix multiplication (the rightmost matrix acts first):

python · try it yourself
import numpy as np

def T(a, b):
    return np.array([[1, 0, a], [0, 1, b], [0, 0, 1]], dtype=float)

def R(deg):
    c, s = np.cos(np.radians(deg)), np.sin(np.radians(deg))
    return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])

def apply(M, x, y):
    v = M @ np.array([x, y, 1.0])
    return (round(float(v[0]), 6) + 0.0, round(float(v[1]), 6) + 0.0)

about_22 = T(2, 2) @ R(90) @ T(-2, -2)                # rotate 90° about (2, 2)
print("rotate (4, 2) about (2, 2):", apply(about_22, 4, 2))
print("translate then rotate (1, 0):", apply(R(90) @ T(3, 0), 1, 0))
print("rotate then translate (1, 0):", apply(T(3, 0) @ R(90), 1, 0))

Fx = np.diag([1.0, -1.0, 1.0])                          # reflect in the x-axis
Fd = np.array([[0.0, 1, 0], [1, 0, 0], [0, 0, 1]])       # reflect in y = x
print("two reflections = rotation 90°?", np.allclose(Fd @ Fx, R(90)))
rotate (4, 2) about (2, 2): (2.0, 4.0)
translate then rotate (1, 0): (0.0, 4.0)
rotate then translate (1, 0): (3.0, 1.0)
two reflections = rotation 90°? True

The last line shows a classic fact: reflecting in two lines that meet at an angle φ\varphi is a rotation by 2φ2\varphi about their crossing point. Here the x-axis and y=xy = x meet at 45°, giving 90°. The + 0.0 in apply turns a printed -0.0 into 0.0.

In software

Game engines store each object's transform as a translation, a rotation and a scale, and build its matrix as T⋅R⋅ST \cdot R \cdot S: scale first, then rotate, then move into place. Parent-child hierarchies (a wheel on a car) multiply these matrices together. Read on in Rotation in 2D, Homogeneous Coordinates, Translate, Rotate, Scale, Geometric Transformations and Graphics Transforms.

Exercises

Exercise 1: Two reflections of a point

Reflect (3,−5)(3, -5) in the y-axis, and separately in the line y=xy = x.

Answer

(−3,−5)(-3, -5) and (−5,3)(-5, 3)

Solution
y-axis:(x,y)→(−x,y):(3,−5)→(−3,−5)y=x:(x,y)→(y,x):(3,−5)→(−5,3)\begin{aligned} y\text{-axis:} &\quad (x, y) \to (-x, y){:} &&(3, -5) \to (-3, -5) \\ y = x{:} &\quad (x, y) \to (y, x){:} &&(3, -5) \to (-5, 3) \end{aligned}

Exercise 2: Quarter and half turns

Rotate (2,5)(2, 5) about the origin by 90° counter-clockwise, and by 180°.

Answer

(−5,2)(-5, 2) and (−2,−5)(-2, -5)

Solution
90∘:(x,y)→(−y,x):(2,5)→(−5,2)180∘:(x,y)→(−x,−y):(2,5)→(−2,−5)\begin{aligned} 90^\circ{:} &\quad (x, y) \to (-y, x){:} &&(2, 5) \to (-5, 2) \\ 180^\circ{:} &\quad (x, y) \to (-x, -y){:} &&(2, 5) \to (-2, -5) \end{aligned}

Exercise 3: Rotating about a point

Rotate (5,1)(5, 1) by 90° counter-clockwise about the point (2,1)(2, 1).

Answer

(2,4)(2, 4)

Solution
translate so (2,1) is the origin:(5−2,1−1)=(3,0)rotate 90∘:(3,0)→(0,3)translate back:(0+2,3+1)=(2,4)\begin{aligned} \text{translate so } (2, 1) \text{ is the origin:} &\quad (5 - 2, 1 - 1) = (3, 0) \\ \text{rotate } 90^\circ{:} &\quad (3, 0) \to (0, 3) \\ \text{translate back:} &\quad (0 + 2, 3 + 1) = (2, 4) \end{aligned}

Exercise 4: Order matters

Start at (0,2)(0, 2). (a) Reflect in the x-axis, then translate by (4,0)(4, 0). (b) Translate by (4,0)(4, 0), then rotate 90° counter-clockwise about the origin. Compute both by hand and check with code.

Answer

(a) (4,−2)(4, -2), (b) (−2,4)(-2, 4)

Solution
(a)(0,2)→(0,−2)→(4,−2)(b)(0,2)→(4,2)→(−2,4)\begin{aligned} &\text{(a)}\quad (0, 2) \to (0, -2) \to (4, -2) \\ &\text{(b)}\quad (0, 2) \to (4, 2) \to (-2, 4) \end{aligned}
python · try it yourself
x, y = 0, 2
a = (x, -y); a = (a[0] + 4, a[1])
b = (x + 4, y); b = (-b[1], b[0])
print(a, b)
(4, -2) (-2, 4)

Exercise 5: A 30° turn

Rotate (2,0)(2, 0) by 30° about the origin. Give the exact answer and the decimals.

Answer

(3,1)≈(1.732,1.0)(\sqrt{3}, 1) \approx (1.732, 1.0)

Solution
(2cos⁡30∘−0⋅sin⁡30∘, 2sin⁡30∘+0⋅cos⁡30∘)=(2⋅32, 2⋅12)=(3,1)(2\cos 30^\circ - 0 \cdot \sin 30^\circ,\ 2\sin 30^\circ + 0 \cdot \cos 30^\circ) = \left(2 \cdot \tfrac{\sqrt{3}}{2},\ 2 \cdot \tfrac{1}{2}\right) = (\sqrt{3}, 1)
python · try it yourself
import math
t = math.radians(30)
print(round(2 * math.cos(t), 3), round(2 * math.sin(t), 3))
1.732 1.0

Test yourself

What is the image of (4,−1)(4, -1) after a 90° counter-clockwise rotation about the origin?

  1. (−1,−4)(-1, -4)
  2. (1,4)(1, 4)
  3. (−4,1)(-4, 1)
  4. (4,1)(4, 1)

Which transformation is NOT a rigid motion?

  1. Reflection
  2. Translation
  3. Rotation
  4. Dilation by 3

Why do graphics programs use 3×33 \times 3 matrices with (x,y,1)(x, y, 1) for 2D points?

  1. So translations can be written as matrix products too
  2. Because screens have three colours
  3. To store the z depth
  4. To make rotations faster