What Are the Practical Uses of Matrix Multiplication?
At a glance
- 1. Interpret the dimensions
Check that the first matrix’s columns equal the second matrix’s rows.
- 2. Multiply rows by columns
Each output entry is a row–column dot product.
- 3. Interpret the result
Read the product as a combined transformation, data calculation, or network operation.
- 4. Apply the model
Use the resulting matrix for graphics, systems, probabilities, or data analysis.
Try it: Matrix calculator
Matrix multiplication is more than a rule for filling in a larger table of numbers. It is a compact way to combine linear operations and to calculate many weighted sums simultaneously. That is why it appears in computer graphics, engineering, probability, economics, data analysis, and machine learning.
The key interpretation is this: if matrix performs one operation and matrix performs another, then represents doing first and second.
How matrix multiplication works
If has dimensions and has dimensions , then the product exists and has dimensions . Its entries are
In plain language, each entry of is the dot product of one row of with one column of .
For example, let
Then
The order matters. In general, , and sometimes is not even defined.
Combining geometric transformations
A point in the plane can be represented as a column vector:
A matrix can rotate, reflect, stretch, or shear that point. For example, the matrix
rotates vectors counterclockwise, because
The matrix
stretches horizontal coordinates by and vertical coordinates by .
To stretch first and then rotate, use , not :
Applied to , this gives
This idea is used constantly in computer graphics, animation, robotics, computer vision, and geographic coordinate systems. A three-dimensional graphics program may multiply a model matrix, a rotation matrix, a camera matrix, and a projection matrix to determine where an object appears on the screen.
Solving many linear equations
A system of linear equations can be written as
For example, the system
becomes
Matrix multiplication packages both left-hand sides into one expression. This makes it possible to use systematic methods such as Gaussian elimination, matrix factorizations, or numerical software.
The same structure models currents in electrical circuits, forces in mechanical systems, chemical reaction balances, supply and demand equations, and constraints in engineering designs.
Weighted sums in data analysis
Suppose three products have prices \2$5$81043$ units. Put the prices in a row vector and the quantities in a column vector:
The product gives the total revenue, \64$.
With many shops or many products, matrices perform all these calculations together. A matrix of observations can be multiplied by a vector of weights to produce scores, predictions, totals, or averages. This is the basic operation behind linear regression and many other statistical models.
For instance, if a prediction uses income, years of experience, and an intercept, the model can be written as
where each row of describes one case and contains the fitted coefficients.
Networks and repeated processes
A matrix can describe connections in a network. In an adjacency matrix, the entry may be when node connects to node and otherwise. The entries of count the number of two-step paths between nodes. More generally, describes walks of length .
Matrix multiplication also models repeated transitions. In a Markov chain, using the column-vector convention, let be the probability of moving from state to state , so each column of sums to . If is the initial probability vector, then
Thus gives two-step transition probabilities, and gives probabilities after ten steps. Applications include inventory systems, web-page ranking, population models, queues, and board-game simulations.
Images and machine learning
An image can be stored as a matrix of pixel intensities. Matrix operations can blur, sharpen, resize, or transform the image. A simple operation may replace each pixel by a weighted combination of nearby pixels; this is closely related to matrix-based filtering and convolution.
In a neural network layer, the main calculation is typically
followed by a nonlinear activation function. Here contains learned weights, contains input features, and contains biases. Multiplying by many input vectors is what allows the network to process large datasets efficiently.
Common mistakes
- Ignoring dimensions: An matrix can multiply an matrix, not an arbitrary pair of matrices.
- Multiplying corresponding entries: Ordinary matrix multiplication uses row–column dot products. Entrywise multiplication is a different operation.
- Reversing the order: means apply first and then when matrices represent transformations.
- Assuming commutativity: Usually .
- Confusing row and column vectors: The convention affects whether a transformation is written as or .
- Forgetting units: In physical models, matrix entries must have compatible units for each sum to make sense.
A useful test is to ask what each matrix represents. If the matrices describe successive transformations, transitions, or weighted calculations, their product usually has a direct practical interpretation rather than being merely an arithmetic result.
References
- Introduction to Linear Algebra, Gilbert Strang
- Linear Algebra and Its Applications, David C. Lay
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.