derivation of 2D reflection matrix

derivation of 2D reflection matrix

Reflection across a line of given angle

Let

𝐱

,

𝐲

be

perpendicular

unit vectors

in the plane.
Suppose we want to

reflect

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

components

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

⁢

v

x

⁢

y

⁢

[

T

]

u

⁢

v

⁢

[

I

]

x

⁢

y

u

⁢

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

⁢

v

x

⁢

y

is the
matrix that changes from

u

,

v

coordinates to

x

,

y

coordinates, and

[

I

]

x

⁢

y

u

⁢

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

⁢

v

x

⁢

y

=

[

cos

⁡

θ

-

sin

⁡

θ

sin

⁡

θ

cos

⁡

θ

]

,

[

T

]

u

⁢

v

=

[

1

0

0

-

1

]

,

[

I

]

x

⁢

y

u

⁢

v

=

(

[

I

]

u

⁢

v

x

⁢

y

)

-

1

=

[

cos

⁡

θ

sin

⁡

θ

-

sin

⁡

θ

cos

⁡

θ

]

.

Computing the

matrix product

(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 matrices

,
with

determinant

-

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 functions

.

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

=

[

u

x

2

-

u

y

2

2

⁢

u

x

⁢

u

y

2

⁢

u

x

⁢

u

y

u

y

2

-

u

x

2

]

,

𝐮

=

(

u

x

,

u

y

)

tr

,

𝐯

=

(

-

u

y

,

u

x

)

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

𝐮

:

1

u

x

2

+

u

y

2

⁢

[

u

x

2

-

u

y

2

2

⁢

u

x

⁢

u

y

2

⁢

u

x

⁢

u

y

u

y

2

-

u

x

2

]

.

(2)

Notice that if we put

u

x

=

cos

⁡

θ

and

u

y

=

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:

cos

2

⁡

θ

=

1

tan

2

⁡

θ

+

1

=

1

m

2

+

1

cos

⁡

2

⁢

θ

=

2

⁢

cos

2

⁡

θ

-

1

sin

⁡

2

⁢

θ

=

2

⁢

sin

⁡

θ

⁢

cos

⁡

θ

=

2

⁢

tan

⁡

θ

⁢

cos

2

⁡

θ

=

2

⁢

m

⁢

cos

2

⁡

θ

.

When these equations are substituted in matrix (

1

),
we obtain an alternate

expression

for it in of

m

only:

1

m

2

+

1

⁢

[

1

-

m

2

2

⁢

m

2

⁢

m

m

2

-

1

]

.

(3)

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

m

.

Alternatively, we could have also substituted

u

x

=

1

and

u

y

=

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

topology

of
the space of two-dimensional reflection matrices.

What is this topology? It is the one-dimensional

projective plane

ℝ

⁢

ℙ

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

⁢

P

1

to be one-to-one,

ϕ

can range over

interval

(

0

,

2

⁢

π

)

, and the

endpoints

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

S

1

.

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

Generated on Fri Feb 9 18:13:56 2018 by

LaTeXML