Original English by Jim Hefferon — 34 validated sections. The original mathematics and supplied answers below are preserved. This is a partial-book reading edition, not the complete book or an Everyday-English rewrite.

Source, reuse and conversion details

Source revision df2262e089a02651c127f1dd12649c4622ee1383; CC BY-SA 2.5 option, with original component credits retained. This is not an Everyday-English rewrite. The complete active topic is included. Original comments and the end-of-file marker remain in the editable source.

All five exercises and their complete supplied answers, 82 mathematical expressions, and 19 placements of 13 original diagrams are retained. Diagrams are rebuilt from the original MetaPost definitions, not redrawn. A declared deterministic seed affects only decorative projector beams. Source wording and formulas remain unchanged. AI-assisted source conversion, figure descriptions and checks; Current rebuild runtime is documented in the credit below; earlier intermediate work is not reattributed. No human review or exhaustive correctness certification is claimed.

Context needed when reusing this topic

Keep nonzero homogeneous representatives, the c ≠ 0 affine-chart condition and the column-vector convention. Formula (*) acts right to left. The third supplied answer uses the complete preceding reflection calculation; the modular index carries that dependency only in answer views.

Five source-bound corrections and qualifications

These notes are separate from the unchanged original. Opening them can reveal supplied answers.

  1. Source lines 44–124: Division by c and the representative with third coordinate 1 apply only when c is nonzero. A nonzero vector with c=0 represents a projective point at infinity and has no representative on z=1. The origin of the affine screen is (0,0,1), not the excluded zero homogeneous vector.
  2. Affected supplied answer: In the last supplied answer, the z-axis matrix has a zero third row and the y-axis matrix has a zero second row. They erase the coordinate on the purported fixed axis, so neither is a rotation; even at theta=0 they are not the identity. The fixed-axis diagonal entries must be 1: entry (3,3) in the first matrix and (2,2) in the second. All other printed coefficients, including the y-rotation sign convention, are retained. This note does not replace the printed source.
  3. Source lines 311–331: An invertible projective transformation is represented by a nonsingular 3-by-3 matrix up to nonzero scale. Writing its bottom-right entry as 1 assumes that entry is nonzero; an invertible matrix with bottom-right entry 0 cannot be scaled to the displayed form. General affine maps may be singular; an affine automorphism instead requires an invertible 2-by-2 linear block. The printed matrices are unchanged.
  4. Source lines 71–124: Five displayed first components print cos without a leading backslash, unlike the matching cosine entries in their matrices. They refer to the cosine function, but the original TeX typesets three variable letters. Preserve the native mathematical bytes and attach this explicit operator-typography note.
  5. Source lines 167–174: The prose calls figure ch4.62 a rotation by half a radian. Its original MetaPost computes theta=0.5*(180/3.414159) degrees, using 3.414159 rather than pi. The rendered source figure is therefore approximately 0.460083 radians, not 0.5. Preserve this original figure and disclose the discrepancy; do not silently redraw it.

Wide formulas scroll horizontally; focus one and use the arrow keys. Diagram sequences retain their original order and wrap on narrow screens.

Source-preserving rebuild, navigation, source packaging and current deterministic checks: OpenAI Codex — GPT-6 Astra, Ultra effort. Jim Hefferon remains the author of the mathematics. Earlier intermediate-conversion runtime identity is not established by its retained receipts and is not reassigned to this rebuild. No human review or exhaustive proof certification is claimed.

Computer Graphics

The prior topic on Projective Geometry gives this model of how our eye, or a camera, sees the world.

Hemisphere model. The points Q1, Q2 and Q3 lie on one line through the viewer at the centre; the line is labelled by scalar multiples of the column vector (1,2,3). They determine the same projective point.

All of the points on a line through the origin project to the same spot.

In that topic we defined that for any nonzero vector v → ∈ ℝ 3 , the associated point p in the projective plane is the set { k v → ∣ k ∈ ℝ  and  k ≠ 0 } . This is the collection of nonzero vectors lying on the same line through the origin as v → .

To describe a projective point we can give any representative member of the line. Thus these each represent the same projective point.

( 1 2 3 ) ( 1 / 3 2 / 3 1 ) ( − 2 − 4 − 6 )

Each is a homogeneous coordinate vector for the point  p . Two homogeneous coordinate vectors (which are by definition nonzero)

p ~ 1 = ( a 1 b 1 c 1 ) p ~ 2 = ( a 2 b 2 c 2 )

represent the same projective point if there is a scaling factor s ≠ 0 so that s p ~ 1 = p ~ 2 .

Of the infinitely many possible representatives, often we use the one whose third component is  1 . This amounts to projecting onto the plane z = 1 .

A sphere below the affine plane z=1. A line through the centre passes through antipodal sphere points and meets the plane. Equatorial directions have no intersection with z=1.

In this topic we will show how to use these ideas to perform some effects from computer graphics. For that we will take the prior picture and redraw it without the sphere, with a movie projector at the origin, and with plane z = 1 looking like a movie theater screen.

