# Creating a matrix with column or row vectors as arguments

At times it's convenient to write a matrix in terms of it's row or column component vectors instead of explicitly giving each particular scalar entry. I'm basically talking about this:

I did some research, but I couldn't find any way to express a matrix in this way.

Check this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

% Vertically stacked
$\begin{bmatrix} \vert & \vert \\ v_1 & v_2 \\ \vert & \vert \end{bmatrix}$

% Horizontally stacked
$\begin{bmatrix} \text{---} & v_1 & \text{---} \\ \text{---} & v_2 & \text{---} \end{bmatrix}$

\end{document}


The white space in the horizontal matrix can be reduced ad-hoc, using \hspace{}. For example:

% Horizontally stacked
$\begin{bmatrix} \text{---} \hspace{-0.2cm} & v_1 & \hspace{-0.2cm} \text{---} \\ \text{---} \hspace{-0.2cm} & v_2 & \hspace{-0.2cm} \text{---} \end{bmatrix}$


Producing:

\documentclass{article}

\usepackage{mathtools}

\begin{document}
$\begin{bmatrix} \vdots & \vdots \\ v_1 & v_2\\ \vdots & \vdots \end{bmatrix}$
\end{document}