# What is the best way to indicate repeated off diagonal elements in a matrix/array?

I'd like to typeset a matrix of the following kind: When the symbols involved are big, like, in place of $r$, suppose we had $\mu(k-1)$ and in place of $\lambda$, we had $\mu(k-2)$, the matrix B below becomes very ugly, especially due to the $\ddots$ looking so ugly.

Is there a nicer way to typeset a matrix like the one below.

I have seen that the off diagonal entries are often replaced by a big and prominent entry if they are all same. I'd be happy if someone comes up with a trick to do that as well. Probably, it is something standard and I am unaware of it.

-
Well, people here can only give a nicer way, if there is something to compare to. So, I would suggest you compose a fully compilable MWE that produces the matrix you think looks very ugly, including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Jun 2 '12 at 23:41

This is a very common problem with matrix patterns and to be honest, I don't like that \<>dots solutions at all. I have a strong opinionated view about such use and I tend to think that they don't work at super- and sub- diagonals of the matrix.

So no matter what the solution is, one should always choose to carry the message across as opposed to complying with some ugly standard. Therefore I usually go with one of the following solutions

1. Bite the bullet and typeset the matrix properly such that the dots are unambiguous.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$AA^T = B = rI + \begin{bmatrix} 0 &\lambda &\ldots &\lambda\\ \lambda & 0 &\ddots &\vdots\\ \vdots &\ddots &0 &\lambda\\ \lambda &\ldots &\lambda &0 \end{bmatrix}$
\end{document}


2. Avoid confusing drawings and define meaningful (hopefully!) shortcuts, e.g. you can define all ones matrix with blackboard 1 and subtract I from that instead of J. You don't gain a lot by replacing (1-I) by J in terms of document space.

\documentclass{article}
\usepackage{bbm}
\begin{document}
$AA^T = B = rI + \lambda(\mathbbm{1}-I)$
\end{document}


3. Draw it properly with any graphics package, TikZ, PSTricks, METAPOST etc. as given in Diagonal dots spanning multiple lines/columns of a matrix

-

You want to convey the idea that the \mu(k-1) coefficients are repeated on the diagonal and that the other coefficients are all equal to \mu(k-2). So why don't you try the following?

$AA^T=B= \begin{bmatrix} \mu(k-1) & \mu(k-2) & \mu(k-2) & \dots & \mu(k-2) \\ \mu(k-2) & \mu(k-1) & \mu(k-2) & \dots & \mu(k-2)\\ \hdotsfor{5} \\ \mu(k-2) & \dots & \mu(k-2) & \mu(k-2) & \mu(k-1) \end{bmatrix} =(\mu(k-1)-\mu(k-2))I_{v}+\mu(k-2)J_{v}$


(which probably will need to be split into two lines)

You might want to add a supplementary line of the form

\mu(k-2) & \dots & \mu(k-2) & \mu(k-1) & \mu(k-2) \\


just before the last line.

-

Here's an idea. I sort of threw it together so manual adjustments to p{3.5ex} and \scalebox{2} will probably be necessary to get what you want. There are likely better ways to accomplish the same thing.

\documentclass{minimal}
\usepackage{array}
\usepackage{graphicx}
\usepackage{multirow}
\begin{document}

$\left[ \begin{array}{*{5}{>{\centering}p{3.5ex}<{}}} r & & &\multicolumn{2}{c}{\multirow{2}{*}{\scalebox{2}{\lambda}}} \\ & r & & &\\ & &\ddots & &\\ \multicolumn{2}{c}{\multirow{2}{*}{\scalebox{2}{\lambda}}}&&r&\\ & & & &r \end{array} \right]$

\end{document}


Which gives the following

-
I am quite unconvinced with this answer though. But, I appreciate your efforts. – kan Jun 26 '12 at 10:41

Instead of using $\mu(k-1)$, you could use $\mu_{k-1}$ to save some space in each entry of your matrix.

As Peter has suggested, create a sample and let us know how you would like it changed. Then we could help you better.

-