# [R] about the determinant of a symmetric compound matrix

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Sep 26 15:49:14 CEST 2006

```"Stefano Sofia" <stefano.sofia at regione.marche.it> writes:

> Dear R users,
> even if this question is not related to an issue about R, probably some of you will be able to help me.
>
> I have a square matrix of dimension k by k with alpha on the diagonal and beta everywhee else.
> This symmetric matrix is called symmetric compound matrix and has the form
> a( I + cJ),
> where
> I is the k by k identity matrix
> J is the k by k matrix of all ones
> a = alpha - beta
> c = beta/a
>
> I need to evaluate the determinant of this matrix. Is there any algebric formula for that?

Yes. Unusually, this is not from the famous "Rao p.33", but from p.32... [1]:

det(A+XX') = det(A)(1+X'A^{-1}X) provided det(A) != 0

now put X = sqrt(c) times a vector of ones and get det(I+cJ) = 1+ck.
Multiply by a^k for the general case.

Quick sanity check:

> m <- matrix(.1,7,7)
> diag(m) <- .9
> det(m)
[1] 0.393216
> .8^7 * (1 + .1/.8 * 7)
[1] 0.393216

Alternatively, you can do it via eigenvalues: The off-diagonal part
(beta*J) corresponds to a single direction along the unit vector
c(1,1,...,1)/sqrt(7). The diagonal part corresponds to adding (alpha -
beta)*I, which has total sphericity so you can arrange that one
eigenvector of it points in the same direction and you end up with

(alpha - beta)^(k-1) * (alpha - beta + k*beta)

> (.9-.1)^6*((.9-.1)+ 7*.1)
[1] 0.393216

(Getting this right on the first try is almost impossible...)

[1] CR Rao, Linear Statistical Inference and Its Applications, 2nd ed.
Wiley 1973.

--
O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907

```