Maximum permuted matrix of a matrix

advertisement
Maximum permuted of a matrix
Definition 1. A mn binary matrix is a matrix of m rows and n columns whose entries are
ones and zeros. We denote the set of binary mn matrices by Bmn.
Definition 2. Let A, BBmn. We define B is permuted of A (denoted BA) if there are a
permutation r on the set {1, ..., m} and a permutation c on the set {1,...,n}, such that an
entry bi j in row i, column j of B takes the value of entry in row r(i), column c(j) of A, where
1im and 1jn. We denote the set of permuted of A by Per(A).
Lemma 1. The relation  is an equivalence relation in the set Bmn.
Proof
Let A, B, C be any matrices in Bmn.
Reflexivity. AA:
The matrix A can be obtained by identity permutations of its rows and columns. Thus,
AA holds.
Symmetry. If BA, then AB:
Let BA. So, B is obtained by permuting rows (r) and columns (c) of A. Thus, A is
obtained from B taking the inverse permutations (r-1 and c-1). Therefore, AB holds.
Transitivity. If (BA and CB), then CA:
Since CB, C is obtained from B by permuting its rows (r) and columns (c). Since
BA, B is obtained from A by permuting its rows (´r) and columns (´c). Then, C can
be obtained from A by permuting rows and columns of A through composing (r´r) and
(c´c), respectively. Thus, CA holds. This completes the proof. 
Remark 1. Because of lemma 1, following properties are satisfied for every A, B, CBmn:
APer(A).
APer(B)  BPer(A).
BPer(A) , CPer(B)  CPer(A)
Definition 3. Let A, BBmn. We denote AB and say that A and B are equivalent by
permutation if BA or AB.
Theorem 1. The relation  is an equivalence relation in the set Bmn.
Proof
It is obvious from AB holds if and only if AB, since the symmetry of . 
Lemma 2. The following properties hold for every A, BBmn.
a) AB  Per(A) = Per(B)
b) Per(A)Per(B)   Per(A) = Per(B).
Proof
Both properties are satisfied since  is an equivalence relation in the set Bmn and
Per(A) is the equivalence class of a binary mn matrix A. Part a) tell us that equivalent
matrices are in the same equivalence class. Part b) tell us that different equivalence
classes are disjoint. 
Definition 4. We define the relation is previous to in the set {1,...,m}{1,...,n} of positions in
a mn binary matrix as follows:
1
Given row h, column k in ABmn, we denote (h, k)  (h´, k´) and say that position (h, k) is
previous to position (h´, k´) if k+(h-1)n  k´+(h´-1)n is satisfied.
Lemma 3. The relation  “is previous to” is a total order relation in the set of positions
{1,...,m}{1,...n} of a binary mn matrix.
Proof.
Let (h, k), (h´, k´), (h, k) be any positions in A.
Reflexivity. (h, k)  (h, k):
Since k+(h-1)n = k+(h-1)n, we have that (h, k)  (h, k).
Anti-symmetry. If (h, k)  (h´, k´) and (h´, k´)  (h, k), then (h, k) = (h´, k´):
If (h, k)  (h´, k´), then k+(h-1)n  k´+(h´-1)n.
If (h´, k´)  (h, k), then k´+(h´-1)n  k+(h-1)n.
Both inequalities imply that k+(h-1)n = k´+(h´+1)n. Then, k-k´ = n(h´-h). (1)
From 1kn and 1k´n, we have 1-nk-k´n-1 (2). Since k, h, k´, h´ are integers
satisfying expressions (1) and (2), then it must be h´-h=0 and k-k´=0, say (h, k)=(h´, k´).
Transitivity. If (h, k)  (h´, k´) and (h´, k´)  (h, k), then (h, k)  (h, k):
If (h, k)  (h´, k´), then k+(h-1)n  k´+(h´-1)n.
If (h´, k´)  (h, k), then k´+(h´-1)n  k+(h-1)n.
Both inequalities imply that k+(h-1)n  k+(h-1)n. Thus, (h, k)  (h, k).
Completeness. Either (h, k)  (h´, k´) or (h´, k´)  (h, k) or both:
By comparing the numbers k+(h-1)n and k´+(h´-1)n three cases arise:
1) k+(h-1)n < k´+(h´-1)n. Then we have that (h, k)  (h´, k´).
2) k´+(h´-1)n < k+(h-1)n. Then we have that (h´, k´)  (h, k).
3) k+(h-1)n = k´+(h´-1)n. Then both hold, (h, k)  (h´, k´) and (h´, k´)  (h, k).
This completes the proof. 
Remark 2. We denote (h, k) < (h´, k´) if (h, k)  (h´, k´) and (h, k)(h´, k´).
Definition 5. We define a relation > on Bmn as follows:
Given A, BBmn, we denote A>B if there are a position (h, k) such that ah k>bh k and ai j=bi j
for any position (i, j) such that (i, j) < (h, k).
Definition 6. We define a relation  on Bmn as follows:
Given A, BBmn , AB if either A>B or A=B.
Lemma 4. The relation is a total order in Bmn.
Proof
Let A, B, C be any matrices in Bmn.
Reflexivity. AA:
For any ABmn , A=A holds. Therefore, AA.
Anti-symmetry. If (AB and BA), then A=B:
From AB, either A=B or A>B. From BA, either A=B or B>A. We shall show that
A>B and B>A are contradictories. So, it should be A=B.
(a) If A>B, there are a position (h, k) such that ah k>bh k and ai j=bi j for any position (i, j)
< (h, k).
2
(b) If B>A, there are a position (h´, k´) such that bh´ k´>ah´ k´ and bi j=ai j for any position
(i, j) < (h´, k´).
If (a) and (b) hold, we shall prove that neither (h, k)  (h´, k´) nor (h´, k´)  (h, k). This
tell us that (a) and (b) contradict the fact that  is total order, therefore we conclude that
it should be A=B.
(1) First we shall prove that (a) and (b) hold, then (h, k)  (h´, k´). If (h, k) = (h´, k´),
from (a) it should be ah k>bh k and from (b) bh k>ah k , that are contradictory inequalities.
(2) We shall show that if (a) and (b) hold, (h, k) not is previous to (h´, k´):
If (h, k)  (h´, k´), then from (1) it follows that (h, k) < (h´, k´). Thus, from (a) it should
be ah k>bh k and setting (i, j) = (h, k) in (b), we have bh k = ah k, that are contradictory
relations.
(3) We shall prove that if (a) and (b) hold, then (h´, k´) not is previous to (h, k):
If (h´, k´)  (h, k), then from (1) it follows that (h´, k´) < (h, k). Thus, setting (i, j) = (h´,
k´) in (a) we have ah´ k´=bh´ k´ and from (b) bh´ k´>ah´ k´, that are contradictory relations.
Transitivity. (AB and BC) implies AC:
Let AB and BC:
Case 1. A>B and B>C.
(a) From A>B, there are a position (h, k), such that ah k>bh k, and ai j=bi j for any position
(i, j) < (h, k).
(b) From B>C, there are a position (h´, k´) such that bh´ k´>ch´ k´ and bi j=ci j for any
position (i, j) < (h´, k´).
If (h, k) < (h´, k´), from (a) it should be ah k>bh k and setting (i, j) = (h, k) in (b) we have
bh k=ch k . Moreover, for any (i, j) < (h, k), from (a) we have ai j=bi j and from (b) bi j=ci j
Thus, we have ah k>ch k and ai j=ci j for any position (i, j) < (h, k). So, A>C.
If (h´, k´) < (h, k), similarly, from both (a) and (b) we have ah´ k´=bh´ k´>ch´ k´ and ai j=bi j=ci
j for any (i, j) < (h´, k´). Thus, A>C.
If (h, k) = (h´, k´), then from (a) and setting (h´, k´) = (h, k) in (b) we have ah k>bh k>ch k
and ai j=bi j=ci j for any position (i, j) < (h, k). Therefore, A>C.
Case 2. If A>B and B=C, then it is obvious that A>C.
Case 3. If A=B and B>C, then it is obvious that A>C.
Case 4. If A=B and B=C, then it is obvious that A=C.
Therefore, if (AB and BC), then AC.
Completeness. Either AB or BA or both.
If A=B, then both AB and BA hold.
If AB, then there are a position (h, k) such that ah k  bh k, and ai j=bi j for any position (i,
j) < (h, k). Two cases there arise by comparing ah k  bh k:
(a) ah k>bh k : Then A>B, so AB .
(c) ah k<bh k : Then B>A, so BA.
This completes the proof. 
Definition 7. Given a set CBmn we call maximum matrix of C to the unique binary matrix
Max(C)Bmn such that Max(C) A, for every AC.
Definition 8. Given a matrix ABmn we define the maximum-permuted of A (denoted
Maxper(A) ), as the maximum matrix of the set Per(A). That is, Maxper(A)=Max(Per(A)).
Theorem 2. For every A,BBmn, the following are equivalent.
a) AB
b) Maxper(A)=Maxper(B)
Proof
3
a)  b)
Assume that AB.
 Per(A)=Per(B)
 Max(Per(A))=Max(Per(B))
 Maxper(A)=Maxper(B)
