Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How do I create a Toeplitz matrix like the following in LaTeX?

matrix

share|improve this question
    
Thanks a lot my friend –  tanha Apr 29 '14 at 8:10

3 Answers 3

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\[ %\arraycolsep=4pt
 G = 
 \begin{bmatrix*}[r]
    1 \\
    2&1\\
   -1&2&1\\
     &-1&2&1\\
     &&-1&2&1\\
     &&&-1&2&1\\
     &&&&&&\ddots\\
     &&&&&&&\ddots\\
     &&&&&&&&\ddots\\
     &&&&&&&&&1
  \end{bmatrix*}
\]
\end{document}

enter image description here

share|improve this answer
1  
I think the last row must contain all non-zero elements: -1 2 1 –  Robert Fuster Apr 28 '14 at 9:00
    
Thanks a lot my friend –  tanha Apr 29 '14 at 8:10

Here you go:

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  G =
  \begin{bmatrix}
    1 \cr
    2&1\cr
    -1&2&1\cr
    &-1&2&1\cr
    &&-1&2&1\cr
    &&&-1&2&1\cr
    &&&&&&\ddots\cr
    &&&&&&&\ddots\cr
    &&&&&&&&\ddots\cr
    &&&&&&&&&1\cr
  \end{bmatrix}
\end{equation*}
\end{document}

enter image description here

To get nicer alignment of the minus-signs you could use an array with right-aligned columns

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  G =
  \left[
    \begin{array}{*{10}r}
      1 \cr
      2&1\cr
      -1&2&1\cr
      &-1&2&1\cr
      &&-1&2&1\cr
      &&&-1&2&1\cr
      &&&&&&\ddots\cr
      &&&&&&&\ddots\cr
      &&&&&&&&\ddots\cr
      &&&&&&&&&1\cr
    \end{array}
  \right]
\end{equation*}
\end{document}

enter image description here

share|improve this answer
3  
to get the right alignment, it's simpler to load the mathtools package and write: begin{bmatrix*}[r] … \end{bmatrix*}. –  Bernard Apr 28 '14 at 8:36
    
Is there a reason to use \cr instead of `\`? –  Manuel Apr 28 '14 at 14:53
1  
@Manuel Because I often use plain TeX and there is no \\. In this case both are equivalent. Also \cr is primitive, hence it doesn't need to get expanded, you may save half a nano-second by that. –  Henri Menke Apr 28 '14 at 15:06
    
Thanks a lot my friend –  tanha Apr 29 '14 at 8:10

Although late to the race my entry is presented below:

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage{amssymb}

\begin {document}
\begin{equation}
\begin{pmatrix}
2 & -1 & 0 & \cdots & \cdots & \cdots & \cdots & 0\\
-1 & 2 & -1 & 0 & & & & \vdots\\
0 & -1 & 2 & -1 & \ddots & & & \vdots\\
\vdots & 0 & \ddots & \ddots & \ddots & \ddots & & \vdots\\
\vdots & & \ddots & \ddots & \ddots & \ddots & 0 & \vdots\\
\vdots & & & \ddots & -1 & 2 & -1 & 0\\
\vdots & & & & 0 & -1 & 2 & -1\\
0 & \cdots & \cdots  & \cdots & \cdots & 0 & -1 & 2\\
\end{pmatrix}
\end{equation}
\end{document}

enter image description here

share|improve this answer
    
@Mico Sure, here is a reference ece.umn.edu/~mihailo/software/lqrsp/mass_spring.html –  sunspots Feb 21 at 23:47
    
The matrix G is also referred to as a band matrix. –  sunspots Feb 21 at 23:48
    
Your proposed solution produces a symmetric matrix, whereas the OP appears to want to produce an asymmetric matrix with all elements above the diagonal equal to zero. –  Mico Feb 22 at 1:22
    
@Mico My entry is final. –  sunspots Feb 22 at 1:56
1  
You can do whatever you want. An answer is usually considered to be more helpful, though, if it addresses the actual question that's been posed, rather than some other problem. –  Mico Feb 22 at 3:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.