Composing Music with Computers

A matrix is an arrangement of numbers in rows and columns. For example:

This example is a 4 2 matrix in the sense that it has 4 rows and 2 columns. More generally, an r c matrix has r rows and c columns.
An individual entry in a matrix is technically referred to as an element and it is represented in the form a rc, that is, the element of the rth row and the c th column. For example, the element a 32 in the above matrix is the number 87. Matrices are normally represented by capital letters and their elements with lower cases: A = [ a rc].
Two matrices A = [ a rc] and B = [ b rc] are only equal if they are of the same dimension and if a rc = b rc for all values of r and c. A matrix with the same number of rows and columns is a square matrix and the sequence of elements running from the top left to the bottom right of a square matrix is called the diagonal of the matrix. If there is a mirror-image of patterns of numbers reflected in the diagonal, than the matrix is said to be symmetric. Example:

Sometimes, the rows and columns of a matrix need to be interchanged. This operation...