Questions tagged [matrices]

{matrices} is about matrices in {equations} and {diagrams}.

is about matrices in and .

Using AMS-LaTeX (package amsmath, the AMS document classes, etc.), there are several commands to create matrices in math mode. For example,

I_2 = \begin{bmatrix}
  1 & 0 \\
  0 & 1
\end{bmatrix}

typesets:

enter image description here

There are many other commands available to typeset matrices:

  • The bmatrix environment, shown above, typesets a matrix in braces. matrix typesets a matrix with no delimiters; pmatrix uses parentheses, Bmatrix uses braces, vmatrix uses vertical lines, and Vmatrix uses double vertical lines.
  • The matrix* environment allows one to specify the alignment of the matrix elements: for example, \begin{matrix*}[r]...\end{matrix*} right-aligns all of the columns. There's also pmatrix*, bmatrix*, etc.
  • The smallmatrix environment typesets a matrix in line, and is small enough to look good in text-style math. In addition, the mathtools package provides psmallmatrix, bsmallmatrix, etc., which also add delimiters on each side.
  • The command allows one to annotate the rows or columns of a matrix (also see the kbordermatrix package).
  • TikZ has a matrix library which allows extensive customization. If your question is about this library, use the tag.

Frequently asked questions:

1978 questions
146
votes
2 answers

Matrix in Latex

I am new to Latex, and I have been trying to get the matrix of following form [x11 x12 x13 . . . . x1n x21 x22 x23 . . . . x2n . . . . xd1 xd2 xd3 . . . . xdn] Where the letters accompanying the elements are…
77
votes
5 answers

Label rows of a matrix by characters

How to add label to index the rows and columns of the matrix ? because I want to number the line outside the matrix \[ \begin{array}{lc} \ Mat_{\varPhi to M} & \left(\begin{array}{@{}ccccc@{}} 1 & 1 & 1 & 1 & 1 \\ …
Chouria Ali
  • 1,303
67
votes
5 answers

How to write an m⨉n matrix in LaTeX?

I tried using the below code but it works only for 2⨉2 matrix. \[ M= \left[ {\begin{array}{cc} 1 & 2 \\ 3 & 4 \\ \end{array} } \right] \] Now the following doesn't work for me: \[ M= \left[ {\begin{array}{cc} 1 & 2 & 3 & 4 &…
Teja
  • 1,279
  • 3
  • 13
  • 19
42
votes
2 answers

How to draw matrix with dots?

How can I draw a matrix with dots in tex like the one shown below:
B Faley
  • 485
  • 1
  • 4
  • 12
39
votes
2 answers

Vertical line in matrix using LaTeXiT

Possible Duplicate: What's the best way make an “augmented” coefficient matrix? I am trying to make a vertical line in a matrix in LaTeXiT. I have read that it should be possible using the following: \begin{bmatrix}{cccc|c} 1 & 0 & 3 & -1 & 0…
SimonBS
  • 493
27
votes
2 answers

Matrix in a matrix

I would like to draw a matrix with top left, top right, bottom left and bottom right blocks. The top left should be a 3x3 matrix with numerical entries, the top right is 0, the bottom left is 0 and the bottom right is just a "single" entry uJ. Here…
Karlr
  • 273
26
votes
6 answers

How to have matrices side by side in latex?

I'm new to latex and all of my matrices seem to be created on new lines, I can't seem to put them side by side. Here is what I am doing to make a matrix (with the 2d identity matrix as an example): \[ \left( \begin{array}{cc} 1 & 0 \\ 0 &…
user3231
26
votes
3 answers

Aligning the minus sign in a matrix

I would like to be able to align the minus sign in a matrix so that the minus is to the left of the numerical column. I have written my matrix as the following: \begin{eqnarray} \left( \begin{array}{llll} 1 & 0 & 0 & 0 \\ 0 & 2…
22
votes
4 answers

Matrix with labels nested in braces

What's the best way to produce a matrix with labels that are nested in braces, like this:
Noam Ross
  • 323
17
votes
5 answers

Equal spacing in matrix

I'm trying to create a matrix that has equal spacing between each of the columns, but so far I have not been very succesful. The code I'm using right now is \documentclass{article} \usepackage{amsmath} \begin{document} \begin{align} U &=…
16
votes
6 answers

Labelling Ax = b under an actual Matrix

I wish to achieve the following in Latex: | a b | x | x1 | = | b1 | | c d | | x2 | | b2 | A x b Where I write the labels A, x, and b under the respective matrices. The code I'm using to write the Matrices is (feel free to…
16
votes
1 answer

Creating a matrix using brackets

How to write this in latex: The closest I've come to it, is this: \{\begin{matrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{matrix}\}
Yhprums
  • 375
16
votes
2 answers

Matrix with rows and columns labeled

It is trivial to make matrices like so: \begin {pmatrix} s & t & a \\ c & k & x \\ cha & n & ge \end {pmatrix} It is not so trivial to impose labels on the rows and columns as done in page 410 here. I would like to do this. For example, the matrix…
Ahaan S. Rungta
  • 448
  • 1
  • 4
  • 16
15
votes
2 answers

A quick way to convert a block of numbers or characters into a matrix (without using ampersand &)

I have a block of numbers like this (actually it is a Hadamard matrix of order 12). What is the quickest way to convert this block into a matrix? Of course one can do it with a matrix environment like bmatrix, pmatrix etc by adding ampersand &…
Name
  • 2,816
15
votes
1 answer

Typesetting a matrix with crossing arrows on it

I'm able to draw matrices on LaTeX but I don't know how to put crossing arrows on it as the second matrix in the figure. I tried to make it 5 x 5 matrices and put \diagup, \diagdown on diagonals but it didn't seem like a good idea.
Burak
  • 153
  • 1
  • 4
1
2 3
26 27