Jump to content

Matrix multiplication

Featured Replies

Hi all,

 

I am trying to understand matrix multiplication in MATLAB.

 

If we have the following two matrices:

 

a b w x

 

c d y z

 

Then, in what order should the elements by multiplied?

 

Any help is greatly appreciated.

 

Tridimity

 

 

The order begins with an imaginary point situated at the center of the two matrices.

 

 

a->w

a->x

a->z

a->y

 

b->w

b->x

b->z

b->y

 

d->w

.....

 

c->w

.....

Edited by Arnaud Antoine ANDRIEU

I have no idea what AAA is talking about...

 

if you have matrix A with elements [math]A_{ij}[/math] and matrix B with elements [math]B_{jk}[/math] (and I picked the dimensions on purpose there.... the second dimension of A has to equal the first dimension of B, hence they both used j)

 

The matrix C = A * B will be defined by

 

[math]C_{ik} = \sum^m_{j=1}A_{ij}B_{jk}[/math]

 

where m represents the number of columns in A and rows in B.

 

For your 2x2 example:

 

[math]C_{1,2} = \sum^2_{j=1}A_{1,j}B_{j,2} = A_{1,1}B_{1,2} + A_{1,2}B_{2,2}[/math]

 

In terms of what order you do these operations in, there are incredibly fast optimized routines out there. You might want to look at the source of something like BLAS (http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) to see how they code it efficiently. But in terms of getting the right answer, order is unimportant so long as you multiply and add the right things together.

Edited by Bignose

Archived

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.