Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matrix-vector vs. vector-matrix multiplication

Subject: matrix-vector vs. vector-matrix multiplication

From: Sofia Häggberg

Date: 10 Aug, 2010 13:37:05

Message: 1 of 4

I=eye(3);
x=[2;-1;7];

A=I*x (possible)
A=x*I (impossible)

does this means that multiplication of matrix with vector is possible but vic-vice-versa not?

Both in matlab ans maths?

Subject: matrix-vector vs. vector-matrix multiplication

From: Andy

Date: 10 Aug, 2010 13:43:06

Message: 2 of 4

"Sofia Häggberg" <hd.int.assNOSPAM@gmail.com> wrote in message <i3rkm0$95t$1@fred.mathworks.com>...
> I=eye(3);
> x=[2;-1;7];
>
> A=I*x (possible)
> A=x*I (impossible)
>
> does this means that multiplication of matrix with vector is possible but vic-vice-versa not?
>
> Both in matlab ans maths?

Well, it means the multiplication of a 3x1 vector with a 3x3 matrix is not possible. But this is not a MATLAB limitation. Try:

A=x.'*I;

Subject: matrix-vector vs. vector-matrix multiplication

From: us

Date: 10 Aug, 2010 13:45:21

Message: 3 of 4

"Sofia Häggberg" <hd.int.assNOSPAM@gmail.com> wrote in message <i3rkm0$95t$1@fred.mathworks.com>...
> I=eye(3);
> x=[2;-1;7];
>
> A=I*x (possible)
> A=x*I (impossible)
>
> does this means that multiplication of matrix with vector is possible but vic-vice-versa not?
>
> Both in matlab ans maths?

well... it's all there in...

     doc mtimes;

us

Subject: matrix-vector vs. vector-matrix multiplication

From: Sean

Date: 10 Aug, 2010 13:47:04

Message: 4 of 4

"Sofia Häggberg" <hd.int.assNOSPAM@gmail.com> wrote in message <i3rkm0$95t$1@fred.mathworks.com>...
> I=eye(3);
> x=[2;-1;7];
>
> A=I*x (possible)
> A=x*I (impossible)
>
> does this means that multiplication of matrix with vector is possible but vic-vice-versa not?
>
> Both in matlab ans maths?

You'd have to transpose x.

The dimensions of a matrix are [m (columns) n (rows)]
Size [m1 n1]*[m2 n2] requires that n1,m2 are equal and the result will be size [m1 n2].

I'd recommend picking up a linear algebra text book or wiki page.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us