A matrix is just a two-dimensional ordered array of numbers. If you have a sheet of graph paper and you mark off a square four spaces high and four spaces wide, then fill each of the 16 grid squares with a number, you have made a matrix. A horizontal line within a matrix is a row, and the vertical lines are columns. There are several ways of classifying matrices according to their content, but the most basic classification is by size. A "five by three" matrix -- usually labeled "5 x 3" -- has five rows and three columns.
There are a special class of matrices that consist of entries ordered in a single dimension: Either all in one row or all in one column. These "1 x n" or "n x 1" matrices are called vectors. A "1 x n" vector is a row vector, and a "n x 1" vector is a column vector. If a matrix has the same number of rows and columns, it's a square matrix. A square matrix in which all the elements below the diagonal are zero is called an upper triangular matrix. If all the off-diagonal elements are zero, then it's a diagonal matrix.
Matrices can be multiplied, but it's not just a matter of multiplying the components. For matrices to be multiplied, the number of columns in the left matrix must match the number of rows in the right matrix. To start to multiply, take the first column of the second matrix and tip it sideways, turning it into a row instead of a column, and match it up to the first row of the left matrix. Then multiply the first element of each of the two rows, the second of each, all the way to the last element, and add them all together. Repeat the process while working through all the rows and columns. The final matrix has the same number of rows as the first matrix and the same number of columns as the second matrix.
Matrices are a convenient tool for solving problems. For example, an equation like 3x - 2y +8z = 9 can be written as the row vector [3 -2 8] times the column vector [x y z]. Remember, that would really be written as a vertical column with "x" at the top and "z" at the bottom. This might not look that helpful until you add in more equations. For example, if there were three separate equations, the matrix of coefficients would be a 3 x 3 matrix, multiplied by the x y z column vector. This is more than just a shorthand way of writing the equations out. Manipulating the matrices consolidates many separate steps that would be needed to solve the system of equations.
Matrices in computer programming follow the same basic format as matrices in mathematics; that is, they are ordered arrays of elements. In many computer programs, different types of elements can be combined in a single array. For example, the first row of a matrix for payroll calculations might have names, the second row pay rates and the third row tax brackets. These structures are more properly called "arrays," just to avoid confusion with the mathematical entities.