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]xy=[I]uvxy[T]uv[I]xyuv,

where [T]xy and [T]uv denote the matrix representing T with respect to the x,y and u,v coordinates respectively; [I]uvxy is the matrix that changes from u,v coordinates to x,y coordinates, and [I]xyuv 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]uvxy=[cosθ-sinθsinθcosθ],[T]uv=[100-1],[I]xyuv=([I]uvxy)-1=[cosθsinθ-sinθcosθ].

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

[T]xy=[cos2θsin2θsin2θ-cos2θ]. (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 (cos2θ,sin2θ) and (0,1) gets reflected to (sin2θ,-cos2θ). 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]xy 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]uv and [T]xy 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𝐯)-2b𝐯=𝐰-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-uy22uxuy2uxuyuy2-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-uy22uxuy2uxuyuy2-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
cos2θ =2cos2θ-1
sin2θ =2sinθcosθ=2tanθcos2θ=2mcos2θ.

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

1m2+1[1-m22m2mm2-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]xy=[cosϕsinϕsinϕ-cosϕ]. (4)

where ϕ=2θ. For this parameterization of RP1 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