---
title: "2D reflection matrices and line y+x=0"
subject: "Computer Graphics"
chapter: 3
key: "semester_5/computer_graphics:reflection-matrices-axes-y-plus-x"
source: https://www.bctengineer.com/q/semester_5/computer_graphics/reflection-matrices-axes-y-plus-x
site: BCT Engineering
---

# 2D reflection matrices and line y+x=0

Computer Graphics · Chapter 3: Two –Dimensional Transformations

- Asked in: 2075 Chaitra, 2+6 marks
- Video: [2D Reflection with example  | Transformation | CG | Computer Graphics | Lec-22 | Bhanu Priya](https://www.youtube.com/watch?v=8vbN89OYc2I) — Education 4u
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/computer_graphics/reflection-matrices-axes-y-plus-x
- Whole chapter: https://www.bctengineer.com/md/semester_5/computer_graphics/chapter-3

## Question

Write the matrices for 2D reflection about the axes. Derive the transformation matrix responsible for the reflection of a 2D object about the line y + x = 0.

## Short answer

Reflection about x-axis: [1 0 0; 0 −1 0; 0 0 1]; y-axis: [−1 0 0; 0 1 0; 0 0 1]; origin: [−1 0 0; 0 −1 0; 0 0 1]. For line y = −x, rotate by −135°, reflect about x-axis, rotate back by 135° gives matrix [0 −1 0; −1 0 0; 0 0 1], mapping (x,y) to (−y, −x).

## Answer

#### Reflection matrices (2D, homogeneous)
```text
About the x-axis (y → −y):     | 1  0 0 |
                               | 0 −1 0 |
                               | 0  0 1 |

About the y-axis (x → −x):     | −1 0 0 |
                               |  0 1 0 |
                               |  0 0 1 |

About the origin (x,y → −x,−y): | −1  0 0 |
                                |  0 −1 0 |
                                |  0  0 1 |
```

#### Reflection about the line y + x = 0 (that is y = −x)
This line passes through the origin with slope −1, so it makes the angle θ = 135° (or −45°) with the x-axis.

**Steps**
1. Rotate by −θ = −135° so that the line coincides with the x-axis: R(−135°).
2. Reflect about the x-axis: Ref_x.
3. Rotate back by +135°: R(135°).

M = R(135°) · Ref_x · R(−135°)

```text
cos135° = −0.7071,  sin135° = 0.7071

R(−135°) = | cos135°   sin135° | = | −0.7071  0.7071 |
           | −sin135°  cos135° |   | −0.7071 −0.7071 |

Ref_x · R(−135°) = | −0.7071   0.7071 |
                   |  0.7071   0.7071 |

R(135°) = | −0.7071  −0.7071 |
          |  0.7071  −0.7071 |

M = R(135°) · [Ref_x · R(−135°)]
  = | (−0.7071)(−0.7071)+(−0.7071)(0.7071)   (−0.7071)(0.7071)+(−0.7071)(0.7071) |
    | (0.7071)(−0.7071)+(−0.7071)(0.7071)    (0.7071)(0.7071)+(−0.7071)(0.7071)  |
  = | 0.5 − 0.5   −0.5 − 0.5 |   | 0 −1 |
    | −0.5 − 0.5   0.5 − 0.5 | = | −1  0 |
```

(Equivalently cos2θ = cos270° = 0 and sin2θ = sin270° = −1 in the matrix [[cos2θ, sin2θ], [sin2θ, −cos2θ]].)

**Answer:**

```text
M = |  0 −1 0 |
    | −1  0 0 |        i.e. (x, y) → (−y, −x)
    |  0  0 1 |
```

## Check yourself

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

1. Which matrix reflects about the y-axis?
   A. diag(-1, 1, 1)
   B. diag(1, -1, 1)
   C. diag(-1, -1, 1)
   D. diag(1, 1, -1)
   Answer: A. x changes sign; y stays. (Key point: Axis reflections)

2. How is the reflection built?
   A. Ref_x·R(135°)
   B. R(45°)·Ref_y
   C. R(135°)·Ref_x·R(-135°)
   D. T·S·T
   Answer: C. Rotate line to x-axis, reflect, rotate back. (Key point: Steps)

3. What does the final mapping do?
   A. (x, y) -> (y, x)
   B. (x, y) -> (-x, -y)
   C. (x, y) -> (x, -y)
   D. (x, y) -> (-y, -x)
   Answer: D. The matrix is [[0,-1],[-1,0]]. (Key point: Result)

## Related in Computer Graphics

- [Composite matrix: reflection about y=mx+c](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Areflection-about-y-mx-c) — Computer Graphics, chapter 3, asked 2×
- [2D viewing pipeline with matrices](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aviewing-pipeline-2d-matrices) — Computer Graphics, chapter 3, asked 5×
- [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×
- [Derive parallel projection matrix](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aparallel-projection-matrix-derive) — Computer Graphics, chapter 4, asked 2×
- [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
- [Derive oblique projection matrix](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_graphics%3Aoblique-projection-matrix-derive) — Computer Graphics, chapter 4, asked 3×

## Related in other subjects

- [Stiffness matrix: element matrices, member forces, BMD](https://www.bctengineer.com/question.md?key=semester_5%2Ftheory_of_structures_ii%3Astiffness-element-matrices-600kn-bmd) — Theory of Structures II, chapter 3
- [Derive reflection coefficient for terminated LC ladder](https://www.bctengineer.com/question.md?key=semester_5%2Ffilter_design%3Areflection-coefficient-derivation) — Filter Design, chapter 5, asked 2×
- [Bar stiffness matrix and 2D truss element](https://www.bctengineer.com/question.md?key=semester_8%2Fcomputational_techniques_in_civil_engineering%3Abar-stiffness-truss-rotation) — Computational Techniques in Civil Engineering, chapter 4
- [Planes through line parallel to axes](https://www.bctengineer.com/question.md?key=semester_2%2Fmathematics%3Aplanes-through-line-parallel-axes) — Mathematics, chapter 3, asked 2×
