derivation of 2D reflection matrix


Reflection across a line of given angle

Let 𝐱,𝐲 be perpendicularMathworldPlanetmathPlanetmathPlanetmathPlanetmath unit vectorsMathworldPlanetmath in the plane. Suppose we want to reflectPlanetmathPlanetmath vectors (perpendicularly) over a line that makes an angle θ with the positive 𝐱 axis. More precisely, we are given a direction direction vector 𝐮=cos⁡θ⁢𝐱+sin⁡θ⁢𝐲 for the line of reflection. A unit vector perpendicular to 𝐮 is 𝐯=-sin⁡θ⁢𝐱+cos⁡θ⁢𝐲 (as is easily checked). Then to reflect an arbitrary vector 𝐰, we write 𝐰 in of its componentsPlanetmathPlanetmathPlanetmath in the 𝐮,𝐯 axes: 𝐰=a⁢𝐮+b⁢𝐯, and the result of the reflection is to be 𝐰′=a⁢𝐮-b⁢𝐯.

We compute the matrix for such a reflection in the original x,y coordinates.

Denote the reflection by T. By the matrix change-of-coordinates formula, we have

[T]x⁢y=[I]u⁢vx⁢y⁢[T]u⁢v⁢[I]x⁢yu⁢v,

where [T]x⁢y and [T]u⁢v denote the matrix representing T with respect to the x,y and u,v coordinates respectively; [I]u⁢vx⁢y is the matrix that changes from u,v coordinates to x,y coordinates, and [I]x⁢yu⁢v is the matrix that changes coordinates the other way.

The three matrices on the right-hand side are all easily derived from the description we gave for the reflection T:

[I]u⁢vx⁢y=[cos⁡θ-sin⁡θsin⁡θcos⁡θ],[T]u⁢v=[100-1],[I]x⁢yu⁢v=([I]u⁢vx⁢y)-1=[cos⁡θsin⁡θ-sin⁡θcos⁡θ].

Computing the matrix productMathworldPlanetmath (with the help of the double angle identity) yields:

[T]x⁢y=[cos⁡2⁢θsin⁡2⁢θsin⁡2⁢θ-cos⁡2⁢θ]. (1)

For the of the reader, we note that there are other ways of “deriving” this result. One is by the use of a diagram, which would show that (1,0) gets reflected to (cos⁡2⁢θ,sin⁡2⁢θ) and (0,1) gets reflected to (sin⁡2⁢θ,-cos⁡2⁢θ). Another way is to observe that we can rotate an arbitrary mirror line onto the x-axis, then reflect across the x-axis, and rotate back. (The matrix product [T]x⁢y can be seen as operating this way.) We took neither of these two approaches, because to justify them rigorously takes a bit of work, that is avoided by the pure linear algebra approach.

Note also that [T]u⁢v and [T]x⁢y are orthogonal matricesMathworldPlanetmath, with determinantDlmfMathworldPlanetmath -1, as expected.

Reflection across a line of given direction vector

Suppose instead of being given an angle θ, we are given the unit direction vector u to reflect the vector w. We can derive the matrix for the reflection directly, without involving any trigonometric functionsDlmfMathworldPlanetmath.

In the decomposition 𝐰=a⁢𝐮+b⁢𝐯, we note that b=𝐰⋅𝐯. Therefore

𝐰′=(a⁢𝐮+b⁢𝐯)-2⁢b⁢𝐯=𝐰-2⁢(𝐰⋅𝐯)⁢𝐯.

(In fact, this is the formula used in the to draw the diagram in this entry.) To derive the matrix with respect to x,y coordinates, we resort to a trick:

𝐰′=I⁢𝐰-2⁢𝐯⁢(𝐰⋅𝐯)=I⁢𝐰-2⁢𝐯⁢(𝐯tr⁢𝐰)=I⁢𝐰-2⁢(𝐯𝐯tr)⁢𝐰.

