# Difficulties to express a special Matrix on Latex

I found some difficulties to write this matrix on latex.

Any help is welcomed.

• What do you have so far? What have you tried? Where lies the difficulties? – OptimusCrime Mar 14 '17 at 13:41
• Welcome to TeX.SE! Do you check related question on the right side of this window? there are many example of matrices. Try on basis of them write yours. – Zarko Mar 14 '17 at 13:46
• Shouldn't this matrix be named C_m? And are these zeroes just randomly placed? Is this the exact output you want or do you need some improvements here and there? Also, what is the purpose of the middle-row? I would describe this matrix as a multidiagonal plus a upper-triangular plus a lower-triangular, if it is right I find your drawing misleading... – Fabian Pijcke Mar 14 '17 at 19:29
• Don't write this matrix. It has a banded structure and some off diagonal entries. So write it as the sum of two matrices – percusse Mar 14 '17 at 21:41

## 2 Answers

I think big matrices are most convenient to type with TikZ, and look neat.

I used the matrix code from Fabian Pijcke's answer

## The code

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\tikzset
{
myStyle/.style=
{
help lines,
},
}
\begin{tikzpicture}
\matrix (myMatrix)
[
matrix of math nodes,
nodes={minimum size=7.5mm},
left delimiter={[},right delimiter={]}
]
{
%{{{
t_0    & t_{-1} &        & t_{-m} & 0 &  &  &   & 0   & t_m &     & t_1    \\
t_1    &        &        &        &   &  &  &   &     &     &     &        \\
&        &        &        &   &  &  &   &     &     &     & t_m    \\
t_m    &        &        &        &   &  &  &   &     &     &     & 0      \\
0      &        &        &        &   &  &  &   &     &     &     &        \\
&        &        &        &   &  &  &   &     &     &     &        \\
&        &        &        &   &  &  &   &     &     &     &        \\
&        &        &        &   &  &  &   &     &     &     & 0      \\
0      &        &        &        &   &  &  &   &     &     &     & t_{-m} \\
t_{-m} &        &        &        &   &  &  &   &     &     &     &        \\
&        &        &        &   &  &  &   &     &     &     & t_{-1} \\
t_{-1} &        & t_{-m} & 0      &   &  &  & 0 & t_m &     & t_1 & t_0    \\
%}}}
};
\foreach \k in {2,4,5,9,10}
{
\pgfmathtruncatemacro{\i}{13-\k}
\draw [myStyle](myMatrix-1-\k) -- (myMatrix-\i-12);
\draw [myStyle](myMatrix-\k-1) -- (myMatrix-12-\i);
}
\draw [myStyle](myMatrix-1-1) -- (myMatrix-12-12);
\foreach \i/\j in {2/4,5/9,10/12}
{
\draw [myStyle](myMatrix-1-\i) -- (myMatrix-1-\j);
\draw [myStyle](myMatrix-\i-1) -- (myMatrix-\j-1);
\pgfmathtruncatemacro{\iM}{13-\i}
\pgfmathtruncatemacro{\jM}{13-\j}
\draw [myStyle](myMatrix-\iM-12) -- (myMatrix-\jM-12);
\draw [myStyle](myMatrix-12-\iM) -- (myMatrix-12-\jM);
}
\end{tikzpicture}
\end{document}

• I like your solution much more than mine! Nice job – Fabian Pijcke Mar 14 '17 at 21:20
• Thank you, but this code actually needs quite some tuning before being actually usable. – marsupilam Mar 14 '17 at 21:22

I suggest the following matrix, I removed the (in my opinion) misleading mid line and specified more rigorously where the zeroes were.

\documentclass[convert={outfile=\jobname.png}]{standalone}

\usepackage{amsmath,amssymb}

\begin{document}

$C_n = \left [ \begin{array}{llllllllllll} t_0 & t_{-1} & \cdots & t_{-m} & 0 & \cdots & & \cdots & 0 & t_m & \cdots & t_1 \\ t_1 & \ddots & \ddots & & \ddots & \ddots & & & & \ddots & \ddots & \vdots \\ \vdots & \ddots & & & & & & & & & \ddots & t_m \\ t_m & & & & & & & & & & & 0 \\ 0 & \ddots & & & & & & & & & & \vdots \\ \vdots & \ddots & & & & & & & & & \\ & & & & & & & & & & \ddots & \vdots \\ \vdots & & & & & & & & & & \ddots & 0 \\ 0 & & & & & & & & & & & t_{-m} \\ t_{-m} & \ddots & & & & & & & & & & \vdots \\ \vdots & \ddots & \ddots & & & & \ddots & \ddots & & \ddots & \ddots & t_{-1} \\ t_{-1} & \cdots & t_{-m} & 0 & \cdots & & \cdots & 0 & t_m & \cdots & t_1 & t_0 \end{array} \right ]$

\end{document}


However, I believe this matrix would be advantageously represented using a more algebraic expression, such as

The value at row rand column c of matrix C_n, of size n x n, is: