# How to built an abstract matrix? [duplicate]

I want to built a matrix like the picture: Have a trial:

\begin{displaymath}
\left( \begin{array}{ccc}
b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\
b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\
\vdots & \ldots & \vdots & \ddots & \ddots\\
b_{n1} & \ldots & x_{nj} & \ldots & b_{ns}
\end{array} \right)
\end{displaymath}


However, it didn't work. Can someone help me? Thanks!

-

## marked as duplicate by Herr K., m0nhawk, Jesse, Stefan Kottwitz♦Dec 9 '13 at 7:24

Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I'd use bmatrix and/or pmatrix from the amsmath package (see p.10 of the link) for what you're doing. – Herr K. Dec 9 '13 at 5:05
Also, it always helps if you could post a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Herr K. Dec 9 '13 at 5:09
There are five columns in your array, however, you only provided three columns (\begin{array}{ccc}). This is the key. – Ch'en Meng Dec 9 '13 at 5:12
BTW, \ldots is better than \cdots when \ldots is following and followed by two comma marks. In your situation, \cdots is better. – Ch'en Meng Dec 9 '13 at 5:13

There are five columns in your array, however, you only provided three columns (\begin{array}{ccc}). Put five cs in the braces may solve your problem.

To typeset matrix in math mode, I strongly recommend you using matrix (and also bmatrix, pmatrix, vmatrix and Vmatrix) provided by the package amsmath.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\big[ \alpha_1,\,\alpha_2,\,\ldots,\,\alpha_n \big] \begin{bmatrix} b_{11} & \cdots & b_{1j} & \cdots & b_{1j} \\ b_{21} & \cdots & x_{22} & \cdots & b_{1j}\\ \vdots & \ddots & \vdots & \ddots & \vdots\\ b_{n1} & \cdots & x_{nj} & \cdots & b_{ns} \end{bmatrix} = \big[ c_1,\,c_2,\,\ldots,\,c_s \big]$
\end{document}


See its output:

-

You have 5 columns, so also five elements should be in an argument of array:

\documentclass{article}

\begin{document}

\begin{displaymath}
%\left( \begin{array}{ccc}
\left( \begin{array}{ccccc}
b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\
b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\
\vdots & \ldots & \vdots & \ddots & \ddots\\
b_{n1} & \ldots & x_{nj} & \ldots & b_{ns}
\end{array} \right)
\end{displaymath}

Or rather

$\left[ \begin{array}{ccccc} b_{11} & \ldots & b_{1j} & \ldots & b_{1j} \\ b_{21} & \ldots & x_{22} & \ldots & b_{1j}\\ \multicolumn{5}{c}{\dotfill}\\ b_{n1} & \ldots & x_{nj} & \ldots & b_{ns} \end{array} \right]$

\end{document}


Here every c means a centered column (l - left, r - right).

-