Table Of Content(cid:3)
DETERMINANT: OLD ALGORITHMS, NEW INSIGHTS
MEENA MAHAJANy AND V VINAYz
Abstra
t. In this paper we approa
h the problemof
omputing the
hara
teristi
polynomial
of a matrix from the
ombinatorial viewpoint. We present several
ombinatorial
hara
terizations
of the
oeÆ
ients of the
hara
teristi
polynomial, in terms of walks and
losed walks of di(cid:11)erent
kinds in the underlying graph. We develop algorithms based on these
hara
terizations, and show
that they tally with well-known algorithms arrived at independently from
onsiderations in linear
algebra.
Key words. Determinant,Algorithms,Combinatori
s,Graphs,Matri
es
AMS subje
t
lassi(cid:12)
ations. 05A15, 68R05,05C50,68Q25
1. Introdu
tion. Computingthedeterminant,orthe
hara
teristi
polynomial,
ofamatrixisaproblemwhi
h hasbeen studied severalyearsagofromthe numeri
al
analysisviewpoint. In the mid 40's, a seriesof algorithmswhi
h employed sequential
iterative methods to
ompute the polynomial were proposed, the most prominent
beingduetoSamuelson[19℄,Krylov,Leverier;see,forinstan
e,thepresentationin[8℄.
Then, in the 80's, a series of parallel algorithms for the determinant were proposed,
due to Csanky, Chistov, Berkowitz [6, 5, 1℄. This
ulminated in the result, shown
independently by several
omplexity theoristsin
luding Vinay, Damm, Toda,Valiant
[26,7,24,25℄,that
omputingthedeterminantofanintegermatrixis
ompleteforthe
omplexity
lassGapL,andhen
e
omputationallyequivalentinapre
ise
omplexity-
theoreti
sense to iterated matrix multipli
ation or matrix powering.
In an attempt to unravel the ideas that went into designing eÆ
ient parallel al-
gorithmsforthe determinant, Valiantstudied Samuelson'salgorithmand interpreted
the
omputation
ombinatorially[25℄. Hepresenteda
ombinatorialtheorem
on
ern-
ing
losedwalksingraphs,the
orre
tnessofwhi
hfollowedfromthatofSamuelson's
algorithm. This was the (cid:12)rst attempt to view determinant
omputations as graph-
theoreti
rather than linear algebrai
manipulations. Inspired by this, and by the
purely
ombinatorial and extremely elegant proof of the Cayley-Hamilton Theorem
duetoRutherford[18℄(andindependentlydis
overedbyStraubing[22℄;see[2,27℄for
ni
e expositions and see [3℄ for related material), Mahajan and Vinay [15℄ des
ribed
a
ombinatorialalgorithm for
omputing the
hara
teristi
polynomial. The proof of
orre
tness of this algorithm is also purely
ombinatorial and does not rely on any
linear algebra or polynomial arithmeti
.
In this paper, we follow up on the work presented in [25, 22, 15℄ and present
a unifying
ombinatorial framework in whi
h to interpret and analyse a host of al-
gorithms for
omputing the determinant and the
hara
teristi
polynomial. We (cid:12)rst
des
ribewhatthe
oeÆ
ientsofthe
hara
teristi
polynomialofamatrixM represent
as
ombinatorial entities in the graph GM whose adja
en
y matrix is M. We then
(cid:3)A preliminary version of this paper appeared in the Pro
eedings of the Sixth S
andinavian
Workshop on AlgorithmTheory SWAT'98, Vol.1432in the Springer-Verlag LNCS series,pp 276{
287.
yInstituteofMathemati
alS
ien
es,Chennai600113,India. (meenaims
.ernet.in). Partofthis
workwasdonewhenthisauthorwasvisitingtheDepartmentofComputerS
ien
eandAutomation,
IIS
,Bangalore.
z Department of ComputerS
ien
e and Automation, Indian Institute of S
ien
e, Bangalore 560
012,India. (vinay
sa.iis
.ernet.in).
1
2 M.MAHAJANANDVVINAY
onsider various algorithms for evaluating the
oeÆ
ients, and in ea
h
ase we relate
the intermediate steps of the
omputation to manipulation of similar
ombinatorial
entities, giving
ombinatorialproofs of
orre
tnessof these algorithms.
Inparti
ular,inthegraph-theoreti
setting,
omputingthedeterminantamounts
to evaluating the signed weighted sum of
y
le
overs. This sum involves far too
many terms to allow evaluationof ea
h, and we show howthe algorithmsof [19, 5, 6℄
essentiallyexpandthis sum toin
lude moretermsi.e., generalizationsof
y
le
overs,
whi
h eventually
an
el out but whi
h allow easy evaluation. The algorithm in [15℄
uses
low sequen
es expli
itly; Samuelson's method [19℄ impli
itly uses pre(cid:12)x
low
sequen
es;Chistov'smethod[5℄impli
itlyusestablesoftoursequen
es;andCsanky's
algorithm [6℄ hinges around Leverier's Lemma (see, for instan
e, [8℄), whi
h
an be
interpreted using loops and partial
y
le
overs. In ea
h of these
ases, we expli
itly
demonstrate the underlying
ombinatorial stru
tures, and give proofs of
orre
tness
whi
h are entirely
ombinatorial in nature.
In a sense, this paper parallels the work done by a host of
ombinatorialists in
proving the
orre
tness of matrix identities using the graph-theoreti
setting. Foata
[9℄ used tours and
y
le
overs in graphs to prove the Ma
Mohan master theorem;
RutherfordandStraubing[18,22℄reprovedtheCayley-Hamiltontheoremusing
ount-
ing over walks and
y
le
overs; Garsia [11℄, Orlin [17℄ and Tempereley [23℄ indepen-
dently found
ombinatorialproofs of the matrix-tree theorem and Chaiken [4℄ gener-
alized the proof to the all-minor matrix-tree theorem; Foata [10℄ and then Zeilberger
[27℄ gave new
ombinatorial proofs of the Ja
obi identity; Gessel [12℄ used transitive
tournaments in graphs to prove Vandermonde's determinant identity. More re
ently,
Minoux[16℄showedanextensionofthematrix-treetheoremtosemirings,againusing
ounting arguments over arbores
en
es in graphs. For beautiful surveys of some of
these results, see Zeilberger's paper [27℄ and
hapter 4 of Stanton and White's book
on Constru
tive Combinatori
s [20℄. Zeilberger ends with a host of \exer
ises" in
proving many more matrix identities
ombinatorially.
Thus, using
ombinatorialinterpretations and arguments to prove matrix identi-
ties has been around for a while. To our knowledge, however, a similar appli
ation
of
ombinatorialideas to interpret, orprove
orre
tnessof, oreven develop new algo-
rithms
omputingmatrixfun
tions, hasbeenattemptedonlytwi
ebefore: byValiant
[25℄ in 1992, and by the present authors in our earlier paper in 1997 [15℄. We build
on our earlier work and pursue a new thread of ideas here.
Thispaperisthusa
olle
tionofnewinterpretationsandproofsofknownresults.
The paper is by and large self-
ontained.
2. Matri
es, Determinants and Graphs. Let A be a square matrix of di-
mension n. For
onvenien
e, we state our results for matri
es overintegers, but they
apply to matri
es overany
ommutative ring.
Weasso
iatematri
esofdimensionnwith
ompletedire
tedgraphsonnverti
es,
withweightsontheedges. LetGAdenotethe
ompletedire
tedgraphasso
iatedwith
thematrixA. Iftheverti
esofGA arenumberedf1;2;:::;ng,thentheweightofthe
edge hi;ji is aij. We use the notation [n℄ to denote the set f1;2;:::;ng.
The determinant of the matrix A, det(A), is de(cid:12)ned as the signed sum of all
weighted permutations of Sn as follows:
X Y
det(A)= sgn((cid:27)) ai(cid:27)(i)
(cid:27)2Sn i
where sgn((cid:27)) is the number (modulo 2) of inversions in (cid:27) i.e. the
ardinality of the
DETERMINANT:OLDALGORITHMS,NEWINSIGHTS 3
set fhi;jiji<j;(cid:27)(i)>(cid:27)(j)g modulo 2.
Ea
h (cid:27) 2 Sn has a
y
le de
omposition, and(cid:18)it
orresponds to a se(cid:19)t of
y
les in
1 2 3 4 5
GA. For instan
e, with n = 5, the permutation has a
y
le
4 2 3 5 1
de
omposition (145)(2)(3) whi
h
orresponds to 3
y
les in GA. Su
h
y
les of GA
have an important property: they are all simple (non-interse
ting), disjoint
y
les;
whenput together,theytou
hea
hvertexexa
tlyon
e. Su
hsetsof
y
lesare
alled
y
le
overs. Note that
y
le
overs of GA and permutations of Sn are in bije
tion
with ea
h other.
We de(cid:12)ne weights of
y
le
overs to
orrespond to weights of permutations. The
weightofa
y
le isthe produ
t ofthe weightsof all edgesin the
y
le. The weightof
a
y
le
over is the produ
t of the weights of all the
y
les in it. Thus, viewing the
Q
y
le
over C as a set of edges, w(C)= e2Cw(eQ). Sin
e the weights of the edges are
di
tated by the matrix A, we
an write w(C)= hi;ji2Caij.
We
an also de(cid:12)ne the sign of a
y
le
over
onsistent with the sign of the
orre-
spondingpermutation. A
y
le
overiseven(resp.odd)ifit
ontainsanevennumber
(resp. odd) of even length
y
les. Equivalently, the
y
le
over is even (resp. odd) if
the number of
y
les plus the number of edges is even (resp. odd). De(cid:12)ne the sign of
a
y
le
over C to be +1 if C is even, and (cid:0)1 if C is odd. Cau
hy showed that with
this de(cid:12)nition, the sign of a permutation (based on inversions) and the sign of the
asso
iated
y
le
over is the same. For our use, this de(cid:12)nition of sign based on
y
le
overs will be more
onvenient.
Let C(GA) denote the set of all
y
le
overs in the graph GA. Then we have
X X Y
det(A)= sgn(C)w(C)= sgn(C) aij
C2C(GA) C2C(GA) hi;ji2C
Consider the
hara
teristi
polynomial of A,
n n(cid:0)1
(cid:31)A((cid:21))=det((cid:21)In(cid:0)A)=
0(cid:21) +
1(cid:21) +:::+
n(cid:0)1(cid:21)+
n
Tointerpretthese
oeÆ
ients,
onsiderthe graphGA((cid:21)) whose edgesarelabeled
a
ording to the matrix (cid:21)In(cid:0)A. The
oeÆ
ient
l
olle
ts part of the
ontribution
to det((cid:21)In (cid:0)A) from
y
le
overs having at least (n(cid:0)l) self loops. (A self loop at
vertexk now
arriesweight(cid:21)(cid:0)akk.) Thisisbe
ausea
y
le
overwithiselfloopshas
weight whi
h is a polynomial of degree i in (cid:21). For instan
e, with n=4,
onsider the
y
le
over h1;4i;h2;2i;h3;3i;h4;1i in GA((cid:21)). This has weight ((cid:0)a14)((cid:21)(cid:0)a22)((cid:21)(cid:0)
a33)((cid:0)a41),
ontributing a14a22a33a41 to
4, (cid:0)a14a41(a22 +a33) to
3, a14a41 to
2,
and 0 to
1.
Followingnotation from [22℄, we
onsider partial permutations,
orresponding to
partial
y
le
overs. A partial permutation (cid:27) is a permutation on a subset S (cid:18) [n℄.
The set S is
alled the domain of (cid:27), denoted dom((cid:27)). The
ompletion of (cid:27), denoted
(cid:27)^, is the permutation in Sn obtained by letting all elements outside dom((cid:27)) be (cid:12)xed
points. This permutation (cid:27)^
orrespondsto a
y
le
over C in GA, and (cid:27)
orresponds
to a subset of the
y
les in C. We
all su
h a subset a partial
y
le
overPC, and we
all C the
ompletion of PC. A partial
y
le
over is de(cid:12)ned to have the same parity
andsignasits
ompletion. Itiseasytoseethatthe
ompletionneednotbeexpli
itly
a
ountedforintheparity;apartial
y
le
overPC iseven(resp.odd)i(cid:11)thenumber
of
y
les in it, plus the number of edges in it, is even (resp. odd).
Getting ba
k to the
hara
teristi
polynomial, observe that to
olle
t the
ontri-
butions to
l, we must lookat all partial
y
le
overswith l edges. The n(cid:0)l verti
es
4 M.MAHAJANANDVVINAY
left un
overed by su
h a partial
y
le
over PC are the self-loops, from whose weight
the(cid:21) termhasbeen pi
kedup. Ofthel verti
es
overed,self-loops, if any,
ontribute
the (cid:0)akk term from their weight, not the (cid:21) term. And other edges, say hi;ji for
i 6= j,
ontribute weights (cid:0)aij. Thus the weights for PC evidently
ome from the
l
graph G(cid:0)A. If we interpret weights over the graph GA, a fa
tor of ((cid:0)1) must be
a
ounted for independently.
Formally,
Definition 2.1.
A
y
le is an ordered sequen
e of m edges C = he1;e2;:::;emi where ei =
hui;ui+1i for i 2 [m(cid:0)1℄ and em = hum;u1i and u1 (cid:20) ui for i 2 [m℄ and all the
ui's are distin
t. u1 is
alled the head of the
y
le, denoted h(C). The length of the
Qm
y
le is jCj = m, and the weight of the
y
le is w(C) = i=1w(ei). The vertex set
of the
y
le is V(C)=fu1;:::;umg.
An l-
y
le
over C is an ordered sequen
e of
y
les C = hC1;:::;Cki su
h that
V(Ci)\V(Cj)=(cid:30) for i6=j, h(C1)<:::<h(Ck) and jC1j+:::+jCkj=l.
Qk
The weight of the l-
y
le
over is wt(C)= j=1w(Cj), and the sign is sgn(C)=
l+k
((cid:0)1) .
As a matter of
onvention, we
all n-
y
le
overs simply
y
le
overs.
Proposition 2.2. The
oeÆ
ients of (cid:31)A((cid:21)) are given by
X
l
l =((cid:0)1) sgn(C)wt(C)
C is an l-
y
le
over in GA
3. Summing over permutations eÆ
iently. As noted in Proposition 2.2,
evaluating the determinant (or for that matter, any
oeÆ
ient of the
hara
teristi
polynomial)amountstoevaluatingthesignedweightedsumover
y
le
overs(partial
y
le
oversof appropriatelength). We
onsiderfoureÆ
ientalgorithmsfor
omput-
ing this sum. Ea
h expands this sum to in
lude more terms whi
h mutually
an
el
out. The di(cid:11)eren
es between the algorithms is essentially in the extent to whi
h the
sum is expanded.
3.1. From Cy
le Covers to Clow Sequen
es. Genaralize the notion of a
y
le and a
y
le
over as follows:
A
low(for
losed-walk)isa
y
leinGA(notne
essarilysimple)withtheproperty
that the minimum vertex in the
y
le {
alled the head { is visited only on
e. An
l-
low sequen
e is a sequen
e of
lows where the heads of the
lows are in stri
tly
in
reasingorderand the total number ofedges (
ounting ea
hedge asmany times as
it is used) is l.
Formally,
Definition 3.1. A
low is an ordered sequen
e of edges C = he1;e2;:::;emi
su
h that ei = hui;ui+1i for i 2 [m(cid:0)1℄ and em = hum;u1i and u1 6= uj for j 2
f2;:::;mg and u1 = minfu1;:::;umg. The vertex u1 is
alled the head of the
low
and denoted h(C). The length of the
low is jCj = m, and the weight of the
low is
Qm
w(C)= i=1w(ei).
An l-
low sequen
e C is an ordered sequen
e of
lows C =hC1;:::;Cki su
h that
h(C1)<:::<h(Ck) and jC1j+:::+jCkj=l.
Qk
The weight of the l-
low sequen
e C is wt(C)= j=1w(Cj), and the sign of C is
l+k
sgn(C)=((cid:0)1) .
DETERMINANT:OLDALGORITHMS,NEWINSIGHTS 5
Note that the set of l-
low sequen
es properly in
ludes the set of l-
y
le
overs
on a graph. And the sign and weight of a
y
le
overare
onsistent with its sign and
weight when viewed as a
low sequen
e.
Theorem 3.2 (Theorem 1 in [15℄).
X
l
l =((cid:0)1) sgn(C)wt(C)
C is an l-
low sequen
e
Proof. We
onstru
taninvolution'onthesetofl-
lowsequen
es. Theinvolution
2
hasthepropertythat' istheidentity,'mapsanl-
y
le
overtoitself,andotherwise
C and'(C)havethesameweightbutopposingsign. Thisshowsthatthe
ontribution
ofl-
lowsequen
esthatarenotl-
y
le
oversiszero. Consequently,onlyl-
y
le
overs
ontribute to the summation, yielding exa
tly
l.
LetC =hC1;:::;Ckibeanl-
lowsequen
e. Choosethesmallestisu
hthatCi+1
toCk isap-
y
le
overforsomep. Ifi=0,theinvolutionmapsC toitself. Otherwise,
having
hosen i, traverse Ci starting from h(Ci) until one of two things happen.
1. We hit a vertex that tou
hes one of Ci+1 to Ck.
2. We hit a vertex that
ompletes a
y
le within Ci.
Let us
all the vertex v. Given the way we
hose i, su
h a v must exist. Vertex v
annot satisfy both of the above
onditions.
Case 1: . Suppose v tou
hes Cj. Map C to a
low sequen
e
0 0
C =hC1;:::;Ci(cid:0)1;Ci;Ci+1;:::;Cj(cid:0)1;Cj+1;:::Cki
0
Themodi(cid:12)ed
low,Ci isobtainedfromCi byinsertingthe
y
leCj intoitatthe(cid:12)rst
o
uren
e of v.
Case 2: . Suppose v
ompletes a simple
y
le C in Ci. Cy
le C must be disjoint
from all the later
y
les. We now modify the sequen
e C by deleting C from Ci and
introdu
ing C as a new
low in an appropriate position, depending on the minimum
labeled vertex in C, whi
h we make the head of C.
Figure 3.1 illustrates the mapping.
Inbothoftheabove
ases,thenewsequen
e
onstru
tedmapsba
ktotheoriginal
sequen
eintheopposite
ase. Furthermore,thenumberof
lowsinthetwosequen
es
di(cid:11)erbyone,andhen
ethesignsareopposing,whereastheweightisun
hanged. This
is the desired involution.
Furthermore,theabovemappingdoesnot
hangetheheadofthe(cid:12)rst
lowinthe
sequen
e. So if the goal is to
ompute the determinant whi
h sums up the n-
y
le
overs,then the headof the (cid:12)rst
y
le must be the vertex1. So it suÆ
es to
onsider
low sequen
es where the (cid:12)rst
low has head 1.
Algorithm using
low sequen
es. Both sequential and parallel algorithms based
on the
low sequen
es
hara
terization are des
ribed in [15℄. We brie(cid:13)y des
ribe the
implementation idea below, for the
ase
n.
The goalis to sum up the
ontributionof all
lowsequen
es. The
lowsequen
es
an be partitioned into n groups based on the number of
lows. Let Ck be the sum
n+k
of the weighPtsnof all
low sequen
es with exa
tly k
lows, and let Dk = ((cid:0)1) Ck.
Then
n = k=1Dk.
To
ompute Ck, we use a divide-and-
onquer approa
h on the number of
lows:
any
low sequen
e
ontributing to Ck
an be suitably split into two partial
low
sequen
es, with the left sequen
e having dk=2e
lows. The heads of all
lows in the
left part must be less than the head of the (cid:12)rst
low in the rightmost part. And the
6 M.MAHAJANANDVVINAY
head head
v
v
v
CASE 1 CASE 2
Fig. 3.1. Pairing
low sequen
es of opposing signs
lengthsoftheleftandtherightpartial
lowsequen
esmustaddupton. Letvariable
g[p;l;u;v℄sumuptheweightsofallpartial
lowsequen
eswithp
lows,l edges,head
of (cid:12)rst
low u, and heads of all
lows at most v. (We need not
onsider variables
where l < p or u > v.) Then Ck = g[k;n;1;n℄, and su
h variables
an be evaluated
by the formula
8 X
>>< g[q;r;u;w(cid:0)1℄(cid:1)g[p(cid:0)q;l(cid:0)r;w;v℄ if p>1
g[p;l;u;v℄= q(cid:20)r(cid:20)q+(l(cid:0)p)
>>: u<w(cid:20)v
g[l;u℄ if p=1
whereq =dp=2e. The variableg[l;u℄sumsuptheweightsofall
lowsoflengthl with
head u, and is also evaluated in a divide-and-
onquer fashion. A
low with head u is
eitheraself-loopifl=1,oritmust(cid:12)rstvisitsomevertexv >u,(cid:12)ndapathoflength
l(cid:0)2 to some vertex w >u through verti
es all greater than u, and then return to u.
So
8
< P auu if l=1
g[l;u℄=: P v;w>uauv(cid:1)awu if l=2
v;w>uauv(cid:1)
[l(cid:0)2;u;v;w℄(cid:1)awu otherwise
The variable
[l;u;v;w℄ sums the weights of all length l paths from v to w going
through verti
es greater than u. These variables
an be evaluated as follows:
[1;u;v;w℄ =avw
P
[l;u;v;w℄ = x>u
[p;u;v;x℄(cid:1)
[l(cid:0)p;u;x;w℄ if l>1, where p=dl=2e
3.2. Clow Sequen
eswiththe Pre(cid:12)x Property: Gettingto Samuelson's
Method. The generalization from
y
le
overs to
low sequen
es has a
ertain ex-
travagan
e. The reason for going to
low sequen
es is that evaluating their weighted
sum is easy, and this sum equals the sum over
y
le
overs. However, there are sev-
eral
low sequen
es whi
h we
an drop from
onsideration without sa
ri(cid:12)
ing ease of
omputation. One su
h set arises from the following
onsideration:
DETERMINANT:OLDALGORITHMS,NEWINSIGHTS 7
In a
y
le
over,all verti
esare
overed exa
tly on
e. Suppose we enumerate the
verti
es in the order in whi
h they are visited in the
y
le
over (following the order
imposedbythe
y
leheads). Ifvertexhbe
omestheheadofa
y
le,thenallverti
es
in this and subsequent
y
les are larger than h. So all the lower numbered verti
es
must have been already visited. So at least h(cid:0)1 verti
es, and hen
e h(cid:0)1 edges,
must have been
overed.
We
an require our
low sequen
es also to satisfy this property. We formalize
the pre(cid:12)x property: a
low sequen
e C = hC1;:::;Cki has the pre(cid:12)x property if for
1(cid:20)r (cid:20)k, the total lengths of the
lows C1;:::;Cr(cid:0)1 is at leasth(Cr)(cid:0)1. A similar
pre(cid:12)x property
an be formalized for partial
y
le
overs. Formally,
Definition 3.3. An l-
low sequen
e C = hC1;:::;Cki is said to have the pre(cid:12)x
property if it satis(cid:12)es the following
ondition:
Xr(cid:0)1
8r2[k℄; jCtj(cid:21)h(Cr)(cid:0)1(cid:0)(n(cid:0)l)
t=1
Theinterestingfa
tisthattheinvolution
onstru
tedin theprevioussub-se
tion
for
low sequen
es workseven overthis restri
ted set!
Theorem 3.4 (Theorem 2 in [25℄).
X
l
l =((cid:0)1) sgn(C)wt(C)
C is an l-
low sequen
e
with the pre(cid:12)x property
A new proof of the above theorem.
In[25℄,Valiantobservesthatpre(cid:12)x
lowsequen
esaretheterms
omputedbySamuel-
son'smethodforevaluating(cid:31)(cid:21)(A). Hen
ethe
orre
tnessofthetheoremfollowsfrom
the
orre
tness of Samuelson's method. And the
orre
tness of Samuelson's method
is traditionally shown using linear algebra.
Here is a simple alternative
ombinatorial proof of this theorem. Observe that
the involution de(cid:12)ned in the proof of Theorem 3.2 maps
low sequen
es with pre(cid:12)x
property to
low sequen
es with pre(cid:12)x property. Why? Let C be an l-
low sequen
e
with the pre(cid:12)x property, satisfying
ase 1 in the proof. Sin
e the length of
low
Ci only in
reases in the pro
ess, the pre(cid:12)x property
ontinues to hold. Now let C
be an l-
low sequen
e with the pre(cid:12)x property, satisfying
ase 2. The involution
0
onstru
ts a new l-
low sequen
e C by deta
hing
y
le C from
low Ci and inserting
it later in the sequen
e, say between Cj(cid:0)1 and Cj. This does not
hange h(Ci).
0
Let C = D = hD1;:::;Dk+1i; here Dt = Ct for t 2 [i (cid:0)1℄ or for t = i +1 to
j (cid:0)1, Di = CinC, Dj = C and Dt+1 = Ct for t = j to k. We must show that
D has the pre(cid:12)x property. For r 2 [i℄, and for r = j +1 to k +1, the
ondition
Pr(cid:0)1
t=1 jDtj (cid:21) h(Dr)(cid:0)1(cid:0)(n(cid:0)l) holds be
ause C has the pre(cid:12)x property. Now let
i+1 (cid:20) r (cid:20) j. Sin
e Ci was
hosen from C for modi(cid:12)
ation, and sin
e i+1 (cid:20) r,
we know that Dr;:::;Dk+1 form a partial
y
le
over i.e. they form simple disjoint
y
les. Andthe headsofthese
y
lesarearrangedin in
reasingorder. Sotheverti
es
overed in Dr;:::;Dk+1 must all be at least as large as h(Dr) and all distin
t. But
8 M.MAHAJANANDVVINAY
there are only n(cid:0)h(Dr)+1 su
h verti
es. Hen
e
Pk+1
t=r jDtj (cid:20) n(cid:0)h(Dr)+1
Pr(cid:0)1
l(cid:0) t=1 jDtj (cid:20) n(cid:0)h(Dr)+1
Pr(cid:0)1
t=1 jDtj (cid:21) h(Dr)(cid:0)1(cid:0)(n(cid:0)l)
and D satis(cid:12)es the pre(cid:12)x property.
Thus in summing over all l-
low sequen
es with the pre(cid:12)x property, the only l-
lowsequen
esthatdonot
an
eloutarethel-
y
le
overs,givingthe
laimedresult.
Algorithm using pre(cid:12)x
low sequen
es. To
ompute
l usingthis
hara
terization,
wemustsumupthe
ontributionofalll-
lowsequen
eswiththepre(cid:12)xproperty. One
wayistomodifythedynami
programmingapproa
husedintheprevioussub-se
tion
for
low sequen
es. This
an be easily done. Let us instead do things di(cid:11)erently; the
reason will be
ome
lear later.
Adopt the
onvention that there
an be
lows of length 0. Then ea
h l-
low
sequen
e C has exa
tly one
low Ci with head i, for i = 1 to n. So we write C =
hC1;:::;Cni.
De(cid:12)ne the signed weight of a
low C as sw(C) = (cid:0)w(C) if C has non-zero
length, and sw(C)=1otherwise. And de(cid:12)ne the signedweightof an l-
lowsequen
e
Qn l
as sw(C) = i=1sw(C). Then sgn(C)w(C) = ((cid:0)1) sw(C). So from the pre
eding
theorem,
X
l = sw(C)
C is an l-
low sequen
e
with thepre(cid:12)x property
We say that a sequen
e of non-negative integers l1;:::;ln satis(cid:12)es the property
pre(cid:12)x(l) if
Pn
1. t=1lt =l, and
Pr(cid:0)1 Pn
2. For r 2[n℄, t=1 lt (cid:21)r(cid:0)1(cid:0)(n(cid:0)l). Alternatively t=rlt (cid:20)n(cid:0)r+1.
Su
h sequen
es are \allowed" as lengths of
lows in the
low sequen
es we
onstru
t;
no other sequen
es are allowed.
We group the
low sequen
es with pre(cid:12)x property based on the lengths of the
individual
lows. In a
low sequen
e with pre(cid:12)x property C, if the length of
low Ci
(the possibly empty
low with head i) is li, then any
low with head i and length li
anrepla
eCi inC andstillgivea
lowsequen
esatisfyingthepre(cid:12)xproperty. Thus,
if z(i;p) denotes the total signed weight of all
lows that have vertex i as head and
length p, then
X Yn
l = z(i;li)
l1;:::;ln:pre(cid:12)x(l) i=1
To
ompute
l eÆ
iently, wepla
ethevaluesz(i;p)appropriatelyinaseriesofmatri-
es B1;:::;Bn. The matrix Bk has entries z(k;p). Sin
e we only
onsider sequen
es
satisfying pre(cid:12)x(l), it suÆ
es to
onsider z(k;p) for p (cid:20) n(cid:0)k+1. Matrix Bk is of
dimension(n(cid:0)k+2)(cid:2)(n(cid:0)k+1)andhasz(k;p)onthepthlowerdiagonalasshown
below.
DETERMINANT:OLDALGORITHMS,NEWINSIGHTS 9
2 3
z(k;0) 0 0 (cid:1)(cid:1)(cid:1) 0 0
6 z(k;1) z(k;0) 0 (cid:1)(cid:1)(cid:1) 0 0 7
6 7
6 z(k;2) z(k;1) z(k;0) (cid:1)(cid:1)(cid:1) 0 0 7
6 7
Bk =6 . . . . 7
6 .. .. .. .. 0 7
6 7
4 z(k;n(cid:0)k) z(k;n(cid:0)k(cid:0)1) z(k;n(cid:0)k(cid:0)2) (cid:1)(cid:1)(cid:1) z(k;1) z(k;0) 5
z(k;n(cid:0)k+1) z(k;n(cid:0)k) z(k;n(cid:0)k(cid:0)1) (cid:1)(cid:1)(cid:1) z(k;2) z(k;1)
Now from the equation for
l, it is
lear that
! !
X Yn Yn
l = Bi[ji(cid:0)1;ji℄= Bi [l+1;1℄
l+1=j0(cid:21)j1(cid:21)j2(cid:21):::(cid:21)jn=1: i=1 i=1
j0(cid:0)j1;j1(cid:0)j2;:::;jn(cid:0)1(cid:0)jn:pre(cid:12)x(l)
or, more su
intly,
Yn
T
[
0
1
2
3 (cid:1)(cid:1)(cid:1) (cid:1)(cid:1)(cid:1)
n ℄ = Bk
k=1
It remains now to
ompute z(i;p), the entries in the B matri
es. We know that
z(i;0) = 1 and z(i;1) = (cid:0)aii. For p (cid:21) 2, a
low of length p with head i must (cid:12)rst
visit a vertex u > i, then perform a walk of length p(cid:0)2 via verti
es greater than i
to some vertex v > i, and then return to i. To
onstru
t the path, we exploit the
p
fa
tthat the (j;k)th entry in amatrix A givesthe sum ofthe weightsof all paths in
GA of length exa
tly p from j to k. So we must
onsider the indu
ed subgraph with
verti
es i+1;:::;n. This has an adja
en
y matrix Ai+1 obtained by removing the
(cid:12)rst i rows and the (cid:12)rst i
olumns of A. So A1 =A. Consider the submatri
es of Ai
as shown below.
0 (cid:0) (cid:1) 1
0 aii 1 Ri
B 0 1 C
B C
B B C C
B B C B C C
Ai =BBBB BBBB Si CCCC BBB Ai+1 CCCA CCCC
A A
Then the
lows
ontributing to z(i;p) must use an edge in Ri, perform a walk
p(cid:0)2
orresponding to Ai+1, and then return to i via an edge in Si. In other words,
p(cid:0)2
z(i;p)=(cid:0)Ri Ai+1 Si
10 M.MAHAJANANDVVINAY
So the matri
es Bk look like this:
2 3
1 0 0 (cid:1)(cid:1)(cid:1) 0 0
6 (cid:0)akk 1 0 (cid:1)(cid:1)(cid:1) 0 0 7
6 7
6 (cid:0)RkSk (cid:0)akk 1 (cid:1)(cid:1)(cid:1) 0 0 7
6 7
6 . . . . 7
6 .. .. .. .. 0 7
6 7
Bk =66 ... ... ... ... 0 77
6 7
6 7
6 7
66 (cid:0)RkAnk+(cid:0)1k(cid:0)2Sk (cid:0)RkAnk+(cid:0)1k(cid:0)3Sk (cid:0)RkAnk+(cid:0)1k(cid:0)4Sk (cid:1)(cid:1)(cid:1) (cid:0)akk 1 77
4 5
n(cid:0)k(cid:0)1 n(cid:0)k(cid:0)2 n(cid:0)k(cid:0)3
(cid:0)RkAk+1 Sk (cid:0)RkAk+1 Sk (cid:0)RkAk+1 S1 (cid:1)(cid:1)(cid:1) (cid:0)RkSk (cid:0)akk
This method of
omputing (cid:31)A((cid:21)) is pre
isely Samuelson's method [19, 8, 1, 25℄.
SamuelsonarrivedatthisformulationusingLapla
e'sTheoremonthematrix(cid:21)I(cid:0)A,
whereas we have arrived at it via
low sequen
es with the pre(cid:12)x property. This
interpretationoftheSamuelson-BerkowitzalgorithmisduetoValiant[25℄;the
ombi-
natorialproofof
orre
tness(proofofTheorem 3.4)isnew. (It ismentioned, without
details, in [15℄.)
3.3. From Clows to Tour Sequen
es Tables: Getting to Chistov's Al-
gorithm. We now move in the other dire
tion { generalize further beyond
low se-
quen
es. Firstly, we relax the
ondition that the head of a
low may be visited only
on
e. Thisgivesusmoregeneralized
losedwalkswhi
hwe
alltours. To(cid:12)xa
anon-
i
al representation, we do require the edges of the tour to be listed beginning from
an o
urren
e of the head. Sin
e there
ould be multiple su
h o
urren
es, we get
di(cid:11)erent tours with the same multiset of edges. For instan
e, the tour
orresponding
to the vertex sequen
e 253246 is di(cid:11)erent from the tour
orresponding to the vertex
sequen
e 246253. Se
ondly, we deal with not just sequen
es but ordered lists, or ta-
bles, of sequen
es. Within a sequen
e, the tours are ordered by their heads (and all
heads are distin
t). However, there is no restri
tion on how the sequen
es must be
ordered in the table. In fa
t, for the same multi-set of sequen
es, di(cid:11)erent orderings
ofthesequen
eswillgivedi(cid:11)erenttablesthatwetreatasdistin
t. Thirdly,theparity
of a tour sequen
e table depends on the number of sequen
es in it, not the number
of tours in it. A
low sequen
e is thus a tour sequen
e table where (i) ea
h sequen
e
ontains a single tour whi
h is a
low, and (ii) within the table the sequen
es are
ordered by their tour heads. Formally,
Definition 3.5. A tour is an ordered sequen
e of edges C =he1;e2;:::;epi su
h
that ei =hui;ui+1i for i2[p(cid:0)1℄ and ep =hup;u1i and ui =minfu1;:::;umg. The
vertex u1 is
alled the head of the tour and denQomted h(C). The length of the tour is
jTj=p, and the weight of the tour is wt(T)= i=1w(ei).
A j-tour sequen
e T is an ordered sequen
e of tours T = hT1;:::;Tki su
h that
h(T1) < ::: < h(Tk) and jT1j+:::+jTkj = j. The weight of the tour sequen
e is
Qk
wt(T)= j=1wt(Tj), and the length is jTj=j.
An l-tour sequen
e table TST is an ordered sequen
e of tour sequen
es F =
hQT1r;:::;Tri su
h that jT1j + (cid:1)(cid:1)(cid:1) +l+jrTrj = l. The weight of the TST is wt(F) =
j=1wt(Tj), and the sign is ((cid:0)1) .
The following theorem shows that even TSTs
an be used to
ompute the
har-
a
teristi
polynomial.