In general, a matrix is a 2-dimensional array, together with some operations, such as multiplication and addition, defined for the array.
For the sake of simplicity, this chapter assumes that all the matrices are n-by-n ``square'' arrays: the number of rows and columns are the same. Generalizing the ideas to work with rectangular arrays is left as an exercise.
Note: the subscripts or indices of the elements of the matrix range from (0,0) (at the upper left corner of the array) to (n-1, n-1) (at the lower right corner). This is somewhat different than you might see in mathematical texts, where the subscripts start and 1 and end at n. I have made this change in order to make it easier to understand matrices in the context of C's zero-based arrays, but you should be aware that my notation is different than what you might see elsewhere.
For example, the C array written int A[2][2] would be written as matrix
The matrix element denoted as corresponds to the C array element A[i][j].