[Lemma 2.a]
[Definition 7]
[Definition 8]
a)  b)
Assume that Maxper(A)=Maxper(B).
 Max(Per(A))=Max(Per(B))
 Max(Per(A))Per(A)Per(B)
 Per(A)=Per(B)
 AB
[Definition 8]
[Definition 7]
[Lemma 2.b]
[Lemma 2.a]. 
Definition 9. For a mn binary matrix A, we define h-band, for 1hm, as follows:
We call h-band in ABmn to every sub-matrix that contains the successive columns of A
whose entries in rows 1,...,h don’t change. That is, columns p, q are columns in a h-band, if
and only if ai p=ai j for every 1ih, pjq.
Remark 3. There are a number bh of h-bands in a mn binary matrix, where 1<bhn. We call
first h-band to the leftmost h-band and we continue on this way ordering the h-bands until the
rightmost h-band will be the last h-band.
Example 1. There are two 1-bands in the following matrix A: first 1-band of columns 1 to 4,
whose entries in first row are 1, and second 1-band of columns 5 and 6, whose entries in first
row are 0.
There are four 2-bands: first 2-band with columns 1, 2, second 2-band with columns 3, 4,
third 2-band with column 5 and fourth 2-band with column 6.
Finally, there are six 3-bands: each one 3-band with each column of A.
 1 1 1 1 0 0


A   1 1 0 0 1 0


 1 0 1 0 0 1


first 1-band
1111
1100
1bands:
 1 1 1 1 0 0


 1 1 0 0 1 0


 1 0 1 0 0 1


2bands:
 1 1 1 1 0 0


 1 1 0 0 1 0


 1 0 1 0 0 1


3bands:
 1 1 1 1 0 0


 1 1 0 0 1 0


 1 0 1 0 0 1


second 1-band
00
10
4
1010
01
first 2-band
11
11
10
second 2-band
11
00
10
first 3-band
1
1
1
second 3-band
1
1
0
third 2-band
0
1
0
third 3-band
1
0
1
fourth 3-band
1
0
0
fourth 2-band
0
0
A=
1
=
fifth 3-band
0
1
0
sixth 3-band
0
0
1
Theorem 3.Properties of maximum-permuted of a matrix
Let ABmn be a binary matrix. The maximum-permuted of A, Maxper(A), whose entry in
row i, column j is denoted by gi j, whose row i is denoted by ri, satisfies the following
properties:
1. The rows are in descendent order: If 1h<km, then rhrk. That is, there is an integer t,
1tn, such that gh t>gk t and gh j=gk j for every 1j<t.
2.
3.
4.
5.
The number of ones in the first row is bigger than or equal to the number of ones in the
remaining rows of the matrix.
The first row is the form 1...10...0, that is, the position of each one in the first row is
previous to the position of any 0 in the first row.
Let h be any integer such that 1<hm. The number of ones in row h in the first (h-1)-band
is bigger than or equal to the number of ones in every row i in the same (h-1)-band, for
h<in.
Let h, i be integers such that 1<h<im, and suppose that rows h, i, have the same number
of ones in the first, second,...,(s-1)-th h-bands. Then, the number of ones in the s-th
h-band in row h is bigger than or equal to the number of ones in row i.
Let h be any integer such that 1<hn. The position of every 1 in row h in any (h-1)-band
is previous to the position of every 0 in the same row and band.
Proof
1. If rhrk, then rows h, k, can be interchanged, and a greater matrix than given matrix is
obtained. This contradicts definition 8 of Maxper(A).
6.
2. If row i has more ones than the first row, then rows 1, i can be interchanged, and, by
interchanging of columns, if necessary, the ones of the first row are brined before its
zeros. Thus, a greater matrix than given matrix is obtained. This contradicts definition 8
of Maxper(A).
3. If there is a zero before a one in the first row, say g1 h=0, g1 k=1, for h<k, columns h, k can
be interchanged and a greater matrix than given matrix will be obtained. This contradicts
definition 8 of Maxper(A).
4. If there are i>h such that the first (h-1)-band has more ones in row i that in row h, then
rows i, h can be interchanged. Then ones of new row h can be brined before its zeros, by
interchanging of columns, if necessary. Thus, a greater matrix than given matrix will be
obtained. This contradicts definition 8 of Maxper(A).
5
5. Assume that there are i>h such that a (h-1)-band has more ones in row i that in row h, and
the remaining (h-1)-bands on the left have the same ones in rows i, h. Then rows i, h can
be interchanged and ones of new row h can be brined before its zeros in every (h-1)-band,
by interchanging of columns in each band, if necessary. Since any entries in each
(h-1)-band on row kh-1 are equals, these entries do not change by interchanging two
columns that are in the same (h-1)-band. Thus, a greater matrix than given matrix will be
obtained. This contradicts definition 8 of Maxper(A).
6. Suppose that there is a zero before a one in row h, in a (h-1)-band. Let b1 be the first
column and let b2 be the last column of the (h-1)-band. Then there are integers p, q, such
that gh p=0, gh q=1, where b1p<qb2. Since columns p, q are in the same (h-1)-band, from
definition 9, gi p=gi q for every 1ih-1. On the other hand, gh p<gh q, thus, by interchanging
columns p, q we will obtain a greater matrix than given matrix. This contradicts definition
8 of Maxper(A). 
Lemma 5. Maxper(A) is not necessary the unique matrix in the set Per(A) that satisfies all of
properties of theorem 3.
Proof
For inspection, properties 1 to 6 of theorem 3 are satisfied by the following different
matrices A, B. Moreover, BA, through permutations r ={2,3,1,4} on rows and c
={1,2,5,6,4,3} on columns, that is, BPer(A). From remark 1, APer(A). Therefore,
there are more than one unique matrix in Per(A) that satisfy these properties.
A
B
111100
111100
110011
111000
110010
110011
100010
101000

