Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say we have:


Where A and B are known matrices, X is unknown. In case B was square, a solution can be found by $\mathbf{B^{-1}A=X}$.

But how do you attempt to solve for X when B is not square, i.e. $n\neq m$?

share|cite|improve this question
What you mentioned works only if $B$ is invertible, by the way. – InterestedGuest Feb 18 '11 at 2:54
up vote 10 down vote accepted

Let $\mathbf{a}_1,\ldots,\mathbf{a}_k$ be the columns of $\mathbf{A}$ (so $\mathbf{A}$ is $n\times k$ for some $k$). Notice that we will have $\mathbf{B}$ is $n\times m$ and $\mathbf{X}$ is $m\times k$ for some integer $m$ (for $\mathbf{BX}=\mathbf{A}$ to work out). Let $\mathbf{x}_1,\ldots,\mathbf{x}_k$ be the columns of $\mathbf{X}$.

Notice that $\mathbf{a}_i$ depends only on $\mathbf{B}$ and $\mathbf{x}_i$, since $\mathbf{Bx}_i = \mathbf{a}_i$. So to determine the $i$th column of $\mathbf{X}$, it suffices to solve the system of linear equations $$\mathbf{B}\mathbf{x}_i = \mathbf{a}_i.$$ So finding $\mathbf{X}$ is equivalent to solving $k$ systems of linear equations.

In fact, you can just do them all at the same time. Simply take a matrix that is made up of $\mathbf{B}$ followed by $\mathbf{A}$: $$\left(\mathbf{B}|\mathbf{A}\right)$$ and use Gauss-Jordan elimination on $\mathbf{B}$. The solutions you find for each column corresponding to $\mathbf{A}$ yield the columns of $\mathbf{X}$.

share|cite|improve this answer
Can you elaborate on a procedure if you were attempting to solve for B, instead of X? – user63228 Feb 21 '13 at 1:33

In addition to Arturo's answer, maybe you could take a look at mine to this question.

share|cite|improve this answer

The answer is given by the Penrose pseudoinverse:

$z=B^{pseudo}A $. While an exact solution exists only in the case $B^{pseudo}=B^{-1}$ the solution always guarantees that $||A-Bz||=minimum$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.