Movie projector at (0,0,0) and a screen labelled z=1. A grey line from the projector meets the screen at p=(x,y).

This associates vectors in three-space on the grey line with p  in the screen plane.

p ~ = ( a b c ) ↦ p = ( x y ) = ( a / c b / c )

We can adapt the things we have already seen about matrices to perform the transformations. Rotation is an example. This matrix rotates in the plane  z = 1 about the origin by the angle  θ .

( cos ⁡ θ − sin ⁡ θ 0 sin ⁡ θ cos ⁡ θ 0 0 0 1 ) ( x y 1 ) = ( c o s θ ⋅ x − sin ⁡ θ ⋅ y sin ⁡ θ ⋅ x + cos ⁡ θ ⋅ y 1 )

Notice that it works on any homogeneous coordinate vector; if we apply the matrix

( cos ⁡ θ − sin ⁡ θ 0 sin ⁡ θ cos ⁡ θ 0 0 0 1 ) ( a b c ) = ( c o s θ ⋅ a − sin ⁡ θ ⋅ b sin ⁡ θ ⋅ a + cos ⁡ θ ⋅ b c )

and then move to the z = 1  plane

( c o s θ ⋅ a − sin ⁡ θ ⋅ b sin ⁡ θ ⋅ a + cos ⁡ θ ⋅ b c ) ↦ ( ( c o s θ ⋅ a − sin ⁡ θ ⋅ b ) / c ( sin ⁡ θ ⋅ a + cos ⁡ θ ⋅ b ) / c 1 )

then we get the same result as if we had first moved to the plane and then applied the matrix.

( cos ⁡ θ − sin ⁡ θ 0 sin ⁡ θ cos ⁡ θ 0 0 0 1 ) ( a / c b / c 1 ) = ( c o s θ ⋅ a / c − sin ⁡ θ ⋅ b / c sin ⁡ θ ⋅ a / c + cos ⁡ θ ⋅ b / c 1 )

So there is no harm in working with homogeneous coordinates. But what is the advantage?

The computer graphic operation of translation, of sliding things from one place to another, is not a linear transformation because it does not leave the origin fixed. But if we work with homogeneous coordinates then we can use matrices. This matrix will translate points in the plane of interest by t x in the x  direction and t y in the y  direction.

( 1 0 t x 0 1 t y 0 0 1 ) ( a b c ) = ( a + t x ⋅ c b + t y ⋅ c c ) ↦ ( a / c + t x b / c + t y 1 )

That is, in the plane of interest this matrix slides ( a / c b / c ) to ( a / c + t x b / c + t y ) . So the homogeneous coordinates allow us to use matrices.

OK then, but what is the advantages of using these matrices? What does the extra coordinate get us? Suppose that we are making a movie with computer graphics. We are at a moment where the camera is panning and rotating at the same time. Every single point in the scene needs to be both translated and rotated. Rather than have the computer perform two operations to each point, we can multiply the two matrices and then the computer only applies one operation to each point; it multiplies that point by the resulting matrix. That is a tremendous speedup and simplification.

We will list some examples of the effects that we can get. We have already talked about rotation. Here is the picture of rotation by a half radian.

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ The original rectangle rotated anticlockwise about the origin. The native figure uses approximately 0.460083 radians, not the half radian stated in the prose; see the separate source note.

And here is a translation with t x = 1.5 and  t y = 0.5 .

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ Rectangle translated by 1.5 horizontally and 0.5 vertically. Its lower-left vertex is (1.5,0.5), and its width and height remain 1 and 2.

Next is scaling. This matrix rescales things in the target plane by a factor of  s in the x -direction, and by a factor of  t in the y  direction.

( s 0 0 0 t 0 0 0 1 ) ( a / c b / c 1 ) = ( s ⋅ a / c t ⋅ b / c 1 )

In this picture we rescale in the x  direction by a factor of s = 2.5 and in the y -direction by  t = 0.75 .

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ Rectangle after horizontal scaling by 2.5 and vertical scaling by 0.75: its width is 2.5 and its height is 1.5.

If we take s = t then the entire shape is rescaled. For instance, if we string together frames with s = t = 1.10 then in the movie it will seem that the object is getting closer to us.

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. First uniform enlargement about the origin: width 1.1 and height 2.2. Second consecutive uniform enlargement by 1.1: width 1.21 and height 2.42. Third consecutive uniform enlargement by 1.1: width 1.331 and height 2.662.

We can reflect the object. This reflects about the line y = x .

( 0 1 0 1 0 0 0 0 1 ) ( a / c b / c 1 ) = ( b / c a / c 1 )

The dashed line here is y = x .

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ Rectangle reflected across the dashed line y=x. Its width becomes 2 and its height 1, with the origin still a vertex.

This reflects about y = − x .

( 0 − 1 0 − 1 0 0 0 0 1 ) ( a / c b / c 1 ) = ( − b / c − a / c 1 )

The dashed line below is y = − x .

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ Rectangle reflected across the dashed line y=minus x. It extends from x=minus 2 to 0 and y=minus 1 to 0.

More complex transformations are possible. This is a shear.

