How to create a matrix in LaTeX

Monday, May 18th, 2009
Advertisement

Subscribe.
Enter your email:

We can create a matrix in LaTeX using the array environment, or simplematrix, matrix, pmatrix, bmatrix, vmatrix, and Vmatrix environments via amsmath package. This article provides some examples on how to create a matrix in LaTeX.

Creating a matrix with array

Here are some examples.

  1. unbracketed matrix

    m1

    \[
    M =
    \begin{array}{cc}
    x & y \\
    z & w \\
    \end{array}
    \]
  2. matrix surrounded by square brackets

    m2

    \[
    M =
    \left[ {\begin{array}{cc}
     x & y  \\
     z & w  \\
     \end{array} } \right]
    \]
  3. matrix surrounded by parentheses

    m3

    \[
    M =
    \left( {\begin{array}{cc}
     x & y  \\
     z & w  \\
     \end{array} } \right)
    \]
  4. matrix surrounded by single vertical lines

    m4

    \[
    M =
    \left| {\begin{array}{cc}
     x & y  \\
     z & w  \\
     \end{array} } \right|
    \]

Using amsmath package

Call \usepackage{amsmath} in the preamble, after \documentclass{}.

The amsmath package environment for matrix:

  1. smallmatrix: inline matrix

    m5

    $M = \begin{smallmatrix} x&y\\ z&w \end{smallmatrix}$
    $M = \left( \begin{smallmatrix} x&y\\ z&w \end{smallmatrix}\right)$
  2. matrix: unbracketed matrix

    m6

    $M = \begin{matrix} x&y\\ z&w \end{matrix}$
  3. pmatrix: matrix surrounded by parentheses

    m7

    $M = \begin{pmatrix} x&y\\ z&w \end{pmatrix}$
  4. bmatrix: matrix surrounded by square brackets

    m8

    $M = \begin{bmatrix} x&y\\ z&w \end{bmatrix}$
  5. vmatrix: matrix surrounded by single vertical lines

    m9

    $M = \begin{vmatrix} x&y\\ z&w \end{vmatrix}$
  6. Vmatrix: matrix surrounded by double vertical lines

    m10

    $M = \begin{Vmatrix} x&y\\ z&w \end{Vmatrix}$
If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Creates the exact copy of your hard disk and allows you to instantly restore the entire machine.
New Acronis True Image Home 2010 is the most reliable and easy in use backup solution. Now with online backup option!
15% Discount Code: FMAATIH2010

What else?

Like this article? Share it

 Digg  del.icio.us  TwitThis  Facebook  Reddit  StumbleUpon

One Response to “How to create a matrix in LaTeX”

  1. ufw says:

    Awesome, thanks a lot!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>