aa r X i v : . [ m a t h . C O ] O c t Squared distance matrix of a weighted tree
Ravindra B. BapatIndian Statistical InstituteNew Delhi, 110016, Indiae-mail: [email protected] 16, 2018
Abstract
Let T be a tree with vertex set { , . . . , n } such that each edge isassigned a nonzero weight. The squared distance matrix of T, denotedby ∆ , is the n × n matrix with ( i, j )-element d ( i, j ) , where d ( i, j ) is thesum of the weights of the edges on the ( ij )-path. We obtain a formula forthe determinant of ∆ . A formula for ∆ − is also obtained, under certainconditions. The results generalize known formulas for the unweightedcase. AMS Classification : 05C50, 15A15
Keywords : tree, distance matrix, squared distance matrix, determinant,inverse
Let G be a connected graph with vertex set V ( G ) = { , . . . , n } . The distancebetween vertices i, j ∈ V ( G ), denoted d ( i, j ) , is the minimum length (thenumber of edges) of a path from i to j (or an ij -path). We set d ( i, i ) = 0 , i =1 , . . . , n. The distance matrix D ( G ) , or simply D, is the n × n matrix with( i, j )-element d ij = d ( i, j ) . A classical result of Graham and Pollak [7] asserts that if T is a tree with n vertices, then the determinant of the distance matrix D of T is ( − n − ( n − n − . Thus the determinant depends only on the number of vertices in thetree and not on the tree itself. A formula for the inverse of the distancematrix of a tree was given by Graham and Lov´asz [6]. Several extensions andgeneralizations of these results have been proved (see, for example [1], [2], [5],[8], [9] and the references contained therein).1et T be a tree with vertex set { , . . . , n } and let D be the distance matrixof T. The squared distance matrix ∆ is defined to be the Hadamard product D ◦ D, and thus has the ( i, j )-element d ( i, j ) . A formula for the determinantof ∆ was proved in [3], while the inverse and the inertia of ∆ were consideredin [4].In this paper we consider weighted trees. Let T be a tree with vertex set V ( T ) = { , . . . , n } and edge set E ( T ) = { e , . . . , e n − } . We assume that eachedge is assigned a weight and let the weight assigned to e i be denoted w i , whichis a nonzero real number (not necessarily positive).For i, j ∈ V ( T ) , i = j, the distance d ( i, j ) is defined to be the sum of theweights of the edges on the (unique) ij -path. We set d ( i, i ) = 0 , i = 1 , . . . , n. Let D be the n × n distance matrix with d ij = d ( i, j ) . The Laplacian of T is the n × n matrix defined as follows. The rows andthe columns of L are indexed by V ( T ) . For i = j, the ( i, j )-element is 0 if i and j are not adjacent. If i and j are adjacent, and if the edge joining them is e k , then the ( i, j )-element of L is set equal to − /w k . The diagonal elementsof L are defined so that L has zero row (and column) sums.The paper is organized as follows. In this section we review some basicproperties of the distance matrix of a tree such as formulas for its determinantand inverse. Some preliminary results are obtained in Section 2. Sections 3and 4 are devoted to the determinant and the inverse of ∆ , respectively. Example
Consider the tree ◦ ❇❇❇❇❇❇❇❇ ◦ ◦ − ⑤⑤⑤⑤⑤⑤⑤⑤ ◦ ⑤⑤⑤⑤⑤⑤⑤⑤ − ❇❇❇❇❇❇❇❇ ◦ ◦ / − / − / / − / / / − − / − / / − /
40 0 0 − / / / − / − / / . We let Q be the n × ( n −
1) vertex-edge incidence matrix of the underlyingunweighted tree, with an orientation assigned to each edge. Thus the rows and2he columns of Q are indexed by V ( T ) and E ( T ) respectively. If i ∈ V ( T ) , e j ∈ E ( T ) , the ( i, j )-element of Q is 0 if i and e j are not incident, it is 1( −
1) if i and e j are incident and i is the initial (terminal) vertex of e j . It is well-known[1] that Q has rank n − Q is either 0 or ± Q istotally unimodular).Let F be the n × n diagonal matrix with diagonal elements w , . . . , w n − . It can be verified that L = QF − Q ′ . Lemma 1
The following assertions are true:(i) Q ′ DQ = − F. (ii) LDL = − L. Proof (i). The result follows from the following observation which is easilyverified: If e p = { i, j } and e q = { k, ℓ } are edges of T, then d ( i, k ) + d ( j, ℓ ) − d ( i, ℓ ) − d ( j, k )equals 0 if e p and e q are distinct, and equals − w p , if e p = e q . (ii). We have LDL = QF − Q ′ DQF − Q ′ = QF − ( − F ) F − Q ′ by (i)= − QF − Q ′ = − L, and the proof is complete.Let δ i denote the degree of the vertex i, i = 1 , . . . , n, and let δ be the n × δ , . . . , δ n . We set τ i = 2 − δ i , i = 1 , . . . , n, and let τ be the n × τ , . . . , τ n . Theorem 2
The following assertions are true:(i) det D = ( − n − n − ( P i w i )( Q i w i ) . (ii) If P i w i = 0 , then D is nonsingular and D − = − L + 12 P i w i τ τ ′ . (iii) Dτ = ( P i w i ) . Proof
Parts (i) and (ii) are well-known, see for example, [2]. To prove (iii),note that from (ii), D − = 12 P i w i τ τ ′ = 1 P i w i τ, since ′ τ = 2 . It follows that Dτ = ( P i w i ) and the proof is complete.3 Preliminary results
We now turn to the main results for the case of a weighted tree. Let T be atree with vertex set V ( T ) = { , . . . , n } and edge set E ( T ) = { e , . . . , e n − } . Let w , . . . , w n − be the edge-weights. Recall that δ i is the degree of vertex i and τ i = 2 − δ i . We write j ∼ i if vertex j is adjacent to vertex i. We let ˆ δ i bethe weighted degree of i, which is defined asˆ δ i = X j : j ∼ i w ( { i, j } ) , i = 1 , . . . , n. Let ˆ δ be the n × δ , . . . , ˆ δ n . Let ∆ be the squared distance matrix of T, which is the n × n matrixwith its ( i, j )-element equal to d ij or equivalently, d ( i, j ) . The next result wasobtained in [4] for the unweighted case,
Lemma 3 ∆ τ = D ˆ δ. Proof
Let i ∈ { , . . . , n } be fixed. For j = i, let γ ( j ) be the predecessor of j on the ij -path (in the underlying unoriented tree). Let e j be the edge { γ ( j ) , j } and set θ j = ˆ δ j − w ( e j ) . We have2 n X j =1 d ( i, j ) = n X j =1 d ( i, j ) + X j = i ( d ( i, γ ( j )) + w ( e j )) = n X j =1 d ( i, j ) + X j = i d ( i, γ ( j )) + 2 X j = i d ( i, γ ( j )) w ( e j ) + X j = i w ( e j ) . (1) ◦◦ i ◦ ❴❴❴ ◦ γ ( j ) e j ◦ j ⑧⑧⑧⑧⑧⑧⑧⑧ ❄❄❄❄❄❄❄❄ ◦◦ Note that X j = i d ( i, γ ( j )) = n X j =1 ( δ j − d ( i, j ) , (2)4ince vertex j serves as a predecessor of δ j − i. Alsonote that X j = i w ( e j ) = n − X k =1 w ( e k ) . (3)We have n X j =1 d ( i, j )ˆ δ j = X j = i ( d ( i, γ ( j ) + w ( e j ))( w ( e j ) + θ j )= X j = i d ( i, γ ( j )) w ( e j ) + X j = i w ( e j ) + X j = i ( d ( i, γ ( j )) + w ( e j )) θ j . (4)Observe that θ j is the sum of the weights of all the edges incident to j, ex-cept the edge e j , which is on the ij -path. Thus ( d ( i, γ ( j )) + w ( e j )) θ j equals P d ( i, γ ( ℓ )) w ( e ℓ ) , where the summation is over all vertices adjacent to j, except i. Therefore it follows that X j = i d ( i, γ ( j )) w ( e j ) = X j = i ( d ( i, γ ( j )) + w ( e j )) θ j . (5)From (1)-(5) we get2 n X i =1 d ( i, j ) = n X j =1 d ( i, j ) δ j + n X j =1 d ( i, j )ˆ δ j , which is equivalent to n X i =1 d ( i, j ) τ j = n X j =1 d ( i, j )ˆ δ j , and the proof is complete.Next we define the edge orientation matrix of T. We assign an orientationto each edge of T. Let e i = ( p, q ); e j = ( r, s ) be edges of T. We say that e i and e j are similarly oriented, denoted by e i ⇒ e j , if d ( p, r ) = d ( q, s ) . Otherwise e i and e j are said to be oppositely oriented, denoted by e i ⇀↽ e j . For example, inthe following diagram e i and e j are similarly oriented. ◦ p / / ◦ q ❴❴❴ ◦ r / / ◦ s The edge orientation matrix of T is the ( n − × ( n −
1) matrix H havingthe rows and the columns indexed by the edges of T. The ( i, j )-element of H, h ( i, j ) is defined to be 1( −
1) if the corresponding edges e i , e j of T are similarly (oppositely) oriented. The diagonal elements of H are set to be1 . We assume that the same orientation is used while defining the matrix H and the incidence matrix Q. If the tree T has no vertex of degree 2 , then we let ˆ τ be the diagonal matrixwith diagonal elements 1 /τ , . . . , /τ n . We state some basic properties of H next, see [3]. Theorem 4
Let T be a directed tree on n vertices, let H and Q be the edge ori-entation matrix and the vertex-edge incidence matrix of T, respectively. Then det H = 2 n − Q ni =1 τ i . Furthermore, if T has no vertex of degree , then H isnonsingular and H − = Q ′ ˆ τ Q. Let w , . . . , w n − be the edge-weights. Recall that F be the diagonal matrixwith diagonal elements w , . . . , w n − . Also note that, (
F HF ) ij = ( w i w j if e i ⇒ e j − w i w j if e i ⇀↽ e j . Lemma 5 Q ′ ∆ Q = − F HF.
Proof
For i, j ∈ { , . . . , n − } , let the edge e i be from p to q and the edge e j be from r to s. Then( Q ′ ∆ Q ) ij = ( d ( p, r ) + d ( q, s ) − d ( p, s ) − d ( q, r ) if e i ⇒ e j d ( p, s ) + d ( q, r ) − d ( p, r ) − d ( q, s ) if e i ⇀↽ e j (6)Let d ( r, s ) = α. It follows from (6) that( Q ′ ∆ Q ) ij = ( ( w i + α ) + ( w j + α ) − ( w i + w j + α ) − α = − w i w j if e i ⇒ e j ( w i + w j + α ) + α − ( w i + α ) − ( w j + α ) = 2 w i w j if e i ⇀↽ e j = − F HF ) ij , and the proof is complete.Let ˜ τ be the diagonal matrix with diagonal elements τ , . . . , τ n . Lemma 6 ∆ L = 2 D ˜ τ − ˆ δ ′ . Proof
Let i, j ∈ { , . . . , n } be fixed. Let vertex j have degree p. Suppose j isadjacent to vertices u , . . . , u p and let e ℓ , . . . , e ℓ p be the corresponding edgeswith weights w ℓ , . . . , w ℓ p , respectively. We consider two cases.6 ase (i). i = j. We have(∆ L ) jj = n X k =1 d ( j, k ) ℓ kj = w ℓ ( − w ℓ ) − + · · · + w ℓ p ( − w ℓ p ) − = − ( w ℓ + · · · + w ℓ p )= − ˆ δ j . Since the ( j, j )-element of 2 D ˜ τ − ˆ δ ′ is − ˆ δ j , the proof is complete in this case. Case (ii). i = j. We assume, without loss of generality, that the ij -path passesthrough u (it is possible that i = u ). Let d ( i, j ) = α. Then d ( i, u ) = α − w ℓ , d ( i, u ) = α + w ℓ , . . . , d ( i, u p ) = α + w ℓ p . We have(∆ L ) ij = n X k =1 d ( i, k ) ℓ kj = d ( i, u ) ( − w ℓ ) − + · · · + d ( i, u p ) ( − w ℓ p ) − + d ( i, j ) ℓ jj = ( α − w ℓ ) ( − w ℓ ) − + ( α + w ℓ ) ( − w ℓ ) − + · · · + ( α + w ℓ p ) ( − w ℓ p ) − + α (( w ℓ ) − + · · · + ( w ℓ p ) − )= ( − αw ℓ + w ℓ )( − w ℓ ) − + (2 αw ℓ + w ℓ )( − w ℓ ) − + · · · + (2 αw ℓ p + w ℓ p )( − w ℓ p ) − = 2 α − α ( p − − ( w ℓ + · · · + w ℓ p )= 2 ατ j − ( w ℓ + · · · + w ℓ p ) , which is the ( i, j )-element of 2 D ˜ τ − ˆ δ ′ and the proof is complete. Our next objective is to obtain a formula for the determinant of the squareddistance matrix. We first consider the case when the tree has no vertex ofdegree 2 . Theorem 7
Let T be a tree with vertex set V ( T ) = { , . . . , n } , edge set E ( T ) = { e , . . . , e n − } , and edge weights w , . . . , w n − . Suppose T has no vertexof degree . Then det ∆ = ( − n − n − n Y i =1 τ i n − Y i =1 w i n X i =1 ˆ δ i τ i . (7)7 roof We assign an orientation to the edges of the tree and let H and Q be,respectively, edge orientation matrix and the vertex-edge incidence matrix of T. Let ∆ i denote the i -th column of ∆ , and let t i be the column vector with1 at the i -th place and zeros elsewhere, i = 1 , . . . , n. Then " Q ′ t ′ ∆ h Q t i = " Q ′ ∆ Q Q ′ ∆ ∆ ′ Q . (8)Since det " Q ′ t ′ = ± , it follows from (8) thatdet ∆ = " Q ′ ∆ Q Q ′ ∆ ∆ ′ Q = " − F HF Q ′ ∆ ∆ ′ Q by Lemma 4= (det( − F HF ))( − ∆ ′ Q ( − F HF ) − Q ′ ∆ )= ( − n − n − Y i =1 w i (det H )2∆ ′ QF − H − F − Q ′ ∆ = ( − n − n n − Y i =1 w i (det H )∆ ′ QF − Q ′ ˆ τ QF − Q ′ ∆ , (9)in view of Theorem 4.By Lemma 5 we have∆ ′ QF − Q ′ ˆ τ QF − Q ′ ∆ = X i (2 d i τ i − ˆ δ i ) τ i = X i (4 d i τ i + ˆ δ i − d i τ i ˆ δ i ) 1 τ i = X i d i τ i + X i ˆ δ i τ i − X i d i ˆ δ i (10)It follows from (10) and Lemma 3 that∆ ′ QF − Q ′ ˆ τ QF − Q ′ ∆ = X i ˆ δ i τ i . (11)Also by Theorem 4, det H = 2 n − n Y i =1 τ i . (12)The proof is complete by substituting (11) and (12) in (9).8 orollary 8 [3] Let T be an unweighted tree with vertex set V ( T ) = { , . . . , n } . Suppose T has no vertex of degree . Then det ∆ = ( − n n − n − − X i τ i ! n Y i =1 τ i . (13) Proof
We set w i = 1 , i = 1 , . . . , n − δ i = δ i = 2 − τ i , i =1 , . . . , n. We have X i δ i τ i = X i (2 − τ i ) τ i = X i τ i − τ i τ i = 4 X i τ i + X i τ i − n = 4 X i τ i + 2 − n = − n − − X i τ i ! . (14)The proof is complete by substituting (14) in (7).We turn to the case when there is a vertex of degree 2 . Theorem 9
Let T be a tree with vertex set V ( T ) = { , . . . , n } , edge set E ( T ) = { e , . . . , e n − } , and edge weights w , . . . , w n − . Let q be a vertex ofdegree and let p and r be neighbors of q. Let e i = ( pq ) , e j = ( qr ) . Then det ∆ = ( − n − n − ( w i + w j ) n − Y s =1 w s Y k = q τ k . (15) Proof
We assume, without loss of generality, that e i is directed from p to q and e j is directed from q to r. ◦ p e i / / ◦ q e j / / ◦ r Let z q be the n × q -th place and zeros elsewhere.Let ∆ q be the q -th column of ∆ . We have " Q ′ z ′ q ∆ h Q z q i = " Q ′ ∆ Q Q ′ ∆ q ∆ ′ q Q = " − F HF Q ′ ∆ q ∆ ′ q Q , (16)9n view of Lemma 5. It follows from (16) that " F −
00 1 Q ′ z ′ q ∆ h Q z q i " F −
00 1 = " − H F − Q ′ ∆ q ∆ ′ q QF − . (17)Taking determinants of matrices in (17) we get(det F − ) det ∆ = det " − H F − Q ′ ∆ q ∆ ′ q QF − . (18)Note that the i -th and the j -th columns of H are identical.Let H ( j | j ) denote the submatrix obtained by deleting row j and column j from H. In " − H F − Q ′ ∆ q ∆ ′ q QF − , subtract column i from column j, row i from row j, and then expand the determinant along column j. Then we getdet " − H F − Q ′ ∆ q ∆ ′ q QF − = − ((∆ ′ q QF − )) j − (∆ ′ q QF − ) j ) det( − H ( j | j ))= − ( − n − det H ( j | j )( − w j − w i ) , (19)Note that H ( j | j ) is the edge orientation matrix of the tree obtained bydeleting vertex q and replacing edges e i and e j by a single edge directed from p to r in the tree. Hence by Theorem 4,det H ( j | j ) = 2 n − Y k = q τ k . (20)It follows from (17),(18) and (19) thatdet ∆ = − (det F ) ( − n n − n − ( Y k = q τ k )( w i + w j ) = ( − n − n − ( w i + w j ) n − Y s =1 w s Y k = q τ k , (21)and the proof is complete. Corollary 10
Let T be a tree with vertex set V ( T ) = { , . . . , n } , edge set E ( T ) = { e , . . . , e n − } , and edge weights w , . . . , w n − . Suppose T has at leasttwo vertices of degree . Then det ∆ = 0 . Proof
The result follows from Theorem 9 since τ i = 0 for at least two valuesof i. Inverse
We now turn to the inverse of ∆ , when it exists. When the tree has no vertexof degree 2 , we can give a concise formula for the inverse. We first prove somepreliminary results. Lemma 11
Let the tree have no vertex of degree . Then ∆(2 τ − L ˆ τ ˆ δ ) = (ˆ δ ′ ˆ τ ˆ δ ) . (22) Proof
By Lemma 6, ∆ L = 2 D ˜ τ − ˆ δ ′ . Hence∆ L ˆ τ ˆ δ = 2 D ˆ δ − (ˆ δ ′ ˆ τ ˆ δ ) . (23)Since by Lemma 3, ∆ τ = D ˆ δ, we obtain the result from (23).For a square matrix A, we denote by cof A , the sum of the cofactors of A. Lemma 12
Let T be a tree with vertex set V ( T ) = { , . . . , n } , edge set E ( T ) = { e , . . . , e n − } , and edge weights w , . . . , w n − . Suppose T has no vertex of de-gree . Then cof ∆ = ( − n − n − n − Y k =1 w k n Y i =1 τ i . (24) Proof
By Lemma 5, Q ′ ∆ Q = − F HF.
Taking determinant of both sides andusing Cauchy-Binet formula, we getcof ∆ = ( − n − (det F ) det H = ( − n − n − Y k =1 w k n − n Y i =1 τ i by Theorem 4= ( − n − n − n − Y k =1 w k n Y i =1 τ i , (25)and the proof is complete. Corollary 13
Let the tree have no vertex of degree and let β = ˆ δ ′ ˆ τ ˆ δ. If β = 0 , then ∆ is nonsingular and ′ ∆ − = 4 β . (26)11 roof Observe that β = n X i =1 ˆ δ i τ i . By Theorem 7,det ∆ = ( − n − n − n Y i =1 τ i n − Y i =1 w i n X i =1 ˆ δ i τ i . (27)If β = 0 , then ∆ is nonsingular by (27). Note that ′ ∆ − = cof ∆det ∆ . The proofis complete using Lemma 12 and (27).
Theorem 14
Let the tree have no vertex of degree and let β = ˆ δ ′ ˆ τ ˆ δ. Let η = 2 τ − L ˆ τ ˆ δ. If β = 0 , then ∆ is nonsingular and ∆ − = − L ˆ τ L + 14 β ηη ′ . (28) Proof
Let X = − L ˆ τ L + β ηη ′ . Then∆ X = −
14 ∆ L ˆ τ L − β ∆ ηη ′ . (29)By Lemma 6, ∆ L = 2 D ˜ τ − ˆ δ ′ . Hence∆ L ˆ τ L = 2 DL − ˆ δ ′ ˆ τ L. (30)Using Theorem 2, we can see that DL = − I + τ ′ . (31)Finally, by Lemma 11, ∆ η = β. This fact and (29), (30) and (31) lead to∆ X = I − τ ′ + 14 ˆ δ ′ ˆ τ L + 14 β η ′ . (32)Since η = 2 τ − L ˆ τ ˆ δ, it follows from (32) that ∆ X = I and the proof is complete.We conclude with an example to show that the condition β = 0 is necessaryin Theorem 14. Example
Consider the tree ◦ ◦ ◦ γ ◦ ◦ D = γ
11 0 2 1 + γ
21 2 0 1 + γ γ γ γ γ γ . It can be checked that det ∆ = − γ ( γ − γ − . Thus ∆ is singular if γ = 3 + 2 √ . Note that ˆ δ ′ = [ γ + 3 , , , γ, , τ ′ = [ − , , , ,
1] and hence, if γ = 3 + 2 √ , then X i =1 ˆ δ τ i = 0 . Acknowledgment
I sincerely thank Ranveer Singh for a careful reading ofthe manuscript. Support from the JC Bose Fellowship, Department of Scienceand Technology, Government of India, is gratefully acknowledged.
References [1]
R. B. Bapat:
Graphs and Matrices.
Universitext. Springer, London; HindustanBook Agency, New Delhi, 2010. [2]
R. B. Bapat, S. J. Kirkland, M. Neumann:
On distance matrices andLaplacians.
Linear Algebra Appl., (2005), 193–209. [3]
R. B. Bapat, S. Sivasubramanian:
Product distance matrix of a graph andsquared distance matrix of a tree.
Appl. Anal. Discrete Math. (2013), no. 2,285–301. [4] R. B. Bapat, S. Sivasubramanian:
Squared distance matrix of a tree: inverseand inertia.
Linear Algebra Appl. (2016), 328–342. [5]
R. B. Bapat, A. K. Lal, Sukanta Pati: A q -analogue of the distance matrixof a tree. Linear Algebra Appl., (2006), 799–814. [6]
R. L. Graham, L. Lov´asz:
Distance matrix polynomials of trees.
Adv. Math., (1978), 60–88. [7] R. L. Graham, H. O. Pollak:
On the addressing problem for loop switching.
Bell System Tech. J., (1971), 2495–2519. [8] Weigen Yan, Yeong-Nan Yeh:
The determinants of q -distance matrices oftrees and two quantities relating to permutations. Adv. in Appl. Math., (2007),311–321. Hui Zhou, Qi Ding:
The distance matrix of a tree with weights on its arcs.
Linear Algebra Appl. (2016), 365–377.(2016), 365–377.