# Vector Math for 3D Computer Graphics

### July 2003

This is a tutorial on vector and matrix mathematics from the point of view of computer graphics. It covers the topics needed for most college-level text books on computer graphics. Although most graphics texts review these subjects in a brief appendix, usually it is too brief for someone who needs to learn or review the subjects. This tutorial covers the same subjects, but at greater length, and with many examples.

 · Chapter 0 --- Points in Space · Chapter 1 --- Vectors, Points, and Displacement · Chapter 2 --- Vector Addition · Chapter 3 --- Displacement Vectors · Chapter 4 --- Length of Vectors · Chapter 5 --- Direction of Vectors · Chapter 6 --- Scaling and Unit Vectors · Chapter 7 --- The Dot Product · Chapter 8 --- Length and the Dot Product · Chapter 9 --- The Angle between two Vectors. · Chapter 10 --- The Angle between 3D Vectors. · Chapter 11 --- Projecting one Vector onto Another. · Chapter 12 --- Vector Cross Product. · Chapter 13 --- Matrices and Simple Matrix Operations. · Chapter 14 --- Matrix-Column Matrix Multiplicaton. · Chapter 15 --- Matrix-Matrix Multiplication · Chapter 16 --- Identity Matrix and Matrix Inverse · Index

Although primarily aimed at computer science students, this tutorial is useful to all programmers interested in 3D computer graphics or 3D computer game programming. In spite of their appealing blood-and-gore covers, books on game programming require the same understanding of vectors and matrices as college text books (and usually defer these topics to the same skimpy mathematical appendix).

This tutorial is useful for more than computer graphics. Vectors and matrices are used in all scientific and engineering fields, and any other field that uses computers (are there any that don't?) In many fields, the vocabulary used for vectors and matrices does not match that used in computer graphics. But the ideas are the same, and reading these notes will take only a slight mental adjustment.

These notes assume that you have studied plane geometry and trigonometry sometime in the past. Notions such as point, line, plane, and angle should be familiar to you. Other notions such as sine, cosine, determinant, real number, and the common trig identities should at least be a distant memory.

Some sections of this tutorial have been in use for five years or more and hence are "classroom tested" and likely to be error-free and readable. Other sections are more recent and might fall short of both goals.

This tutorial may be freely downloaded and used as long as copyright and authorship information is not removed. (They are contained in HTML comments on each page.)