# How to input matrices when posting questions at Math StackExchange? [duplicate]

This question already has an answer here:

I would like to post a question here in which I would like to insert a $2 \times 2$ matrix with entries $a$, $b$, $c$, and $d$, respectively, in the positions row 1 col. 1, row 1 col. 2, row 2 col 1, and row 2 col 2. How to?

I would also like to input a general $m \times n$ matrix with entires $a_{ij}$, where $i = 1, 2, \ldots, m$, $j = 1, 2, \ldots, n$.

## marked as duplicate by Zev Chonoles, Dan Rust, user61527, Davide Giraudo, user642796Feb 17 '14 at 4:59

There are a couple of ways: \begin{bmatrix}a&b\\c&d\end{bmatrix} $$\begin{bmatrix}a&b\\c&d\end{bmatrix}$$ or \left[\begin{array}{l}a&b\\c&d\end{array}\right] $$\left[\begin{array}{l}a&b\\c&d\end{array}\right]$$ The latter gives you control of the alignment of the elements (eg: l,c,r) and column and row separators.