2

I can multiply a vector by a matrix like so: $$\begin{pmatrix}a\\ b \\ c\end{pmatrix}\cdot\begin{pmatrix}d & e & f \\ g & h & i \\ j & k & l \end{pmatrix} = \begin{pmatrix} ad + be + cf \\ ag + bh + ci \\ aj + bk + al\end{pmatrix},$$

but how do I divide? $$\begin{pmatrix} a \\ b\\c\end{pmatrix}/\begin{pmatrix} d &e& f\\ g& h& i \\ j& k& l\end{pmatrix}=\,?$$

I've looked everywhere and simply can't find an answer.

gebruiker
  • 6,154
  • How much do you know about linear algebra? – 5xum Aug 31 '15 at 07:45
  • nothing. im 14. what these really represent are a position, a transformation and a position. i thought this question would be more appropriate on mathematics instead of stackoverflow – Indiana Kernick Aug 31 '15 at 07:48
  • You can't do that multiplication. You can only multiply the matrix (on the left) by the vector (on the right). Multiplication is not commutative. – Bernard Aug 31 '15 at 07:49
  • so you're saying that the vector must be on the right. so you can't divide a vector by a matrix? – Indiana Kernick Aug 31 '15 at 07:52
  • You can divide by some matrices. In particular, a matrix $A$ is invertible if you can define an "inverse matrix" $A^{-1}$ that will satisfy $$ A^{-1} \cdot A\cdot y = y $$ but we cannot always do this. – Ben Grossmann Aug 31 '15 at 07:58
  • If you want to find an answer to these questions elsewhere, you should look up "linear algebra" and "matrix inverse". – Ben Grossmann Aug 31 '15 at 08:01

2 Answers2

8

For a matrix $$A=\begin{bmatrix}d&e&f\\g&h&i\\j&k&l\end{bmatrix}$$

and a vector $y=\begin{bmatrix}a\\b\\c\end{bmatrix}$

the product $y\cdot A$ is not defined.

The product $A\cdot y$, on the other hand, is defined by

$$Ay = \begin{bmatrix}ad + be + cf\\ag + bh + ci\\aj + bk + al\end{bmatrix}$$


But your question is how to divide by the matrix, and the answer is: it's complicated. In general, division by a matrix is not well defined and is usually not referred to as dividing by a matrix.


First, let's see division in real numbers. What does $x=\frac{a}b$ really mean? $x=\frac ab$ really means that $x$ is the unique solution to the equation

$$bx=a$$

For example, $\frac12$ is the number that we have to multiply by $2$ to get the result of $1$.


Similarly, when you want to ask "What is $y$ divided by $A$", what you are really asking is

Which vector $x$ do I need to multiply by $A$ to get $y$?

Or, in other words, you are solving the equation $$Ax=y$$ and you want to solve it for $x$.

Now, you run into problem.

  1. What if all elements of $A$ are $0$, but $y$ is not all zero? Then obviously, any vector $x$, multiplied by $A$, will be equal to $0$, so there is no solution to $Ax=y$.
  2. What if all elements of $A$ and $y$ are both zero? Then any vector $x$ will be a solution to $Ax=y$.

These two problems are similar to the division by $0$ problem in real numbers: The equation $0\cdot x=1$ has no solutions, and $0\cdot x=0$ has infinitely many solutions.

However, it gets worse. The matrix

$$A=\begin{bmatrix}1&0&0\\1&0&0\\1&0&0\end{bmatrix}$$

also causes problems, since $$A\cdot\begin{bmatrix}a\\b\\c\end{bmatrix}=\begin{bmatrix}a\\a\\a\end{bmatrix}$$

no matter what $b,c$ are. Again, you have zero solutions for the equation $Ax=\begin{bmatrix}1\\0\\0\end{bmatrix}$ and infinitely many solutions for $Ax=\begin{bmatrix}1\\1\\1\end{bmatrix}$.

Ben Grossmann
  • 225,327
5xum
  • 123,496
  • 6
  • 128
  • 204
  • 1
    so i should just throw my hands in the air and try something else. – Indiana Kernick Aug 31 '15 at 08:01
  • @Kerndog73 is there a reason you wanted to try this in the first place? Perhaps that is what you should be asking about. – Ben Grossmann Aug 31 '15 at 08:02
  • @Kerndog73 Why would you do that? – 5xum Aug 31 '15 at 08:03
  • @Kerndog73 Do you know how to solve systems of linear equaitions? – 5xum Aug 31 '15 at 08:04
  • normally, you would take the position of every pixel in the first image then multiply each of those buy a transformation matrix (to rotate, skew, flip, scale and all that) to get the new position on a second image. You could solve a lot of problems by dividing the position in the second image by the transformation to get the position on the first image – Indiana Kernick Aug 31 '15 at 08:06
  • i hope i explained that clearly enough – Indiana Kernick Aug 31 '15 at 08:07
  • i don't anything about linear algebra – Indiana Kernick Aug 31 '15 at 08:10
  • @Kerndog73 Well, if you have a matrix $A$, you can always try to calculate $A^{-1}$. That is the matrix that satisfies the equaiton $AA^{-1} = I$. Then, the solution to $Ax=y$ is $x=A^{-1}y$. But I advise you to instead look a little deeper into linear algebra... – 5xum Aug 31 '15 at 08:10
  • @5xum thanks, you've been a great help. I'll look into linear algebra. – Indiana Kernick Aug 31 '15 at 08:13
  • @Kerndog73 if it's just for this one task, and since you are 14, maybe just find some program capable of finding $A^{-1}$. Linear algebra is a pretty advanced topic at your age, but if you feel up to it, go right ahead! Be prepared for a pretty hefty textbook and a lot of definitions, however. – 5xum Aug 31 '15 at 08:17
0

If $A$ and $B$ are the matrices, and $B$ is square and invertible, then $A / B$ can be interpreted as $A$ * inverse($B$), assuming the number of columns of $A$ is the same as the number of rows of inverse($B$).

Related to this, if $B$ is square and invertible, then inverse($B$) = $B^{-1}$. So $B^{-n} = (\text{inverse}(B))^n$.