2

Is there a term for a matrix that is like the identity matrix but with the values swapped? That is, 1's everywhere except the diagonal which has 0's.

[[0, 1, 1, 1],
 [1, 0, 1, 1],
 [1, 1, 0, 1],
 [1, 1, 1, 0]]

Of course, that's easily created with something like abs(numpy.eye(4) - 1). But, does it have a name or at least a phrase that describes it?

3 Answers3

4

It can be well described as a rank one update to a scalar matrix. These are asked about a lot; see this question for example. As Exodd points out, we could also your matrix the adjacency matrix of the complete graph.

A convenient way to write this matrix is as $M = \mathbf 1 \mathbf 1^T - I$, where $\mathbf 1 = (1,1,\dots,1)^T$ and $I$ denotes the identity matrix.

Ben Grossmann
  • 225,327
2

This is a special case of matrices of the form

$$A=\begin{pmatrix} a & b & \ldots & b\\ b & a & \ldots & b\\ \vdots & \vdots & \ddots & \vdots\\ b & b & \ldots & a\end{pmatrix},$$ which are circulant matrices.

For its determinant see here: Determinant of a specially structured matrix ($a$'s on the diagonal, all other entries equal to $b$)

Dietrich Burde
  • 130,978
0

Matrix associated to complete graph?

Exodd
  • 10,844