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

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}
    

    enter image description here

  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}
    

    enter image description here

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


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

The result


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)

enter image description here

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.

enter image description here