Matrices: operations, the row-by-column product and the inverse
Why the row-by-column product is composition, properties and non-commutativity, special matrices and the transpose, the 2×2 inverse and computing it with Gauss-Jordan.
A matrix is a table of numbers, but above all it is a compact way of writing transformations and systems. In this lesson we cover matrix operations, why the row-by-column product is defined the way it is, special matrices and how to compute the inverse.
Definitions
An
matrix has
rows and
columns; the entry in row
and column
is written
. If
the matrix is square of order
. Real
matrices form the set
.
Addition and multiplication by a scalar are done entry by entry, and they have the same properties as for vectors:
is a vector space of dimension
.
The row-by-column product
If
is
and
is
, the product
is the
matrix with
![Rendered by QuickLaTeX.com \[ (AB)_{ij} = \sum_{k=1}^{n} a_{ik}\,b_{kj} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-7395dd36feec30fbb12e0fae5ccfff4e_l3.png)
that is, the dot product of row
of
with column
of
. The number of columns of
must equal the number of rows of
.
![]()
Why it is defined this way
A matrix
transforms a vector
into the vector
. If we first apply
and then
, we get
. Writing out the components:
![Rendered by QuickLaTeX.com \[ \big(A(B\mathbf x)\big)_i = \sum_k a_{ik}\,(B\mathbf x)_k = \sum_k a_{ik}\sum_j b_{kj}x_j = \sum_j\Big(\sum_k a_{ik}b_{kj}\Big)x_j \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-54e89a3ea904d02d299d7ed906e956a6_l3.png)
The coefficient in brackets is exactly
: the matrix product is the composition of the transformations. It follows at once that the product is associative,
, because composition of functions is.
The product is not commutative
In general
, even when both exist. Rotating by 90° and then reflecting in the
axis does not give the same result as reflecting and then rotating. Other differences from numbers:
does not imply
or
: for example
;- from
you cannot “cancel”
, unless
is invertible.
Special matrices
- Identity
: 1 on the diagonal, 0 elsewhere.
. - Diagonal: zeros off the diagonal. They multiply entry by entry along the diagonal, and their powers are trivial.
- Triangular, upper or lower: zeros below (or above) the diagonal. The echelon form of Gaussian elimination is upper triangular.
- Transpose
: rows and columns swapped,
. We have
(mind the order). - Symmetric:
. They appear everywhere, from covariance matrices to the stiffness matrices of structures, and have special properties we will meet with the spectral theorem.
The inverse matrix
A square matrix
is invertible if there is
with
. If it exists it is unique, and the system
has the single solution
.
We have
and
. A matrix is invertible if and only if its determinant is non-zero (see the lesson on the determinant), that is if and only if its rank is
.
The 2×2 case. If
:
![Rendered by QuickLaTeX.com \[ \begin{pmatrix} a & b\\ c & d \end{pmatrix}^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b\\ -c & a \end{pmatrix} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-f3f7b168da90667b7394ff4a8d6dcdc8_l3.png)
Check by multiplying: the product gives
, divided by
.
Computing the inverse with Gauss-Jordan
Place the identity next to
and apply elementary operations until
becomes
:
appears on the right.
![Rendered by QuickLaTeX.com \[ \left(\begin{array}{cc|cc} 2 & 1 & 1 & 0\\ 5 & 3 & 0 & 1 \end{array}\right) \xrightarrow{R_2 - \frac52 R_1} \left(\begin{array}{cc|cc} 2 & 1 & 1 & 0\\ 0 & \frac12 & -\frac52 & 1 \end{array}\right) \xrightarrow[R_1 - R_2]{2R_2} \left(\begin{array}{cc|cc} 2 & 0 & 6 & -2\\ 0 & 1 & -5 & 2 \end{array}\right) \xrightarrow{\frac12 R_1} \left(\begin{array}{cc|cc} 1 & 0 & 3 & -1\\ 0 & 1 & -5 & 2 \end{array}\right) \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-cb3e100353843f6cfd54dda16c55a0a0_l3.png)
So
, as the 2×2 formula with
confirms.
Why it works. Each elementary operation amounts to multiplying on the left by an elementary matrix
. If
, then the product
is exactly
, and applied to
it gives
. If during the process a row on the left becomes all zeros,
is not invertible.
A practical tip
To solve
on a computer you never compute
: it costs about three times as much as Gaussian elimination and is numerically less accurate. The inverse is a theoretical tool, useful for writing formulas; in programs you use
in MATLAB or numpy.linalg.solve.





