4

I have the following code:

\documentclass{article}
\begin{document}
    \[
    \left( \begin{array}{cccccccc|cccccccc}
    6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 6 & 3 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 3 & 6 &   0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    \hline
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & 6 & -3 \\
    0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &   0 & 0 & 0 & 0 & 0 & 0 & -3 & 6 
    \end{array}\right) 
    \]
\end{document}

and the result is:

enter image description here

Is there any idea how to get this one:

enter image description here

5

A solution with blkarray and booktabs:

\documentclass{article}
\usepackage{blkarray}
\usepackage{booktabs}
\usepackage{mathtools}

\begin{document}

    \[ \aboverulesep=0pt \belowrulesep=0pt
    \begin{pmatrix} \begin{blockarray}{@{}*{8}{c}|*{8}{c}@{}}
        \begin{block}{*{6}{c}|cc|*{8}{c}}
        6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        \cmidrule{1-8}
        0 & 0 & 0 & 0 & 0 & 0 & 6 & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 3 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        \end{block}
    \midrule
        \begin{block}{*{8}{c}|*{6}{c}|cc}
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 & 0 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 & 0 & 0 \\
        \cmidrule{9-16}
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 6 &-3 \\
        0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & -3 & 6 \\[-2ex]
        \end{block}
    \end{blockarray}\end{pmatrix}
    \]

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