# Thread: Notation for converting a matrix into vector and back?

1. Hi,

I need to do some maths and write about it.

Among other things, I am using linear combinations of matrices:

I tried to write this as a multiplication involving the matrices and a vector , and possibly an intervening auxiliary big matrix with strategically placed ones and zeros, but it seems impossible.

Another example is adding, to each column of a matrix, a different linear combination of the columns of another matrix. There is more such unconventional reshuffling of matrix entries.

I can program all of this in SciLab, and it's feasible if burdensome. What I am having serious trouble with is describing all of this in proper mathematical notation.

I do not want to keep writing things with words like, let us define as a column vector with all the elements of matrix stacked in such-and such order. It feels messy and confusing.

So, how can I say the same thing (rearranging a matrix into a long vector) in a nice neat clear formula? And is there a notation to do the opposite: take a long vector of, say, 16 elements, and rearrange them into a 4*4 matrix? Or for any other stuff I have mentioned here?

Thanks in advance,
Leszek.

2.

3. Originally Posted by Leszek Luchowski
Hi,

I need to do some maths and write about it.

Among other things, I am using linear combinations of matrices:

I tried to write this as a multiplication involving the matrices and a vector , and possibly an intervening auxiliary big matrix with strategically placed ones and zeros, but it seems impossible.

Another example is adding, to each column of a matrix, a different linear combination of the columns of another matrix. There is more such unconventional reshuffling of matrix entries.

I can program all of this in SciLab, and it's feasible if burdensome. What I am having serious trouble with is describing all of this in proper mathematical notation.

I do not want to keep writing things with words like, let us define as a column vector with all the elements of matrix stacked in such-and such order. It feels messy and confusing.

So, how can I say the same thing (rearranging a matrix into a long vector) in a nice neat clear formula? And is there a notation to do the opposite: take a long vector of, say, 16 elements, and rearrange them into a 4*4 matrix? Or for any other stuff I have mentioned here?

Thanks in advance,
Leszek.
There is nothing magic about writing a vector as a column or a row. You can add and subtract matrices and multiply them by a scalar directly, without any "transformation". That is all that is required of a vector. So don't bother with changing the matrix, just proceed with it as is.

You can look at this in a slightly different light as well. Instead of thinking of matrices think of linear functions from one vector space to another. Once you fix a basis in each vector space there is a one-to-one correspondence between matrices and such linear funtions. The space of linear functions between two vector spaces is itself a vector space -- linear combinations of linear functions are again linear functions. So in a mathematical sense those linear functions are in fact vectors in the space of linear functions. That is precisely what you are doing when you simply treat matrices as vectors.

4. Thank you for your reaction.

Originally Posted by DrRocket
There is nothing magic about writing a vector as a column or a row. You can add and subtract matrices and multiply them by a scalar directly, without any "transformation". That is all that is required of a vector. So don't bother with changing the matrix, just proceed with it as is.
Well I do hope it's not magic. But it is a conundrum when it comes to notation. Perhaps I haven't made myself clear enough.

One of the things I need to do is a weighted sum of n matrices. The problem is not how to compute it - that's trivial. The problem is how to write it as a nice multiplication. A formula with no explicit addition. No ellipsis (as in ), no big sigma (as in ) and no programming loops like "for every...". I would like to write the weights as a vector (of n scalars), then do the sum as a kind of product of that vector by the "chain" of matrices.

Look, if my matrices were scalars too, just like the weights are, I could stack them together as another n-vector and my weighted sum would be a scalar product of two vectors. Resulting in a scalar.

If they were vectors, I could stack them together as a matrix (with the vectors as columns), then multiply this matrix by the vector of weights and get my weighted sum as a vector.

But they are matrices. I could conceivably stack them together into a 3D "metamatrix" (or whatever it would be called), but I still don't know of any nice notation to express my weighted sum.

There are more things I do, all the time manipulating short finite series of matrices in ways you normally manipulate vectors. And I get stuck for lack of notation.

One possible way to weasel myself out of this is to rearrange each m-by-n matrix into a vector of m*n elements, then do a weighted sum of vectors as a product of two matrices (as described above), then rearrange the resulting m*n-element vector back into a matrix. But at the very least I would need some kind of names or symbols for these transformation - matrix into vector and back.

I am very surprised that no such names or symbols seems yet to exist. Or maybe they do - if so, I must use the existing ones and not reinvent the wheel.

The reason why I insist on hiding the weighted sum inside a "metamatrix" multiplication, and why I abhor the plus sign and the big sigma, is that I want to do some algebra with all this. Having explicit sums all over the place would make my equations big and very confusing.

Originally Posted by DrRocket
You can look at this in a slightly different light as well. Instead of thinking of matrices think of linear functions from one vector space to another. Once you fix a basis in each vector space there is a one-to-one correspondence between matrices and such linear funtions. The space of linear functions between two vector spaces is itself a vector space -- linear combinations of linear functions are again linear functions. So in a mathematical sense those linear functions are in factor vectors in the space of linear functions. That is precisely what you are doing when you simply treat matrices as vectors.
Might be that I am thinking about them that way, but I still don't know how to write about them.

Cheers, Leszek.

5. Just set your weight vector say a = [a_1, a_2, ... a_n]

and your matrix chain say A = [A_1, A_2, ... A_n]

and define your product as some symbol (say @) having the equivalent of the dot product definition, just with your matrices treated just as a number (untill after the @ disappears). Then:

a@A

is your product.

6. Originally Posted by talanum1
... Then:

a@A

is your product.
Well, I think I will end up doing just that. But I am really surprised that there is no existing notation. Am I the first person ever doing this kind of multiplication?

Thanks again,
L.

7. Originally Posted by DrRocket
There is nothing magic about writing a vector as a column or a row. You can add and subtract matrices and multiply them by a scalar directly, without any "transformation". That is all that is required of a vector.
Absolutely! In fact this is part of the definition of a vector space: an abelian (additive) group of abstract objects which are called vectors, provided only that they are subject to scaling by some field.

You can look at this in a slightly different light as well.......... The space of linear functions between two vector spaces is itself a vector space -- linear combinations of linear functions are again linear functions. So in a mathematical sense those linear functions are in factor vectors in the space of linear functions.
.

Yes - there is a nice trick here, which (I think) illustrates this perfectly.

Let be vector spaces, and let , etc. denote the vector space of all linear maps , etc. Suppose . Obviously. , and (by the composition law)

Then what is the linear map , say? Since , we feel it must have something to do with , but it cannot be exactly for the following reason:

We seek a map whose domain is , codomain . But the domain of is , and not , similar nonsense for the codomains.

So we define the related map .

This is called the "pushforward of on ", or, by a common abuse, the pushforwrd of .

The pullback is a little harder, but I am willing to give it a pop if anyone wants.......

 Bookmarks
##### Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement