Balanced Sparsest Generator Matrices for MDS Codes
aa r X i v : . [ c s . I T ] J a n Balanced Sparsest Generator Matrices for MDSCodes
Son Hoang Dau ∗ , Wentu Song † , Zheng Dong ‡ , Chau Yuen § Singapore University of Technology and Design, SingaporeEmails: { ∗ sonhoang dau , † wentu song , ‡ dong zheng , § yuenchau } @sutd.edu.sg Abstract —We show that given n and k , for q sufficiently large,there always exists an [ n, k ] q MDS code that has a generatormatrix G satisfying the following two conditions: (C1) Sparsest: each row of G has Hamming weight n − k + 1 ; (C2) Balanced: Hamming weights of the columns of G differfrom each other by at most one. I. I
NTRODUCTION
We study the existence and provide a construction of a sparsest and balanced generator matrix of Maximum DistanceSeparable (MDS) codes. A generator matrix is the sparsestif it contains the least number of nonzero entries among allgenerator matrices of the same MDS code. A generator matrixis balanced if every column contains approximately the samenumber of nonzero entries. More specifically, we require thatthe number of nonzero entries in each column differs fromeach other by at most one.Apart from being of theoretical interest, our study onbalanced sparsest generator matrices for MDS codes wasmotivated by its application in error correction for sensornetworks. Suppose n sensors, S , . . . , S n , collectively measure k conditions x , . . . , x k , such as temperature, pressure, lightintensity, etc. Let x = ( x , . . . , x k ) , where x i ∈ F q for each i = 1 , . . . , k ( F q is a finite field of q elements). These sensorstransmit the information they collected to a base station, whichis a data collector. Furthermore, each sensor performs someencoding on the information it has, before transmitting theinformation back to the base station in the following way. Let G be an k × n generator matrix of an [ n, k, d ] q error-correctingcode. Sensor S i transmits the scalar product of x and column i of G to the base station. It is well known in classicalcoding theory that this coding scheme allows the base stationto retrieve x when at most ⌊ d − ⌋ sensors transmit wronginformation. Moreover, the base station can also identifythe malfunctioned sensors. For each sensor S i , only thoseconditions corresponding to nonzero entries of column i of G are involved into encoding. So it is sufficient for S i to measureonly such conditions. Thus, if G is sparse then in average,each sensor only needs to measure a few among k conditionsin order to achieve the desired error correction capability. Ontop of that, if columns of G have approximately the samenumber of nonzero entries then the sensors are required tomeasure approximately the same number of conditions. Thisbalance guarantees an even distribution of workload amongsensors, which is an important criterion for sensor networkswhere energy saving is a critical issue. In fact, any error-correcting code can be used in theaforementioned scheme for sensor networks. We choose tostudy MDS codes first because their structure, especially theirweight distribution, is well studied (see, for instance [1, Ch.11]). Moreover, they have optimal error-correcting capability,given the length and the dimension. We prove that over asufficiently large field, there always exists an MDS code thathas a balanced and sparsest generator matrix, which is ideallysuitable for the above encoding scheme for sensor networks.Necessary notations and definitions are provided in Sec-tion II. We state and prove our main result in Section III.II. P RELIMINARIES
We denote by F q the finite field with q elements. Let [ n ] denote the set { , , . . . , n } . The support of a vector u = ( u , . . . , u n ) ∈ F nq is defined by supp ( u ) = { i ∈ [ n ] : u i = 0 } . The (Hamming) weight of u is | supp ( u ) | . We canalso define weight and support of a row or a column of amatrix over some finite field, by regarding them as vectorsover that field. Apart from Hamming weight, we also useother standard notions from coding theory such as minimumdistance, linear [ n, k ] q and [ n, k, d ] q codes, MDS codes, andgenerator matrices (for instance, see [1]).For a matrix G = ( g i,j ) ∈ F k × nq , the support matrix of G ,denoted supp ( G ) , is a k × n binary matrix M = ( m i,j ) where m i,j = 0 if g i,j = 0 and m i,j = 1 if g i,j = 0 . Let M =( m i,j ) be a k × n binary matrix. We denote by var ( M ) =( v i,j ) the matrix obtained from M by replacing every nonzeroentry m i,j = 1 by ξ i,j , where ξ i,j ’s are indeterminates. Moreformally, v i,j = 0 if m i,j = 0 and v i,j = ξ i,j if m i,j = 1 .We also denote by gr ( M ) the bipartite graph G = ( V , E ) defined as follows. The vertex set V can be partitioned intotwo parts, namely, the left part L = { ℓ , . . . , ℓ k } , and the rightpart R = { r , . . . , r n } . The edge set is E = (cid:8) ( ℓ i , r j ) : i ∈ [ k ] , j ∈ [ n ] , m i,j = 0 (cid:9) . For any k × n matrix N , we define f ( N ) = Q P det( P ) ,where the product is taken over all (cid:0) nk (cid:1) submatrices P of order k of N . III. M AIN R ESULT
A sparsest generator matrix of an [ n, k ] q MDS code wouldhave precisely n − k +1 nonzero entries in every row. Moreover,if it is balanced, then each column contains either ⌊ k ( n − k +1) n ⌋ or ⌈ k ( n − k +1) n ⌉ nonzero entries. Hereafter, we often use R i , ∈ [ k ] , and C j , j ∈ [ n ] , to denote the supports of row i andcolumn j , respectively, of a k × n binary matrix M . Note that R i ⊆ [ n ] and C j ⊆ [ k ] . Lemma 1.
Let M = ( m i,j ) be a k × n binary matrix. Supposethat each row of M has weight n − k + 1 . Then M is thesupport matrix of a generator matrix of some [ n, k ] q MDScode over a sufficiently large field F q ( q > (cid:0) n − k − (cid:1) ) if and onlyif f ( var ( M )) .Proof: Suppose M = supp ( G ) , where G = ( g i,j ) is a generator matrix of some [ n, k ] q MDS code. Due toa well-known property of MDS codes (see [1, p. 319]),every submatrix of order k of G has nonzero determinant.Therefore, f ( G ) = 0 . Note that f ( var ( M )) can be regardedas a multivariable polynomial in F q [ . . . , ξ i,j , . . . ] . Moreover,since M = supp ( G ) , we deduce that f ( G ) can be obtainedfrom f ( var ( M )) by substituting ξ i,j by g i,j for all i, j where g i,j = 0 . As f ( G ) = 0 , we conclude that f ( var ( M )) .Now suppose that f ( var ( M )) . Note that each columnof var ( M ) belongs to precisely (cid:0) n − k − (cid:1) submatrices of order k of var ( M ) . Hence the exponent of each ξ i,j in f ( var ( M )) is at most (cid:0) n − k − (cid:1) . Since f ( var ( M )) , by [2, Lemma4], if q > (cid:0) n − k − (cid:1) then there exist g i,j ∈ F q (for i, j where m i,j = 1 ) so that f ( var ( M ))( . . . , g i,j , . . . ) = 0 . Let G = ( g i,j ) (for i, j where m i,j = 0 we set g i,j = 0 ). Since f ( G ) = f ( var ( M ))( . . . , g i,j , . . . ) = 0 , again by [1, p. 319],we deduce that G is a generator matrix of an [ n, k ] q MDScode. Therefore, each row of G has weight at least n − k + 1 ,due to the Singleton Bound (see [1, p. 33]). Since each rowof M also has weight n − k + 1 , we deduce that g i,j = 0 whenever m i,j = 1 . Therefore, M = supp ( G ) . Lemma 2.
Let M = ( m i,j ) be a k × n binary matrix.Then f ( var ( M )) if and only if every bipartite subgraphinduced by the k left-vertices and some k right-vertices in gr ( M ) has a perfect matching.Proof: Let G = gr ( M ) . Each submatrix P of order k of var ( M ) corresponds to a bipartite subgraph H P inducedby the k left-vertices and some k right-vertices in G . In theliterature, P is usually referred to as the Edmonds matrix of H P . It is well known (see [3, p. 167]) that a bipartite graph hasa perfect matching if and only if the deteminant of its Edmondsmatrix is not identically zero. Hence the proof follows. Lemma 3.
Let M = ( m i,j ) be a k × n binary matrix. Thenevery bipartite subgraph induced by the k left-vertices andsome k right-vertices in gr ( M ) has a perfect matching if andonly if (cid:12)(cid:12) ∪ j ∈ J C j (cid:12)(cid:12) ≥ | J | , for every subset J ⊆ [ n ] , | J | ≤ k. (1) Proof:
Let G = gr ( M ) . Each submatrix P of order k of var ( M ) corresponds to a bipartite subgraph H P induced bythe k left-vertices and some k right-vertices in G . The lemmafollows by applying Hall’s marriage theorem to each of suchsubgraphs of gr ( M ) . Lemma 4.
Let M = ( m i,j ) be a k × n binary matrix. Thecondition (1) is equivalent to (cid:12)(cid:12) ∪ i ∈ I R i (cid:12)(cid:12) ≥ n − k + | I | , for every subset ∅ = I ⊆ [ k ] . (2) Proof:
Suppose that (1) holds and that there exists anonempty set I ⊆ [ k ] satisfying (cid:12)(cid:12) ∪ i ∈ I R i (cid:12)(cid:12) ≤ n − k + | I | − . (3)We aim to obtain a contradiction. The condition (3) is equiv-alent to (cid:12)(cid:12) ∩ i ∈ I R i (cid:12)(cid:12) ≥ k − | I | + 1 . (4)Hence there exists a set J of k − | I | + 1 columns of M thatsatisfies (cid:12)(cid:12) ∩ j ∈ J C j (cid:12)(cid:12) ≥ | I | . Equivalently we have (cid:12)(cid:12) ∪ j ∈ J C j (cid:12)(cid:12) ≤ k − | I | < k − | I | + 1 = | J | . (5)We obtain a contradiction between (1) and (5). The “only if”direction can be proved in a similar manner. Lemma 5.
Let M = ( m i,j ) be a k × n binary matrix. Supposethat each row of M has weight n − k + 1 . Then M is thesupport matrix of a generator matrix of some [ n, k ] q MDScode over a sufficiently large field F q ( q > (cid:0) n − k − (cid:1) ) if and onlyif (2) holds.Proof: The proof follows from Lemma 1-4.We present below our main result.
Theorem 6 (Main Theorem) . Suppose ≤ k ≤ n and q > (cid:0) n − k − (cid:1) . Then there always exists an [ n, k ] q MDS code that hasa generator matrix G satisfying the following two conditions. (C1) Sparsest: each row of G has weight n − k + 1 . (C2) Balanced: column weights of G differ from each otherby at most one. By Lemma 5, to prove Theorem 6, we need to show thatthere always exists a k × n binary matrix M satisfying thefollowing properties(P1) each row of M has weight n − k + 1 ,(P2) column weights of M differ from each other by at mostone,(P3) (cid:12)(cid:12) ∪ i ∈ I R i (cid:12)(cid:12) ≥ n − k + | I | , for every subset ∅ = I ⊆ [ k ] ,where R i denotes the support of row i of M .We prove the existence of such a binary matrix by designingan algorithm (Algorithm 1) that starts from an initial binarymatrix which satisfies (P1) and (P3). In each iteration, thematrix at hand is slightly modified so that it still satisfies (P1)and (P3) and its column weights become more balanced. Whenthe algorithm terminates, it produces a matrix that satisfies(P1), (P2), and (P3).Observe that it is fairly easy to construct a binary matrixthat satisfies (P1) and (P2), using the Gale-Ryser Theorem (seeManfred [4]). However, (P1) and (P2) do not automaticallyguarantee (P3). Indeed, the matrix P given below satisfiesboth (P1) and (P2). However, (P3) is violated if we choose I = { , , } . P = . f M be any k × n binary matrix that satisfies both(P1) and (P3). For instance, we can shift the vector (1 1 · · · | {z } n − k +1 · · · k times cyclically to produce k rowsof such a matrix as below. f M = · · · · · ·
00 1 1 · · · · · ·
00 0 1 · · · · · · ... ... ... . . . ... ... ... ... . . . ... · · · · · · . The Algorithm 1 takes f M as an input parameter. Algorithm 1Input: n , k , f M ; Initialization: M := f M ; repeat Let max and min be the maximum and minimumweights of columns of M ; if max − min ≤ then Return M ; end if Find two columns j max and j min that have weights max and min , respectively; Find a row i s satisfying m i s ,j max = 1 and m i s ,j min = 0 and moreover, if we set m i s ,j max :=0 and m i s ,j min := 1 then M still satisfies (P1) and(P3); Swapping: set m i s ,j max = 0 and m i s ,j min := 1 ; until max − min ≤ ;Due to space constraint, we have prepared a separate noteat [5] with an example to demonstrate the algorithm. Lemma 7.
Suppose in every iteration, Algorithm 1 can alwaysfind a legitimate row described in Step 7. Then the algorithmterminates after finitely many iterations and returns a matrixsatisfying (P1), (P2), and (P3).Proof:
At a certain iteration, let ∆ = max − min . Afterswapping the two entries m i s ,j max and m i s ,j min , the weightof column j max is decreased by one whereas the weight ofcolumn j min is increased by one. Therefore, after at most ⌊ n/ ⌋ iterations, ∆ is decreased by at least one. Hence, thealgorithm must terminate after finitely many iterations. Theouput matrix obviously satisfies (P1), (P2), and (P3). Lemma 8.
In every iteration of Algorithm 1, a row i s asdescribed in Step 7 of the algorithm can always be found. Since column j max has a larger weight than column j min ,there always exists at least one row i s where m i s ,j max = 1 and m i s ,j min = 0 . Obviously, swapping m i s ,j max and m i s ,j min does not make M violate (P1). The stricter criterion is that M must still satisfy (P3) after the swap. We need a few moreauxiliary results before we can prove Lemma 8.Suppose at a certain iteration, we choose some columns j max and j min that have maximum and minimum weights, respectively. Without loss of generality, we assume that thefirst t rows are all the rows of M satisfying the property thateach of them has a one at column j max and a zero at column j min . In other words, assume that { i ∈ [ k ] : m i,j max = 1 and m i,j min = 0 } = [ t ] . Since max − min ≥ , we have t ≥ .Suppose, for contradiction, that none of these t rows satisfythe condition in Step 7 of Algorithm 1. Let M ( i ) , i ∈ [ t ] , bethe matrix obtained from M after swapping the two entries m i,j max and m i,j min . Then M ( i ) , i ∈ [ t ] , does not satisfy (P3).Since M satisfies (P3) and the only difference between M ( i ) and M is the row i , the set of rows of M ( i ) that violates thecondition (P3) must contain row i . Therefore, for each i ∈ [ t ] ,there exists a set I i ⊂ [ k ] , i / ∈ I i , such that { i } ∪ I i is a setof rows that violates (P3) in M ( i ) . For our purpose, for each i ∈ [ t ] , we choose I i to be of minimum size among those setsthat satisfied the aforementioned requirement. Since for each i ∈ [ t ] , | R ( i ) i | = | R i | = n − k + 1 , we deduce that I i = ∅ .Let R ( i ) r denote the support of row r of M ( i ) , i ∈ [ t ] , r ∈ [ k ] . Note that R r denotes the support of row r of M , r ∈ [ k ] .For simplicity, we use R ( i ) I to denote the union ∪ r ∈ I R ( i ) r forany subset I ⊆ [ k ] . Since { i } ∪ I i is the set of rows of M ( i ) that violates (P3), for every i ∈ [ t ] we have | R ( i ) { i }∪ I i | ≤ n − k + |{ i } ∪ I i | − n − k + | I i | . (6) Lemma 9.
For all i, i ′ ∈ [ t ] , the following statements hold a) R ( i ) i ′ = ( R i ′ , if i ′ = i, ( R i ′ \ { j max } ) ∪ { j min } , if i ′ = i, b) R ( i ) I i = R I i , c) j max / ∈ R I i , d) j min ∈ R I i , e) i / ∈ I i ′ , f) | R ( i ) { i }∪ I i | = n − k + | I i | .Proof: Proof of a).
Note that all the rows of M ( i ) exceptfor the row i are the same as that of M . Therefore, R ( i ) i ′ = R i ′ if i ′ = i . As row i of M ( i ) is obtained from row i of M byswapping m i,j max = 1 and m i,j min = 0 , we deduce that R ( i ) i = ( R i \ { j max } ) ∪ { j min } . Proof of b).
By definition of I i , i / ∈ I i . Therefore, using Parta), we conclude that R ( i ) I i = R I i . Proof of c).
Suppose, for contradiction, that j max ∈ R I i . Dueto Part a) and b), we have R ( i ) { i }∪ I i = R ( i ) i ∪ R ( i ) I i = (( R i \ { j max } ) ∪ { j min } ) ∪ R I i = (( R i \ { j max } ) ∪ R I i ) ∪ { j min } = ( R i ∪ R I i ) ∪ { j min } ⊇ R { i }∪ I i . As M satisfies (P3), we have | R ( i ) { i }∪ I i | ≥ | R { i }∪ I i | ≥ n − k + |{ i } ∪ I i | = n − k + | I i | + 1 . This inequality contradicts (6).
Proof of d).
Suppose, for contradiction, that j min / ∈ R I i . Thenby Part a) and b) we have R ( i ) { i }∪ I i = (( R i \ { j max } ) ∪ { j min } ) ∪ R I i ⊇ { j min } ∪ R I i . M satisfies (P3), we deduce that | R ( i ) { i }∪ I i | ≥ |{ j min } ∪ R I i | = 1 + | R I i | ≥ n − k + | I i | . This inequality contradicts (6).
Proof of e).
Note that j max ∈ R i . However, by Part c), j max / ∈ R I i ′ . Hence, i / ∈ I i ′ . Proof of f).
Using Part a) we have | R ( i ) { i }∪ I i | = | R ( i ) i ∪ R ( i ) I i | = | R ( i ) i ∪ R I i | ≥ | R I i | ≥ n − k + | I i | , (7)where the last inequality comes from the fact that M satisfies(P3). Combining (6) and (7), the proof of f) follows. Lemma 10.
For all i, i ′ ∈ [ t ] , i = i ′ , it holds that I i ∩ I i ′ = ∅ .Proof: Without loss of generality, we prove that I ∩ I = ∅ . Suppose, for contradiction, that there exists ℓ ∈ I ∩ I . Wefirst present three claims, which are used later in this proof. Claim 1:
For i = 1 , we have | R ( i ) { i }∪ I i \{ ℓ } | = n − k + | I i | , (8)and R ℓ = R ( i ) ℓ ⊆ R ( i ) { i }∪ I i \{ ℓ } . (9) Proof of Claim 1:
Indeed, because of the minimalityof I i , the set { i } ∪ ( I i \ ℓ ) does not violate (P3) in M ( i ) .Therefore, | R ( i ) { i }∪ I i \{ ℓ } | ≥ n − k + |{ i } ∪ ( I i \ ℓ ) | = n − k + | I i | . On the other hand, R ( i ) { i }∪ I i \{ ℓ } ⊆ R ( i ) { i }∪ I i , which also hascardinality n − k + | I i | , due to Lemma 9 f). Therefore, R ( i ) { i }∪ I i \{ ℓ } = R ( i ) { i }∪ I i , and | R ( i ) { i }∪ I i \{ ℓ } | = | R ( i ) { i }∪ I i | = n − k + | I i | . We also deduce that R ( i ) ℓ ⊆ R ( i ) { i }∪ I i \{ ℓ } . By Lemma 9 a), wehave R ℓ = R ( i ) ℓ . Thus we complete the proof of Claim 1. Claim 2:
Let K = ( I \ { ℓ } ) ∩ ( I \ { ℓ } ) . Then for i = 1 , ,the following holds | R { i }∪ I i \{ ℓ } \ R { ℓ }∪ K \ { j max }| ≤ | R ( i ) { i }∪ I i \{ ℓ } | − | R { ℓ }∪ K | . (10) Proof of Claim 2:
Using Lemma 9 a) and b), we have R { i }∪ I i \{ ℓ } = R i ∪ R I i \{ ℓ } = R i ∪ R ( i ) I i \{ ℓ } = (( R ( i ) i ∪ { j max } ) \ { j min } ) ∪ R ( i ) I i \{ ℓ } ⊆ { j max } ∪ ( R ( i ) i ∪ R ( i ) I i \{ ℓ } )= { j max } ∪ R ( i ) { i }∪ I i \{ ℓ } . Therefore, R { i }∪ I i \{ ℓ } \ { j max } ⊆ R ( i ) { i }∪ I i \{ ℓ } . Hence | ( R { i }∪ I i \{ ℓ } \ R { ℓ }∪ K ) \ { j max }| = | ( R { i }∪ I i \{ ℓ } \ { j max } ) \ R { ℓ }∪ K |≤ | R ( i ) { i }∪ I i \{ ℓ } \ R { ℓ }∪ K | = | R ( i ) { i }∪ I i \{ ℓ } | − | R { ℓ }∪ K | , where the last equality can be explained by the fact that R { ℓ }∪ K ⊆ R ( i ) { i }∪ I i \{ ℓ } . Indeed, we have R ℓ ⊆ R ( i ) { i }∪ I i \{ ℓ } due to (9). Moreover, K ⊆ I i \ { ℓ } . Hence the aforementionedinclusion holds. We complete the proof of Claim 2. Claim 3: If I ∩ I = { ℓ } then for i = 1 , , we have | R { i }∪ I i \{ ℓ } \ R ℓ \ { j max }| ≤ | I i | − . (11) Proof of Claim 3:
Applying (10) with K = ∅ , we obtain | R { i }∪ I i \{ ℓ } \ R ℓ \ { j max }| ≤ | R ( i ) { i }∪ I i \{ ℓ } | − | R ℓ | ( ) = ( n − k + | I i | ) − ( n − k + 1)= | I i | − . We complete the proof of Claim 3.The remaining of the proof of Lemma 10 is divided intotwo cases. Our goal is to obtain contradictions in both cases.
Case 1: I ∩ I = { ℓ } .We aim to show that | R { , }∪ I ∪ I | < n − k + |{ , } ∪ I ∪ I | . (12)This is a contradiction of our assumption that M satisfies (P3).Firstly, since I ∩ I = { ℓ } , we have n − k + |{ , } ∪ I ∪ I | = n − k + | I | + | I | + 1 . (13)Secondly, we consider R { , }∪ I ∪ I = R ℓ ∪ ( R { }∪ I \{ ℓ } \ R ℓ ) ∪ ( R { }∪ I \{ ℓ } \ R ℓ )= R ℓ ∪ { j max } ∪ (( R { }∪ I \{ ℓ } \ R ℓ ) \ { j max } ) ∪ (( R { }∪ I \{ ℓ } \ R ℓ ) \ { j max } ) . Therefore, | R { , }∪ I ∪ I | ≤ | R ℓ | + 1 + | ( R { }∪ I \{ ℓ } \ R ℓ ) \ { j max }| + | ( R { }∪ I \{ ℓ } \ R ℓ ) \ { j max }| ( ) ≤ ( n − k + 1) + 1 + ( | I | −
1) + ( | I | − n − k + | I | + | I | . (14)Combining (13) and (14), we obtain (12). We complete theanalysis of Case 1. Case 2: ( I \ { ℓ } ) ∩ ( I \ { ℓ } ) = K = ∅ .We aim to prove that R ℓ ⊆ R K , (15)and | R K | = n − k + | K | . (16)If both (15) and (16) hold then | R { ℓ }∪ K | = | R K | = n − k + | K | < n − k + |{ ℓ } ∪ K | , which contradicts our assumption that M satisfies (P3).Let δ = | R ℓ \ R K | ≥ . As M satisfies (P3), let | R K | = n − k + | K | + ε, ε ≥ . Then | R { ℓ }∪ K | = | R K | + | R ℓ \ R K | = n − k + | K | + ε + δ. (17)We have R { , }∪ I ∪ I = R { ℓ }∪ K ∪ ( R { }∪ I \{ ℓ } \ R { ℓ }∪ K ) ∪ ( R { }∪ I \{ ℓ } \ R { ℓ }∪ K )= R { ℓ }∪ K ∪ { j max }∪ (( R { }∪ I \{ ℓ } \ R { ℓ }∪ K ) \ { j max } ) ∪ (( R { }∪ I \{ ℓ } \ R { ℓ }∪ K ) \ { j max } ) . Therefore | R { , }∪ I ∪ I | ≤ | R { ℓ }∪ K ∪ { j max }| + | ( R { }∪ I \{ ℓ } \ R { ℓ }∪ K ) \ { j max }| + | ( R { }∪ I \{ ℓ } \ R { ℓ }∪ K ) \ { j max }| ( ) ≤ | R { ℓ }∪ K | + 1+ | R (1) { }∪ I \{ ℓ } | − | R { ℓ }∪ K | + | R (2) { }∪ I \{ ℓ } | − | R { ℓ }∪ K | = | R (1) { }∪ I \{ ℓ } | + | R (2) { }∪ I \{ ℓ } |− | R { ℓ }∪ K | + 1 ( )( ) = ( n − k + | I | ) + ( n − k + | I | ) − ( n − k + | K | + ε + δ ) + 1 ≤ n − k + | I | + | I | − | K | + 1 . (18)Moreover, as I ∩ I = { ℓ } ∪ K , we have |{ , } ∪ I ∪ I | = 2 + | I | + | I | − |{ ℓ } ∪ K | = | I | + | I | − | K | + 1 . (19)As M satisfies (P3), from (18) and (19), we conclude that | R { , }∪ I ∪ I | = n − k + | I | + | I | − | K | + 1 . Therefore, all of the inequalities in (18) must be equalities. Inparticular, the last equality forces ε = 0 and δ = 0 . As δ = 0 implies that (15) holds and ε = 0 implies that (16) holds, wecomplete the analysis of Case 2.In any cases, we always derive a contradiction. Therefore,our assumption that there exists some ℓ ∈ I ∩ I is wrong.Hence I ∩ I = ∅ . It follows immediately that I i ∩ I i ′ = ∅ for every i, i ′ ∈ [ t ] , i = i ′ .We are now in position to prove Lemma 8, which in turnimplies Theorem 6. Proof of Lemma 8:
Recall that we assume that { i ∈ [ k ] : m i,j max = 1 and m i,j min = 0 } = [ t ] . (20)Moreover, we suppose, for contradiction, that none of these t rows satisfy the second condition in Step 7 of Algorithm 1. Asshown by Lemma 9 c), d), e), and Lemma 10, we can associateto each i ∈ [ t ] a subset I i ⊂ [ k ] satisfying the following(S1) i / ∈ I i ′ , for all i, i ′ ∈ [ t ] ,(S2) j max / ∈ R I i , for all i ∈ [ t ] , (S3) j min ∈ R I i , for all i ∈ [ t ] ,(S4) I i ∩ I i ′ = ∅ , for all i, i ′ ∈ [ t ] , i = i ′ .Due to (S2) and (S3), for each i ∈ [ t ] , there exists a row r ( i ) ∈ I i that has a zero at column j max and a one at column j min .By (S1) and (S4), r ( i ) = i ′ for all i, i ′ ∈ [ t ] and r ( i ) = r ( i ′ ) whenever i = i ′ . row row row t row r (1) 0 1 row r (2) 0 1 row r ( t ) t rows t rows bbb bbbbbb bbb Along the rows in the set [ t ] ∪ { r ( i ) : i ∈ [ t ] } , the weightsof the two columns j max and j min are the same (equal to t ).The other rows of M , because of (20), must contribute atleast as much to the weight of column j min as to the weightof column j max . Therefore, in total, the weight of column j max is not larger than the weight of column j min of M . Thisconclusion contradicts the fact that max ≥ min +2 .We now discuss the complexity of Algorithm 1. In theinitial matrix f M , the difference between the maximum andthe minimum column weights is at most k − . Therefore,according to the proof of Lemma 7, the repeat loop finishesafter at most ( k − ⌊ n ⌋ iterations. It is obvious that allsteps in each iteration can be done in polynomial time in n and k , except for Step 7. It is not straightforward that theverification of (P3) for a given k × n matrix can be done inpolynomial time. However, it can be shown that by consideringa special one-source k -sink network (of linear size in k and n )associated with each matrix, (P3) is equivalent to the conditionthat in this network, the minimum capacity of a cut betweenthe source and any sink is at least n . On any network, thiscondition can be verified in polynomial time using the famousnetwork flow algorithm (see, for instance [6]). Therefore,Algorithm 1 runs in polynomial time in k and n . We omitthe proof due to lack of space. Interested reader can find theproof online at [5].IV. A CKNOWLEDGMENT
The first author thanks Yeow Meng Chee for informing himof the Gale-Ryser Theorem.R
EFERENCES[1] F. J. MacWilliams and N. J. A. Sloane,
The Theory of Error-CorrectingCodes . Amsterdam: North-Holland, 1977.[2] T. Ho, M. M´edard, R. Koetter, D. R. Karger, M. Effros, J. Shi, andB. Leong, “A random linear network coding approach to multicast,”
IEEE.Trans. Inform. Theory , vol. 52, no. 10, 4413–4430.[3] R. Motwani and P. Raghavan,
Randomized Algorithms . CambridgeUniversity Press, 1995.[4] K. Manfred, “A simple proof of the Gale-Ryser Theorem,”
The AmericanMathematical Monthly
Network Flows . EnglewoodCliffs, NJ: Prentice-Hall, 1993.. EnglewoodCliffs, NJ: Prentice-Hall, 1993.