#### Archived

This topic is now archived and is closed to further replies.

# Matrices: Multiplication.

This topic is 5434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm learning about matrix multiplication as follows. To multiply matrices, the number of columns (the up and down things) in the first matrix need to be equal to the number of rows (the left and right things) in the second matrix. Is this true? If this is true, doesn't this mean that the first matrix always has to be "smaller" (dimension wise) than the second one? (2x2 matrix)x(2x3 matrix) is possible. (3x2 matrix)x(2x3 matrix) is not possible? EDIT: Also, the above (2nd) example means that matrix multiplication is not commutative. But I read that matrix multiplication is associative. How is this possbile?
Charles Hwang -aka Tazel [MonkeyHumor My Site|E-mail|NeXe|NeHe|SDL] [Google|Dev-C++|GDArticles|C++.com|MSDN] [edited by - charles hwang on November 29, 2003 4:27:56 PM]

##### Share on other sites
quote:
Original post by Charles Hwang
(3x2 matrix)x(2x3 matrix) is not possible?

Why would it not be possible? The number of columns of the first matrix is the same as the number of rows of the second.

##### Share on other sites
Yes, in general we have that

(axb)(bxc) = (axc)

And from that it follows

((axb)(bxc)) (cxd) = (axc) (cxd) = (axd)
(axb) ((bxc)(cxd)) = (axb) (bxd) = (axd)

So, at least dimensionwise multiplication is associative.

##### Share on other sites
I thought that it was the rows of the first matrix need to be equal to the columns of the second matrix, and the resulting matrix will have the number of rows of the first matrix and the number of columns of the second matrix.

I haven''t used matrices in quite a while, not since 10th grade (I don''t even use them in game programming very often to be honest).

##### Share on other sites
Well if my book is correct, it is the columns[Matrix A] = rows[Matrix B] resulting in the matrix of dimension size column x row.

Charles Hwang -aka Tazel
[MonkeyHumor My Site|E-mail|NeXe|NeHe|SDL]

##### Share on other sites
am i wrong in thinking that it depends if the matrix is column major or row major?

##### Share on other sites
Jx: Column major or row major is just how they are laid out in computer memory, it does not affect how they are multiplied.

To you multiply a (a x b) matrix with a (c x d) matrix, b must be equal to c, and the result will be a (a x d) matrix.

##### Share on other sites
I was right about the resulting matrix having the number of rows of the first matrix and the number of columns from the second matrix, and you were right about the fact that in order for the multiplication to be possible the number of columns from the first matrix must be equal to the number of rows of the second matix.

whew

##### Share on other sites
    /a11  a12\   A = |a21  a22|    \a31  a32/B = /b11  b12  b13\      \b21  b22  b23/            /(a11b11 + a12b21)  (a11b12 + a12b22)  (a11b13 + a12b23)\   C = A * B = |(a21b11 + a22b21)  (a21b12 + a22b22)  (a21b13 + a22b23)|            \(a31b11 + a32b21)  (a31b12 + a32b22)  (a31b13 + a32b23)/

[edited by - Useless Hacker on November 29, 2003 5:44:14 PM]

1. 1
2. 2
3. 3
4. 4
Rutin
15
5. 5

• 14
• 9
• 10
• 12
• 17
• ### Forum Statistics

• Total Topics
632910
• Total Posts
3009177
• ### Who's Online (See full list)

There are no registered users currently online

×