4

enter image description here

I want to draw this matrix in Latex and this is what I was trying to do but it doesn't work, I don't know how to fix it to make it look like the attached picture.

\documentclass[12pt,a4paper,intlimits,tbtags,reqno]{report}
\usepackage{tabularx}
\begin{document}
\begin{table}[ht]
\centering
\label{my-label}
$A_{n} = \left( 
\begin{array}{l|c|c}
2\hspace{2 em}9 & 2
& \\
1\hspace{2 em}2 & 5\hspace{2 em}2 & \\ \cline{1-3}

\hspace{2 em}3 & 7\hspace{2 em}5\hspace{2 em}2&  & \\ 
\hspace{2 em}&3\hspace{2 em}7\hspace{2 em}5\hspace{2 em}2&  \\\cline{1-3}

 &   3&1\hspace{2 em}9  &\\
 
 &   &5\hspace{2 em}4 \\ 
    

\end{array}
\right)$
\end{table}
\end{document}
4
  • 2
    There are many possibilities to draw that matrix, one of them could be using nicematrix package. If you see the manual, in page 3 you will find an example very similar to your image May 28, 2021 at 20:18
  • What manual are you talking about? please i do not understand where i have to look, can be more specified where i can found this manual? Thanks in advance. May 28, 2021 at 20:28
  • You can write texdoc nicematrix in a command line or search in ctan. After doing the last one here is the link for the manual ctan.org/pkg/nicematrix May 28, 2021 at 20:31
  • ok, i will do that, thank you so much. May 28, 2021 at 20:32

2 Answers 2

10

I'm not sure why you have your matrix within a table. How about this:

\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{equation*}
A_{n} = \left( 
\begin{array}{cc|cccccc|cc}
    2 & 9 & 2 &&&&&&&\\
    1 & 2 & 5 & 2&&&&&&\\
    \hline
    & 3 & 7 & 5 & 2 &&&&&\\
    && 3 & 7 & 5 & 2 &&&&\\
    &&& 3 & 7 & 5 & 2 &&&\\
    &&&& \cdots & \cdots & \cdots & \cdots &&\\
    &&&&&& 3 & 7 & 5 & 2\\
    \hline
    &&&&&&& 3 & 1 & 9\\
    &&&&&&&& 5 & 4
\end{array}
\right)
\end{equation*}


\end{document}

enter image description here

7
  • 1
    You are Genius! Thank you so so much, I've been trying to write it for two days and I can't and I gave up but now you saved me. And I don't know about the table either, why it should be a table considering that it is a Toeplitz matrix that can be written without a table, but I think it's written that way to separate the numbers so that it can be seen better, I don't see another explanation . May 28, 2021 at 21:07
  • Your welcome, glad I could help! May 28, 2021 at 21:09
  • 1
    Why \hline{}? The braces serve no purpose and in other contexts they might be dangerous: try \begin{array}{cc} 1 & 2 \\ \hline{} \multicolumn{2}{c}{123} \end{array}
    – egreg
    May 28, 2021 at 21:39
  • 1
    Good choice using \cdots. This looks better than the original. May 28, 2021 at 23:39
  • 1
    @mcarchmiller I put {} to show that an error may ensue if they're used.
    – egreg
    Jun 1, 2021 at 15:18
4

Like this?

\documentclass[12pt,a4paper,intlimits,tbtags,reqno]{report}
\usepackage{array}

\begin{document}

\begin{table}[ht]
\centering\setlength{\arraycolsep}{8pt}
\setlength{\extrarowheight}{2pt}
\label{my-label}
$A_{n} = \left(
\begin{array}{cc|*{6}{c}|cc}
 2 & 9 & 2 & & & & & \\
 1 & 2 & 5 & 2 & & & & \\ \hline
 & 3 & 7 & 5 & 2 & & & \\
 & & 3 & 7 & 5 & 2 & & \\
 & & & 3 & 7 & 5 & 2 & \\
 & & & & \multicolumn{4}{c@{}|}{\dotfill} & \\%
 & & & & & & 3 & 7 & 5 & 2 \\ \hline
 & & & & & & & 3 & 1 & 9 \\
 & & & & & & & & 5 & 4
\end{array}
\right)$
\end{table}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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