How to Solve Non-Square Matrix Equations
At a glance
- 1. Check dimensions
Write the sizes of every matrix and determine the size required for the unknown.
- 2. Test consistency
For AX = B, check whether every column of B lies in the column space of A.
- 3. Solve by columns
Treat each column equation Ax = b as an ordinary linear system and combine the solutions.
- 4. Choose a solution type
Report exact solutions when they exist; otherwise use least squares if an approximate fit is intended.
A rectangular matrix generally has no ordinary inverse, so you cannot solve a matrix equation by multiplying by . Instead, identify the dimensions and interpret the equation as one or more systems of linear equations. This approach applies whether you are solving , , or a more complicated equation involving an unknown matrix.
The most common case is , where and are known and is unknown. The equation may have no exact solution, a unique solution, or infinitely many solutions.
Start with dimensions
Suppose is an matrix and is an matrix. For the product to be defined and equal to , must be an matrix:
Write the unknown as columns, , and write . Then means
So you can solve the equation by solving ordinary systems with the same coefficient matrix , one for each column of .
Decide whether exact solutions exist
A system has a solution exactly when is in the column space of . Therefore, has an exact solution exactly when every column of is in the column space of .
You can test this by row-reducing the augmented matrix . If row reduction produces a row whose coefficient entries are all zero but whose entry in is nonzero, the equation is inconsistent. Otherwise, the solutions can be found by expressing pivot variables in terms of any free variables.
The number of solutions depends on the rank of and consistency:
- If has full column rank (), each consistent column system has a unique solution.
- If , a consistent system has free variables and therefore infinitely many solutions (over ).
- If any column system is inconsistent, there is no exact matrix satisfying the equation.
Worked example: a rectangular equation with infinitely many solutions
Let
Since is and is , the unknown must be . Write its columns as and . Solving gives
Set the free variable . Then and . The second column gives, in the same way, , , and . Thus every solution is
For example, taking gives one solution. Substituting it verifies the equation:
The two free parameters arise because has three columns but rank two. Each column system has one free variable.
If the equation is
The same principle works, but the row space replaces the column space. If is , then must have columns for to be defined. Each row of is a linear combination of the rows of . Consequently, has a solution exactly when every row of lies in the row space of .
You can also transpose the equation: is equivalent to . Then solve it as a left-multiplication problem, one column at a time.
If there is no exact solution: least squares
In applications, may be inconsistent because data contain measurement error or because the system is overdetermined. A common alternative is to choose that minimizes the total squared residual, , where the Frobenius norm sums the squares of all entries.
The Moore–Penrose pseudoinverse gives a standard least-squares choice: . When has full column rank, this simplifies to . In numerical work, QR factorization or singular value decomposition is generally preferred to explicitly forming that inverse. Least squares gives an approximate fit; it does not turn an inconsistent equation into an exact one.
Common mistakes
- Trying to invert a rectangular matrix. Ordinary matrix inverses are defined only for square matrices, and even a square matrix must be nonsingular. Use elimination or a pseudoinverse for the relevant problem instead.
- Ignoring dimensions. Check the inner dimensions of every product before solving, and state the size of the unknown.
- Assuming consistency. A rectangular system can have no solution. Check the augmented system or the column-space condition first.
- Giving just one solution when there are free variables. A particular solution does not describe all solutions. Include the free parameters, or state clearly that you are giving one example.
- Confusing exact and least-squares solutions. A least-squares answer minimizes error; it satisfies exactly only if the residual is zero.
For equations with the unknown matrix appearing more than once, such as , you can often convert the problem into a scalar linear system in the entries of . The dimensions and placement of the unknown determine which system to solve.
References
- Linear Algebra and Its Applications, David C. Lay, Steven R. Lay, and Judi J. McDonald
- Introduction to Linear Algebra, Gilbert Strang
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.