# Two columns outside matrix

I have a matrix with elements outside of this matrix:

\documentclass{article}
\begin{document}
$$\bordermatrix{ & A_1 & A_2 & \cdots & A_n \cr C_1 & w_1 & w_2 & \ldots & w_1 \cr C_2 & w_2 & w_2 & \ldots & w_2 \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr C_n & w_n & w_n & \ldots & w_n \cr }$$
\end{document}


I would like to be able to add a second column, let say B_1, B2,..., B_n, to the left of the C column. How to do that ?

You could insert a matrix environment ahead of the existing \bordermatrix{...} material.

Feel free to fine-tune the horizontal separation between the two matrices to your liking. (I inserted a thinspace -- \, -- but you may prefer either more or less separation.)

\documentclass{article}
\usepackage{amsmath} % for 'matrix' environment
\begin{document}

$$\begin{matrix} B_1 \\ B_2 \\ \vdots \\ B_n \end{matrix}\, \bordermatrix{ & A_1 & A_2 & \cdots & A_n \cr C_1 & w_1 & w_2 & \ldots & w_1 \cr C_2 & w_2 & w_2 & \ldots & w_2 \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr C_n & w_n & w_n & \ldots & w_n \cr }$$
\end{document}


You also can use the blkarray package:

\documentclass{article}
\usepackage{amsmath} % for 'matrix' environment
\usepackage{blkarray, makecell}

\begin{document}

$$\begin{blockarray}{cc>{\:}cccc<{\:}} & & A_1 & A_2 & \cdots & A_n \\ \begin{block}{c@{\:}c <{\!}(>{\:}cccc<{\:})} B_1 & C_1 & w_1 & w_2 & \ldots & \Gape[1.5ex][0pt]{w_1} \\ B_2 & C_2 & w_2 & w_2 & \ldots & w_2 \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ B_n & C_n & w_n & w_n & \ldots &\Gape[0pt][1.5ex]{ w_n}\\ \end{block} \end{blockarray}$$

\end{document}