# Confusion related to matrix inverse

I have this confusion related to matrix inverse. Lets say I have this equation

$AX=B$,

Then is it $X=A^{-1}B$ or $X=BA^{-1}$.

When I say A/B is it $A^{-1}B$ or $BA^{-1}$.

-

Matrix multiplication is not in general commutative, so you have to pay attention to the order of the factors when you multiply. To solve the equation $AX=B$, you want to get rid of the $A$ by multiplying it by its inverse, so you have to multiply on the left: $A^{-1}(AX)=(A^{-1}A)X=IX=X$. As usual, you must do exactly the same thing to the other side of the equation, so you end up with $X=A^{-1}B$, not $X=BA^{-1}$.

You should not say $B/A$ at all: division of matrices is undefined, so that combination of symbols is meaningless.

-

You multiply by $A^{-1}$ to cancel the $A$. So, to cancel $A$ from $AX$, you need to multiply by $A^{-1}$ on the left side...

Your solution is basically the following:

$$AX=B \Rightarrow A^{-1}AX=A^{-1}B \Rightarrow X= A^{-1}B$$

Similarly, if you solve $XA=B$, to cancel $A$ you need to multiply to the right, thus in that case, $X=BA^{-1}$.

-
@All Actually I am confused how the matlab does the work. If I have matrix A of size 3x4 and matrix B of size \$x4, if I do A/B it gives me a resultant matrix of size 3x4. If I do B/A it gives me a resultant matrix of size 4x3. I am not sure what matlab does and what equation it solves behind? –  user34790 Oct 11 '12 at 3:16
@All Actually I am confused how the matlab does the work. If I have matrix A of size 3x4 and matrix B of size 4x4, if I do A/B it gives me a resultant matrix of size 3x4. If I do B/A it gives me a resultant matrix of size 4x3. I am not sure what matlab does and what equation it solves behind? –  user34790 Oct 11 '12 at 3:24