0
$\begingroup$

Say I have two matrices $A$ and $B$ where $A$ has dimensions of $1 \times 2$ ($1$ row, $2$ columns) and $B$ has dimensions of $2 \times 3$ ($2$ rows, $3$ columns)

When you multiply these like so $(A \cdot B)$ you get a $1 \times 3$ matrix.

It was my understanding that this was correct, but I was advised by a grader that I should have done it like so, where $A$ as a $2 \times 1$ matrix and $B$ as a $3 \times 2$ matrix

Then, when multiplying do it like so $(B \cdot A)$ which gives a $3 \times 1$ matrix.

Both approaches give the same three numbers, except one is a $3 \times 1$ matrix and the other a $1 \times 3$.

It was my belief that both were correct and which one you chose is arbitrary. Have I misunderstood?

Additionally, the matrices were intended to reflect the weights on a graph in a figure. Should the presentation of such a graph effect how I decide to represent their dimensions as matrices? Again, I didn't think this was the case...

$\endgroup$
  • 1
    $\begingroup$ Matrix multiplication is not commutative. $\endgroup$ – Zain Patel Jul 5 '15 at 13:19
0
$\begingroup$

In general, matrix multiplication is not commutative, so $$A\cdot B \neq B \cdot A$$ this means that you cannot arbitrarily choose one product over another. You must choose the right product given the context of the situation, even if both products give the same numbers.

In your specific situation, it looks like you are computing the transpose of the products.

$\endgroup$
  • 1
    $\begingroup$ It seems you a re correct about the "specific situation". My textbook says that if a network has 2 input nodes and 3 outputs then you should represent the weights matrix as a 3x2 matrix. It doesn't say why though? I'll just accept it. $\endgroup$ – COOLBEANS Jul 6 '15 at 6:52
0
$\begingroup$

It sounds like the grader wants you to use the transpose of each matrix. In general,

$$(AB)^T=B^TA^T$$

$\endgroup$
0
$\begingroup$

I do not know what you did for $B\cdot A$, but it was no matrix multiplication: $$ (BA)_{ik}=\sum_{j=1}^n b_{ij} a_{jk} $$ but $B$'s column index $j$ would range from $1$ to $3$ while $A$'s row index $j$ can only take the value $1$, so this will not work as common ranges are needed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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