[Tex/LaTex] How to create this matrix in LaTeX

math-modematrices

I want to create the following picture in LaTeX. How can I do this?enter image description here

Best Answer

Hope this will serve as a starting point for the OP to learn. Here the proposal uses array where you specifies how many columns you need, for example, by using cccc for 4 columns centered, and then separate each column by & and ends the line by \.

enter image description here

Code

\documentclass[12pt]{article}
\usepackage[margin=1cm,paper size={15cm,8cm}]{geometry}
\usepackage{amsmath,amssymb}
\thispagestyle{empty}
\begin{document}

\[
\begin{array}{lccccccccccccc}
m:              &   &   & 0 & 0 & 0 & 0 & 1 &0 &0  & 0 & 0 &  &      \\
d(1)=0          &-1 & 2 & 1 &   &   &   &   &  &   &   &      & &    \\
d(2)=0          &   &   &-1 & 2 & 1 &   &   &  &   &   &   &  &      \\
d(3)=0          &   &   &   &-1 & 2 & 1 &   &  &   &   &      & &    \\
$\ldots\ldots$  &   &   &   &   &   &   & $\ldots$ & & &   &         \\
d(5)=1          &   &   &   &   &   &   &   &$\ldots$  &   &  & & &  \\
$\ldots\ldots$  &   &   &   &   &   &   &   &  & $\ldots$  &  &\\
d(11)=0 & & &   &   &   &   &   &   &   &   & -1   & 2 & 1  \\
\end{array}
\]

\end{document}

Edit: Recommended by barbara beeton, a flush right solution.

enter image description here

Code:

\documentclass[12pt]{article}
\usepackage[margin=1cm,paper size={16cm,8cm}]{geometry}
\usepackage{amsmath,amssymb}
\thispagestyle{empty}
\begin{document}

\[
\begin{array}{lrrrrrrrrrrrrr}
m:     &    &  & 0 & 0 & \phantom{-}0 & \phantom{-}0 & 1 &0 &0 & \phantom{-}0 & 0 &&\\
d(1)=0 &-1  & \phantom{-}2& 1 &   &   &   &   &  &  &   &     && \\
d(2)=0 &    &  &-1   & 2 & 1  &   &   &   &   &  &  &   &        \\
d(3)=0 &    &  &     &-1 & 2  & 1 &   &   &   &  &  &   &        \\
$\ldots\ldots$ &     &   &    &   &   &   &  $\ldots$&  &     && \\
d(5)=1 &    &  &     &   &    &   &   &$\ldots$  &  &   &     && \\
$\ldots\ldots$ &     &   &    &   &   &   &   &   &  $\ldots$ & &\\
d(11)=0 &   &  &     &   &    &   &   &   &   &  & -1 & \phantom{-}2 & \phantom{-}1  \\
\end{array}
\]

\end{document}
Related Question