How to produce an $n \times n$ matrix from an $n^2 \times 1$ vector? Let's say I'm given a vector as follows:
$$x = \begin{bmatrix}1\\2\\3\\4\end{bmatrix}$$
And I'd like to produce the following matrix:
$$A = \begin{bmatrix}1 & 2\\ 
3 & 4\end{bmatrix}$$
What series of operations can I induce to produce this matrix?  I realize that some type of pre-multiplication would be required, or else the dimensions will not make sense.
P.S. Also a generalization to $x$ of size $n^2 \times 1$ would be helpful.
P.P.S. Is there a good resource for learning tricks to convert one form of data to another using matrix operations?  It's a skill that seems like it would be useful in many practical contexts.
 A: With the use of the diagonal operator $\operatorname{diag}(\mathbf x)$, which gives the diagonal matrix whose diagonal has the entries of $\mathbf x$ on it, we can write
$$
   \begin{bmatrix}1 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1\end{bmatrix} \operatorname{diag}(a,b,c,d) \begin{bmatrix}1 & 0 \\ 0 & 1 \\ 1 & 0 \\ 0 & 1\end{bmatrix} = \begin{bmatrix}a & b \\ c & d\end{bmatrix}
$$
in the $2 \times 2$ case.
In the $n \times n$ case:

*

*The first matrix should be a "stretched out" version of the $n\times 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 \otimes \mathbf j^{\mathsf T}$, where $\mathbf j \in \mathbb 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 $\mathbf j \otimes 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 $\mathbf 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 $\sum_{i=1}^n A_i \mathbf x B_i$. Written in terms of the Kronecker product, this solution is
$$
   \sum_{i=1}^n (I_n \otimes (\mathbf e_i)^{\mathsf T})\mathbf x (\mathbf e_i)^{\mathsf T}
$$
where $\mathbf e_i$ is the $i^{\text{th}}$ standard basis vector: the $i^{\text{th}}$ column of $I_n$.
A: $$ \begin{pmatrix} 1 &0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{pmatrix} \begin{pmatrix}a \\ b \\ c \\ d \end{pmatrix} \begin{pmatrix}1&0\end{pmatrix} = \begin{pmatrix}a&0\\b&0\end{pmatrix} $$
$$\begin{pmatrix}0&0&1&0\\ 0&0&0&1\end{pmatrix} \begin{pmatrix}a \\ b \\ c \\ d\end{pmatrix} \begin{pmatrix}0&1\end{pmatrix} = \begin{pmatrix}0&c\\0&d\end{pmatrix} $$
Add them together and you are done.
I think this generalizes in an obvious way.
