How to produce an n xx n matrix from an n^2 xx 1 vector?

Jayvion Caldwell

Jayvion Caldwell

Answered question

2022-07-22

Let's say I'm given a vector as follows:
x = [ 1 2 3 4 ]
And I'd like to produce the following matrix:
A = [ 1 2 3 4 ]
What series of operations can I induce to produce this matrix?

Answer & Explanation

dtal50

dtal50

Beginner2022-07-23Added 10 answers

With the use of the diagonal operator diag(x), which gives the diagonal matrix whose diagonal has the entries of x on it, we can write
[ 1 1 0 0 0 0 1 1 ] diag ( a , b , c , d ) [ 1 0 0 1 1 0 0 1 ] = [ a b c d ]
in the 2 × 2 case.
In the n × n case:
The first matrix should be a "stretched out" version of the n × n identity matrix I n : repeat each column of I n , n times. In terms of the Kronecker product we can write this matrix as I n j T , where j R n is the all-1 vector.
The second matrix should be n copies of I n stacked on top of each other. In terms of the Kronecker product we can write this as j I n
Without the diagonal operator, there is no single matrix multiplication that will produce the result. If we do any kind of multiplication with vector x, the resulting matrix will always have column rank at most 1.
However, as the other answer points out, we can add together n different matrix multiplications, getting a solution of the form i = 1 n A i x B i . Written in terms of the Kronecker product, this solution is
i = 1 n ( I n ( e i ) T ) x ( e i ) T
where e i is the i th standard basis vector: the i th column of I n
Levi Rasmussen

Levi Rasmussen

Beginner2022-07-24Added 6 answers

( 1 0 0 0 0 1 0 0 ) ( a b c d ) ( 1 0 ) = ( a 0 b 0 )
( 0 0 1 0 0 0 0 1 ) ( a b c d ) ( 0 1 ) = ( 0 c 0 d )
Add them together and you are done. I think this generalizes in an obvious way.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?