16

How to write this in latex:

enter image description here

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}\} 

enter image description here

Werner
  • 603,163
Yhprums
  • 375

1 Answers1

19

Use the amsmath Bmatrix

\documentclass{article}
\usepackage{amsmath}

\begin{document}

[ \begin{Bmatrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{Bmatrix} ]

\end{document}

Other types are:

  1. \begin{matrix}...\end{matrix} without brackets
  2. \begin{pmatrix}...\end{pmatrix} with parentheses brackets
  3. \begin{bmatrix}...\end{bmatrix} with brackets
  4. \begin{vmatrix}...\end{vmatrix} with vertical bar brackets
  5. \begin{Vmatrix}...\end{Vmatrix} with double vertical bar brackets
  6. \begin{Bmatrix}...\end{Bmatrix} with curly brackets as shown at top

Another workaround is to use \left...\right option.

\left\{
    \begin{matrix}
        1 & 0 & 0 & 0 \\
        0 & 1 & 0 & 0 \\
        0 & 0 & 1 & 0 \\
        0 & 0 & 0 & 1
    \end{matrix}
\right\}

This could prove helpful when typing things like open-triangle close-vertical (<a|) braces etc.

marlam
  • 544