---
title: "Composite matrix: reflection about y=mx+c"
subject: "Computer Graphics"
chapter: 3
key: "semester_5/computer_graphics:reflection-about-y-mx-c"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/reflection-about-y-mx-c
site: BCT Engineering
---

# Composite matrix: reflection about y=mx+c

Computer Graphics · Chapter 3: Two –Dimensional Transformations

- Asked in: 2079 Baisakh, 8 marks; 2068 Chaitra, 8 marks (asked 2 times)
- Video: [Numerical based on reflection about line y=mx+c](https://www.youtube.com/watch?v=4bvn8wAR1_A) — sks knowledge point
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/reflection-about-y-mx-c
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-3

## Question

Find the composite transformation matrix for reflection about a line y = mx + c.

## Short answer

Reflection about y=mx+c is M=T(0,c)*R(theta)*Ref_x*R(-theta)*T(0,-c), where theta=arctan(m). Simplified, M = 1/(1+m^2) times [[1-m^2, 2m, -2mc], [2m, m^2-1, 2c], [0, 0, 1+m^2]].

## Answer

A line y = mx + c has slope m = tan θ and y-intercept (0, c). A reflection about it is a composite of five basic transformations.

```text
Step 1: translate the line so that it passes through the origin:
        T1 = T(0, −c)
Step 2: rotate by −θ so that the line lies along the x-axis,
        θ = tan⁻¹(m):  R(−θ)
Step 3: reflect about the x-axis:  Ref_x
Step 4: rotate back by +θ:  R(θ)
Step 5: translate back:  T2 = T(0, c)
```

The composite matrix (column-vector form, applied right to left) is

```text
M = T(0,c) · R(θ) · Ref_x · R(−θ) · T(0,−c)

| 1 0 0 |   | cosθ −sinθ 0 |   | 1  0 0 |   |  cosθ sinθ 0 |   | 1 0  0 |
| 0 1 c | · | sinθ  cosθ 0 | · | 0 −1 0 | · | −sinθ cosθ 0 | · | 0 1 −c |
| 0 0 1 |   |  0     0   1 |   | 0  0 1 |   |   0    0   1 |   | 0 0  1 |
```

First, R(θ)·Ref_x·R(−θ) is

```text
| cos²θ − sin²θ    2 sinθ cosθ  0 |   | cos2θ   sin2θ  0 |
| 2 sinθ cosθ   sin²θ − cos²θ   0 | = | sin2θ  −cos2θ  0 |
|      0              0         1 |   |   0       0    1 |
```

Including the translations:

```text
        | cos2θ   sin2θ   −c·sin2θ     |
   M =  | sin2θ  −cos2θ    c(1+cos2θ)  |
        |   0       0          1        |
```

Using cos2θ = (1 − m²)/(1 + m²) and sin2θ = 2m/(1 + m²):

```text
              | 1−m²    2m     −2mc  |
 M = 1/(1+m²) | 2m     m²−1     2c   |
              |  0       0     1+m²  |
```

**Check:** the point (0, c) on the line gives x' = (2m·c − 2mc)/(1+m²) = 0 and y' = ((m²−1)c + 2c)/(1+m²) = c, so points on the line do not move. For c = 0, m = 1 it gives [[0,1,0],[1,0,0],[0,0,1]], the reflection about y = x.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. The composite transformation to reflect about y = mx + c is:
   A. R(θ) · T(0,c) · Ref_x · T(0,−c) · R(−θ)
   B. T(0,c) · R(θ) · Ref_x · R(−θ) · T(0,−c)
   C. T(0,−c) · R(−θ) · Ref_y · R(θ) · T(0,c)
   D. Ref_x · T(0,c) · R(θ)
   Answer: B. Translate the line to the origin, rotate it onto the x-axis, reflect about x, then undo. (Key point: Sequence)

2. The angle θ used is:
   A. θ = m
   B. θ = tan⁻¹(c)
   C. θ = tan⁻¹(m)
   D. θ = cos⁻¹(m)
   Answer: C. m = tan θ. (Key point: Angle)

3. R(θ)·Ref_x·R(−θ) simplifies to:
   A. [[cos2θ, sin2θ],[sin2θ, −cos2θ]]
   B. [[cos2θ, −sin2θ],[sin2θ, cos2θ]]
   C. [[1,0],[0,−1]]
   D. [[sin2θ, cos2θ],[cos2θ, −sin2θ]]
   Answer: A. This is the reflection matrix about a line through the origin at angle θ. (Key point: Simplified middle)

4. For m = 1 and c = 0 the result is:
   A. The identity matrix
   B. [[0,1,0],[1,0,0],[0,0,1]], the reflection about y = x
   C. [[1,0,0],[0,−1,0],[0,0,1]]
   D. [[0,−1,0],[1,0,0],[0,0,1]]
   Answer: B. cos2θ = 0 and sin2θ = 1 for θ = 45°. (Key point: Check)

## Related in Computer Graphics

- [2D reflection matrices and line y+x=0](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Areflection-matrices-axes-y-plus-x) — Computer Graphics, chapter 3
- [Reflection about y=x as composite](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Areflection-y-x-composite-angle) — Computer Graphics, chapter 3
- [Square to rhombus; reflection about y=x](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Asquare-to-rhombus-reflection-y-x) — Computer Graphics, chapter 3
- [Composite rotation and shear in 2D](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Acomposite-rotation-and-shear-2d) — Computer Graphics, chapter 3
- [3D window to viewport transformation](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Awindow-viewport-3d-matrix) — Computer Graphics, chapter 4
- [Derive perspective projection matrix](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aperspective-projection-matrix-derive) — Computer Graphics, chapter 4, asked 3×

## Related in other subjects

- [MOI of common area between y = K√x and y = mx](https://www.bctengineer.com/question.md?key=semester_1%2Fapplied_mechanics%3Amoi-common-area-y-k-sqrt-x-y-mx) — Applied Mechanics, chapter 4
- [Inductance matrix of 500 kV bundled line](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Ainductance-matrix-500kv) — High Voltage Engineering, chapter 5, asked 3×
- [Capacitance matrix of 400 kV bundled line](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Acapacitance-matrix-400kv-15m) — High Voltage Engineering, chapter 5, asked 2×
- [Charge matrix of 400 kV line](https://www.bctengineer.com/question.md?key=semester_8%2Fhigh_voltage_engineering%3Acharge-matrix-400kv-midspan) — High Voltage Engineering, chapter 5