Therefore the matrix of the transformation is

I-2⁢𝐯𝐯tr=[ux2-uy22⁢ux⁢uy2⁢ux⁢uyuy2-ux2],𝐮=(ux,uy)tr,𝐯=(-uy,ux)tr.

If u was not a unit vector to begin with, it of course suffices to divide by its magnitude before proceeding. Taking this into account, we obtain the following matrix for a reflection about a line with direction 𝐮:

1ux2+uy2⁢[ux2-uy22⁢ux⁢uy2⁢ux⁢uyuy2-ux2]. (2)

Notice that if we put ux=cos⁡θ and uy=sin⁡θ in matrix (2), we get matrix (1), as it should be.

Reflection across a line of given slope

There is another form for the matrix (1). We set m=tan⁡θ to be the slope of the line of reflection and use the identities:

cos2⁡θ =1tan2⁡θ+1=1m2+1
cos⁡2⁢θ =2⁢cos2⁡θ-1
sin⁡2⁢θ =2⁢sin⁡θ⁢cos⁡θ=2⁢tan⁡θ⁢cos2⁡θ=2⁢m⁢cos2⁡θ.

When these equations are substituted in matrix (1), we obtain an alternate expression for it in of m only:

1m2+1⁢[1-m22⁢m2⁢mm2-1]. (3)

Thus we have derived the matrix for a reflection about a line of slope m.

Alternatively, we could have also substituted ux=1 and uy=m in matrix (2) to arrive at the same result.

Topology of reflection matrices

Of course, formula (3) does not work literally when m=±∞ (the line is vertical). However, that case may be derived by taking the limit |m|→∞ — this limit operation can be justified by considerations of the topologyMathworldPlanetmathPlanetmath of the space of two-dimensional reflection matrices.

What is this topology? It is the one-dimensional projective planeMathworldPlanetmath ℝ⁢ℙ1, or simply, the “real projective line”. It is formed by taking the circle, and identifying opposite points, so that each pair of opposite points specify a unique mirror line of reflection in ℝ2. Formula (1) is a parameterization of ℝ⁢ℙ1. Note that (1) involves the quantity 2⁢θ, not θ, because for a point (cos⁡θ,sin⁡θ) on the circle, its opposite point (cos⁡(θ+π),sin⁡(θ+π)) specify the same reflection, so formula (1) has to be invariant when θ is replaced by θ+π.

But (1) might as well be written

[T]x⁢y=[cos⁡ϕsin⁡ϕsin⁡ϕ-cos⁡ϕ]. (4)

where ϕ=2⁢θ. For this parameterization of R⁢P1 to be one-to-one, ϕ can range over intervalMathworldPlanetmathPlanetmath (0,2⁢π), and the endpointsMathworldPlanetmath at ϕ=0,2⁢π overlap just as for a circle, without identifying pairs of opposite points. What does this mean? It is the fact that ℝ⁢ℙ1 is homeomorphic to the circle S1.

The real projective line ℝ⁢ℙ1 is also the one-point compactification of ℝ (i.e. ℝ⁢ℙ1=ℝ∪{∞}), as shown by formula (3); the number m=∞ corresponds to a reflection across the vertical axis. Note that this “∞” is not the same as the usual ±∞, because here -∞ and ∞ are actually the same number, both representing the slope of a vertical line.

Title derivation of 2D reflection matrix
Canonical name DerivationOf2DReflectionMatrix
Date of creation 2013-03-22 15:25:05
Last modified on 2013-03-22 15:25:05
Owner stevecheng (10074)
Last modified by stevecheng (10074)
Numerical id 14
Author stevecheng (10074)
Entry type Derivation
Classification msc 15-00
Related topic RotationMatrix
Related topic DecompositionOfOrthogonalOperatorsAsRotationsAndReflections
Related topic DerivationOfRotationMatrixUsingPolarCoordinates