( 1 1 0 0 1 0 0 0 1 ) ( a / c b / c 1 ) = ( a / c + b / c b / c 1 )

In this picture the y  components of points are unchanged, but the x  components have added to them the value of  y .

Original rectangle with vertices (0,0), (1,0), (1,2) and (0,2), beside horizontal and vertical coordinate axes. ↦ Horizontal shear x becomes x+y. The parallelogram has vertices (0,0), (1,0), (3,2) and (2,2); vertical coordinates are unchanged.

A major advantage of having this all be matrices is that we can do complex things by combining simple things. To reflect about the line y = − x + 2 we can find the three matrices to slide everything to the origin, then reflect about y = − x , and then slide back.

( 1 0 0 0 1 2 0 0 1 ) ( 0 − 1 0 − 1 0 0 0 0 1 ) ( 1 0 0 0 1 − 2 0 0 1 ) (*)

(As always, the action done first is described by the matrix on the right. That is, the matrix on the right describes sliding all points in the plane of interest by − 2 , the matrix in the middle reflects about y = − x , and the matrix on the left slides all points back.)

There are even more complex effects possible with matrices. These are the matrices for the general affine transformation, and the general projective transformation.

( d e f g h i 0 0 1 ) ( d e f g h i j k 1 )

However, description of their geometric effect is beyond our scope.

There is a vast literature on computer graphics, in which linear algebra plays an important part. An excellent source is [Hughes et al.]. The subject is a wonderful blend of mathematics and art; see [Disney].

Exercises

  1. Exercise 1 Supplied answer

    Calculate the product in ( ∗ ).

    Back to Exercise 1

    Answer. Straightforward calculation gives this for the product.

    ( 1 0 0 0 1 2 0 0 1 ) ( 0 − 1 0 − 1 0 0 0 0 1 ) ( 1 0 0 0 1 − 2 0 0 1 ) = ( 0 − 1 2 − 1 0 2 0 0 1 )

  2. Exercise 2 Supplied answer

    Find the matrix that reflects about the line y = 2 x .

    Back to Exercise 2

    Answer. Working in ℝ 2 , let the matrix be M . We get these two.

    ( 1 2 ) ↦ ( 1 2 ) ( − 2 1 ) ↦ ( 2 − 1 )

    (For the second one, the starting vector is on the line through the origin that is perpendicular to y = 2 x .) We have this.

    M ( 1 − 2 2 1 ) = ( 1 2 2 − 1 )

    Solving gives

    M = ( 1 2 2 − 1 ) ( 1 − 2 2 1 ) − 1 = ( − 3 / 5 4 / 5 4 / 5 3 / 5 )

    and so for homogeneous coordinates the matrix is this.

    ( − 3 / 5 4 / 5 0 4 / 5 3 / 5 0 0 0 1 )

  3. Exercise 3 Supplied answer

    Find the matrix that reflects about the line y = 2 x − 4 .

    Back to Exercise 3

    Answer. Move all points over by 4 , reflect about the line y = 2 x using the prior exercise, and them move them back.

    ( 1 0 0 0 1 − 4 0 0 1 ) ( − 3 / 5 4 / 5 0 4 / 5 3 / 5 0 0 0 1 ) ( 1 0 0 0 1 4 0 0 1 ) = ( − 3 / 5 4 / 5 16 / 5 4 / 5 3 / 5 − 8 / 5 0 0 1 )

  4. Exercise 4 Supplied answer

    Rotation and translation are rigid operations. What is the matrix for a rotation followed by a translation?

    Back to Exercise 4

    Answer.

    ( 1 0 t x 0 1 t y 0 0 1 ) ( cos ⁡ θ − sin ⁡ θ 0 sin ⁡ θ cos ⁡ θ 0 0 0 1 ) = ( cos ⁡ θ − sin ⁡ θ t x sin ⁡ θ cos ⁡ θ t y 0 0 1 )

  5. Exercise 5 Supplied answer

    The homogeneous coordinates extend to manipulations of three dimensional space in the obvious way: every coordinate is a set of four-tall nonzero vectors that are related by being scalar multiples of each other. Give the matrix to do rotation about the z  axis, and the matrix for rotation about the y  axis.

    Back to Exercise 5

    Answer. Here are the two 4 × 4 matrices.

    ( cos ⁡ θ − sin ⁡ θ 0 0 sin ⁡ θ cos ⁡ θ 0 0 0 0 0 0 0 0 0 1 ) ( cos ⁡ θ 0 − sin ⁡ θ 0 0 0 0 0 sin ⁡ θ 0 cos ⁡ θ 0 0 0 0 1 )

References cited in this section

Hughes et al.

John F. Hughes, Andries van Dam, Morgan McGuire, David F. Sklar, James D. Foley, Steven K. Feiner, Kurt Akeley, Computer graphics: principles and practice, third edition, Addison-Wesley, 1995.

Disney

Walt Disney Animation Studios, Disney’s Practical Guide to Path Tracing, https://www.youtube.com/watch?v=frLwRLS_ZR0 (as of 2020-Apr-11).