Square matrix definition and properties
A square matrix is a grid of numbers with the same count of rows and columns, so an n by n matrix. That one fact is what lets you add it to another matrix of its size, multiply it by another one, find its diagonal and build an identity matrix, which a non-square grid cannot do in the same way.
For students and parents planning test prep or coursework: one hour with George Li, one to one by video, is $180, $200 or $160, by subject. You leave with a written plan within one working day.
Book your first session| Term | Meaning | Example, using A = [[2, 1], [3, 4]] |
|---|---|---|
| Size | rows by columns | 2 by 2, so A is square |
| Entry a(r,c) | the number in row r, column c | a(1,2) = 1, a(2,1) = 3 |
| Main diagonal | entries with equal row and column numbers | 2 and 4 |
| Trace | sum of the main diagonal | 2 + 4 = 6 |
| Identity matrix I | ones on the diagonal, zeros elsewhere | [[1, 0], [0, 1]] |
Entries are written with the row number first and the column number second.
Standard definitions of linear algebra, restated by us with our own examples
What is a matrix, and how is its size written?
A matrix is a rectangle of numbers arranged in rows, which run across, and columns, which run down. Its size is given as rows by columns, in that order, so a matrix with 2 rows and 3 columns is a 2 by 3 matrix, and a 3 by 2 matrix is a different shape. When the two counts are equal, as in 2 by 2 or 3 by 3, the matrix is square.
To name a single number, give its row first and its column second. Take the 3 by 3 matrix whose rows are 1, 2, 3 and 4, 5, 6 and 7, 8, 9. The entry in row 2, column 3 is 6, written a(2,3) = 6.
The main diagonal of that matrix runs from the top left to the bottom right through 1, 5 and 9, and its trace is 15. In a square matrix the diagonal ends exactly in the opposite corner, which is why the trace is defined for square matrices.
What is the identity matrix?
The identity matrix has 1 in every diagonal position and 0 in every other position. It acts like the number 1 does for ordinary multiplication: multiplying any square matrix of the same size by it, on either side, returns the matrix you started with. For the 2 by 2 matrix A above, I times A gives [[2, 1], [3, 4]] again, because each row of I picks out one row of A and nothing else.
How do you add and subtract square matrices?
Add or subtract the entries that sit in the same position, which means the two matrices must have the same size. Take A = [[2, 1], [3, 4]] and B = [[0, 5], [−1, 2]].
- Position (1,1): 2 + 0 = 2.
- Position (1,2): 1 + 5 = 6.
- Position (2,1): 3 + (−1) = 2.
- Position (2,2): 4 + 2 = 6.
So A + B = [[2, 6], [2, 6]]. A 2 by 2 matrix cannot be added to a 3 by 3 matrix, even though both are square, because the positions do not line up. Subtraction works the same way, entry by entry.
How do you multiply two square matrices?
To find the entry in row r and column c of the product, multiply the entries of row r of the first matrix by the matching entries of column c of the second, and add the products. With A and B above:
- Row 1 of A with column 1 of B: 2 × 0 + 1 × (−1) = −1.
- Row 1 of A with column 2 of B: 2 × 5 + 1 × 2 = 12.
- Row 2 of A with column 1 of B: 3 × 0 + 4 × (−1) = −4.
- Row 2 of A with column 2 of B: 3 × 5 + 4 × 2 = 23.
So AB = [[−1, 12], [−4, 23]]. Now reverse the order. Row 1 of B with column 1 of A gives 0 × 2 + 5 × 3 = 15, row 1 of B with column 2 of A gives 0 × 1 + 5 × 4 = 20, row 2 of B with column 1 of A gives −1 × 2 + 2 × 3 = 4, and row 2 of B with column 2 of A gives −1 × 1 + 2 × 4 = 7. So BA = [[15, 20], [4, 7]].
The two products differ, which shows that matrix multiplication depends on order. Addition does not: A + B always equals B + A. Multiplying by a single number, called a scalar, is easier still, since each entry is multiplied: 3A = [[6, 3], [9, 12]].
What is a 2 by 2 determinant?
For a 2 by 2 matrix [[a, b], [c, d]], the determinant is ad − bc. For A it is 2 × 4 − 1 × 3 = 5. A square matrix has a determinant and a non-square one does not, which is one more reason the square case gets special attention.
What mistakes should you watch for?
- Multiplying entry by matching entry for a product. That is not matrix multiplication.
- Switching the order of a product and assuming the answer is the same.
- Adding matrices of different sizes.
- Writing the column number before the row number in an entry name.
When does a tutor help with matrices?
A tutor helps when row-by-column multiplication keeps losing track of positions, since a short drill with a colored pen for each row fixes most of it. See the college courses page, the packages, or book a first session.
Common questions
What makes a matrix square?
It has the same number of rows as columns, such as 2 by 2 or 4 by 4.
Can any two square matrices be multiplied?
Any two n by n matrices can be multiplied in either order, but the two products are usually different.
What does the identity matrix do?
Multiplying a square matrix by the identity of the same size gives back the same matrix.
What is the main diagonal?
The entries from the top left to the bottom right, where the row number equals the column number.