Appendix D. Matrix Algebra

Matrix algebra is a branch of mathematics that defines operations on matrices, which are series of numbers arranged in rows and columns. In addition to its many uses in science and engineering, matrix algebra makes the computations for graphic operations very efficient. The purpose of this appendix is to introduce you to the fundamental concepts of matrix algebra that SVG uses “behind the scenes.”

Matrix Terminology

We describe a matrix by its number of rows and columns. Figure D-1 displays a matrix that arranges a series of daily temperatures over a two-week period into two rows of seven columns each. This matrix is called a 2-by-7 matrix. Matrices are enclosed in square brackets when written.

2-by-7 matrix of daily temperatures

Figure D-1. 2-by-7 matrix of daily temperatures

Here are some other terms that you may encounter when dealing with matrix operations: a square matrix is a matrix with the same number of rows as columns. A vector is a matrix with only one row, and a column vector is a matrix with only one column. The individual numbers in a matrix are called entries, and the technical term for a plain number is a scalar. Now you can bring these sure-fire conversation stoppers to the next party you attend.

Applying the concept of a matrix to SVG, you might express a set of x- and y-coordinates as a 2-by-1 matrix. This isn’t the way we’ll ultimately end up representing coordinates, but it’s ...

Get SVG Essentials, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.