Lemma 6. For any binary matrix ABmn, columns of Maxper(A) are in descendent order.
Proof
We denote the entry of Maxper(M) of position (i, j) by gi j, its column i by ci. Suppose
that there are p<q such that cqcp. Then there are s such that gs q>gs p and gi p=gi q for any
1i<s. Entries of positions (i, j) < (s, p) don’t change by interchanging columns p, q, thus
a greater matrix than Maxper(A) is obtained. This contradicts definition 8 of Maxper(A).

Definition 9. We define the subset GPer(A)  Per(A) as follows:
Let ABmn. We define B is a great-permuted of A (denoted AB) if BPer(A) and B
satisfies the properties 1 to 6 of theorem 3. We denote the set of great-permuted of A by
GPer(A).
Algorithm 1. Finding a great-permuted of a matrix.
Given a mn binary matrix A, we shall develop an algorithm for finding a great-permuted of
A, denoted by B.
Step 1. By replicating the matrix A, get Bo=A. Count the ones in each row of Bo. Then,
choose the first row whose number of ones is the maximum. Perform a row interchange, if
necessary, to bring the chosen row as row 1 in Bo.
Step 2. Perform a column interchange, if necessary, to bring all the ones of the first row in Bo
before its zeros. Call B1 the new matrix.
6
Step 3. Consider the 1-bands in the matrix B1. Count the ones in the first 1-band in each row
2,...,m. If there are some rows whose number of ones is the maximum, then find the number
of ones of these rows in the second 1-band. Select among them the first row whose number of
ones will be the maximum. Perform a row interchange, if necessary, to bring the chosen row
as second row of B1.
Step 4. By interchanging columns that are in the same 1-band, if necessary, bring the ones of
the row 2 before its zeros in each 1-band of B1. Denote by B2 the new matrix.
Step 5. In the Bs matrix, where s<m-1, count the ones of any row (s+1),...,m in the first sband, and, if there are some rows whose number of ones is the maximum, then count the ones
of these rows in the second s-band, and continuing in this way, if necessary, choose among
them the first row whose number of ones in the last s-band is the maximum. Perform a row
interchange, if necessary, to bring the chosen row as row s+1 of Bs.
Step 6. By interchanging columns that are in the same s-band, if necessary, bring the ones at
row s before its zeros in each s-band of Bs. Denote by Bs+1 the new matrix.
Step 7. Repeat steps 5 and 6 until either the number s of selected rows will be s=m-1, or the
number bs of s-bands in the matrix Bs will be bs=n.
Step 8. Perform a row interchange, if necessary, to put the rows of Bs in descendent order.
Denote by B the new matrix. End of algorithm.
Treorem 3. For any binary matrix ABmn , there are a matrix M such that AM and MA.
Proof
We shall construe a matrix M such that MA, AM by mean of algorithm 1. Some
cases there arise by verifying theorem 3 for A:
Case 1. Properties 1 to 6 of theorem 3 hold. Setting M=A, we have MA and AM.
Consider now that A don’t satisfies theorem 3:
Case 2. Property 1 falls. By ordering rows, then we obtain a matrix A´>A. We need only
show A´M and MA´. To do it, verify theorem 3 for A´ as before on A.
Case 3. Property 1 holds and property 2 falls. Then the first row in A has fewer ones than
some of the remaining rows in A, and step 1 and following of algorithm 1 allows us to
construe a matrix M such that M>A and AM.
Case 4. Properties 1 and 2 hold and property 3 falls. By replicating A, let Mo=A. From
property 3 falls, there is a zero before a one in the first row of Mo. Then, step 2 and
following of algorithm 1 allow us to construe a matrix M such that M>Mo=A and
A=MoM.
Case 5. Properties 1 to 3 hold and property 4 falls. From property 4 falls, there is an
integer h such that property 4 holds for rows i<h. By replicating A, let Mh-1=A. There
must be some rows i>h whose number of ones in the first (h-1)-band of Mh-1 is bigger
than row h. Let k>h be a row whose number of ones in the first (h-1)-band is the
maximum. By interchanging rows k, h of Mh-1, then applying steps 6 and following of
algorithm 1, we construe M such that M>Mh-1=A and A=Mh-1M.
Case 6. Properties 1 to 4 hold and property 5 falls. There is an integer h such that
property 5 holds for every row i<h. By replicating A, let Mh-1=A. There is an integer s
such that property 5 holds for bands 1,...,s-1. Then there must be some rows i>h whose
number of ones in the first 1,...,(s-1)-th (h-1)-bands are equal to row h, and whose
number of ones in the s-th (h-1)-band is bigger than row h. Let k>h a row with the
maximum number of ones in the s-th (h-1)-band. By interchanging rows k, h in Mh-1,
then applying steps 6 and following of algorithm 1, we can construe M such that M>Mh1
=A and A=Mh-1M.
7
Case 7. Properties 1 to 5 hold and property 6 falls. There is an integer h such that
property 5 holds for every row i<h. By replicating A, let Mh=A. There is an integer s
such that property 6 falls for the s-th (h-1)-band. Then, there must be a zero before a one
in the s-th (h-1)-band. By interchanging its respective columns in Mh, every row i<h
don’t change and new row h is bigger than given row h. Then, by applying steps 7 and 8
of algorithm 1, we can construe M such that M> Mh=A and A=MhM. 
Theorem 4. The maximum-permuted of a binary matrix A, is the unique matrix G that is the
maximum of the set GPer(A). That is, Max(GPer(A)) = Maxper(A).
Proof
Assume that G is the maximum of the set GPer(A). We must show that G is the
maximum of the set Per(A), that is, GB, for any matrix BPer(A).
Let BPer(A). From proof of theorem 3 process, we can construct a matrix M such that
MB and BM. This implies AM, that is MGPer(A) and, from hypothesis for G,
then GM. From transitivity of , we have GB. Therefore G is the maximum of
Per(A), or G=Max(GPer(A))=Maxper(A). 
Algorithm 2. Finding the set GPer(A).
Given a binary matrix ABmn , we shall develop an algorithm for finding any greatpermuted of A, by doing some changes on algorithm 1. We denote the ng obtained matrices by
Bi, where 1ingm!n!
1) In step 1 of algorithm 1, select all of rows i=1,...,no with the maximum. If no>1, replicate
the matrix Bo to obtain Boi for i=1,...,no. Repeat the following steps of algorithm 1 for any Boi
matrix.
2) In step 3 of algorithm 1 on B1i, select all of rows h=1,...,n1 with the maximum number of
ones in the last 1-band. If n1>1, replicate the matrix B1i to obtain B1ih for h=1,...,n1. Repeat the
following steps of algorithm 1 for any B1ih matrix.
3) In step 5 on Bsi, select all of rows h=1,...,ns with the maximum. If ns>1, replicate the matrix
Bsi to obtain Bsih for h=1,...,ns . Repeat the following steps of algorithm 1 for any Msih matrix.
4) In step 8, denote by Bi the new matrix. Add 1 to i. End of algorithm.
Theorem 5. Let A be a binary matrix ABmn . By applying algorithm 2 on A provides the set
GPer(A).
Proof
First of all, we see that the number ng of great-permuted of A is finite, because of
ng<m!n!. From theorem 3, by applying algorithm 1 on A, provides a great-permuted of
A. By applying algorithm 2 provides a great-permuted of A for each chosen row in steps
1, 3 and 5 of algorithm 1, modified as algorithm 2 tell us. Every row that verifies
properties 1 to 6 of theorem 3 is chosen. So, every great-permuted of A is construed. 
Algorithm 3. Finding the maximum-permuted of a matrix.
Given a binary matrix ABmn , we shall develop an algorithm for finding the maximumpermuted of A, say Maxper(A).
Step 1. Obtain the ng great-permuted of A, by applying algorithm 2 on A. Denote by Bk the kth great-permuted matrix of A, where 1kngm!n!.
Step 2. Compare all the matrices Bk. To do it, set G=B1 the first great-permuted of A given by
algorithm 2. Setting k=2, denote the entries of BkGPer(A) by bi j. Setting i=1, j=1, compare
gi j, bi j :
Case 1. gij=bij, then:
8
a) If j<n add 1 to j, and repeat the comparing.
b) If j=n and i<m add 1 to i, and repeat the comparing.
c) If j=n and i=m go to step 3.
Case 2. gij>bij , then go to step 3.
Case 3. gij<bij then set G=Bk.
Step 3. If k<ng, add 1 to k. Repeat steps 1 and 2. If k=ng, then G=Maxper(A).
End of algorithm.
Theorem 6. Let A be a binary matrix ABmn . By applying algorithm 3 on A provides the
maximum-permuted of the matrix A, say Maxper(A).
Proof
The first step of algorithm 3 consists in applying algorithm 2 on A. From theorem 5, we
will have the set GPer(A). The second an third steps of algorithm 3 consists in
comparing the matrices of GPer(A) and select the greatest among them, that is, the
maximum of GPer(A). The maximum matrix of this set, from theorem 4, is the matrix
Maxper(A). 
Per(A)
GPer(A)
Maxper(A)
Bmn
9
Download