1

I have a matrix with elements outside of this matrix:

\documentclass{article}
\begin{document}
\begin{equation}
\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{equation}
\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 ?

3

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

enter image description here

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{equation}
\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{equation}
\end{document}
1

You also can use the blkarray package:

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

\begin{document}

\begin{equation}
\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{equation}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.