# Expressing vector aglebra in a matrix

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

## Recommended Posts

If I have an expression like
(A·V)B where A,V, and B are vectors
is there a way to express this as
MV where M is a square matrix
I'm looking for a general method not dependant on a specific number of coordinates. Also for future reference, what do you call such a conversion?

##### Share on other sites

M =[a1*b1       a2*b1       a3*b1       ...      an-1*b1    ][a1*b2       a2*b2       a3*b2       ...      an-1*b2    ][a1*b3       a2*b3       a3*b3       ...      an-1*b3    ][...         ...         ...         ...      ...        ][a1*bn-1     a2*bn-1     a3*bn-1     ...      an-1*bn-1  ]

I'm pretty sure that's right, but not 100%.
Quote:
 Also for future reference, what do you call such a conversion?
I don't know.

Thanks a lot.

##### Share on other sites
Well, jyk's result is correct (though I don't see the reason for stopping at
index n-1, makes it kind of hard to read...).

To see why it is correct, note that A·V is just a number, and can thus be
moved to the right of B, i.e. (A·V)B = B(A·V).
Now, if we use matrix notation for the vectors, A·V can be written A^tV,
where A^t is the transpose of A.
This means that (A·V)B = BA^tV = MV, where M=BA^t, which is exactly jyk's
result in the case of (n-1)-dimensional vectors.

##### Share on other sites
Quote:
 (though I don't see the reason for stopping at index n-1, makes it kind of hard to read...)
Oops, sorry, should've been 'n'. Just a habit from 0-based indexing...

##### Share on other sites
I do believe a(b.c) = (b.c)a because of associativity laws. Or maybe it's commutativity laws.

It's one of them.

awesome

##### Share on other sites
Quote:
 Original post by jlgosseI do believe a(b.c) = (b.c)a because of associativity laws. Or maybe it's commutativity laws.It's one of them.

No, matrix multiplication is (usually) not communitive, so a(b.c)!=(b.c)a, but a(b.c)=(a.b)c, under the laws of associativity.

##### Share on other sites
Quote:
Original post by eleusive
Quote:
 Original post by jlgosseI do believe a(b.c) = (b.c)a because of associativity laws. Or maybe it's commutativity laws.It's one of them.

No, matrix multiplication is (usually) not communitive, so a(b.c)!=(b.c)a, but a(b.c)=(a.b)c, under the laws of associativity.

The last equation is wrong. A simple counterexample is to take a = (0, 0, 1) and c = (1, 0, 0). Then the left hand side is (0, 0, (b·c)), which is NOT equal to the right hand side, which is ((a·b), 0, 0).

There is no need to get into commutativity or associativity. The fact that a(b·c)=(b·c)a doesn't need to be proved. (b·c) is just a number (as I said in my original answer), and in the standard definition of a vector space, only (b·c)a is defined, while a(b·c) has no meaning. It is however quite natural to let it mean the same thing, especially if you use matrix notation for the vectors, since in this case, the equation follows from matrix algebra:
[ a1 ]                 [ a1 ][ a2 ][ b·c ] = [ b·c ][ a2 ][ a3 ]                 [ a3 ]

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634049
• Total Posts
3015239
×