# How to express a matrix where each row consists of replicas of element of a vector $x$

Let $x = \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix}$

How do I find a way to express the following matrix

\begin{bmatrix} x_1 & x_1 & \ldots & x_1 \\ x_2 & x_2 & \ldots & x_2 \\ \vdots \\ x_n & x_n & \ldots & x_n\end{bmatrix}

into say a product between a matrix and vector $x$ (or an outer product, or hadamard product...etc)

$$\begin{bmatrix}x_1 \\ x_2 \\ \vdots \\ x_n\end{bmatrix} \begin{bmatrix}1 & 1 & \cdots & 1\end{bmatrix}$$
• Same solution, but even more compact: $\vec{x}\vec{1}^T$. – Anna SdTC Feb 6 '17 at 4:43
Your vector is an $n \times 1$ matrix, and the resultant matrix you want is $n \times n$. So, you would need a $1 \times n$ matrix.
Try $[1\quad 1 \quad \cdots \quad1]$