OntheRedundancyofTwo-DimensionalBalancedCodesErikOrdentlich,RonM.Roth*ComputerSystemsLaboratoryHPL-97-143December,1997E-mail:eor@hpl.hp.comronny@cs.technion.ac.ilbalancedarrays,DC-freecodes,two-dimensionalcodingLetcn×mbethesetofbinaryn×marraysinwhicheachrow,andrespectivelyeachcolumn,hasthesamenumberof0'sand1's.Weprovethelowerboundlog2|cn×m|≥nm–1/2(nlog2(2m)+mlog2(2n)).WealsoshowthatthisboundistightuptoanadditivetermO(n+logm).*OnsabbaticalleavefromHPLaboratoriesIsrael,ComputerScienceDepartment,Technion,Haifa32000,Israel.WorksupportedinpartbygrantNo.95-00522fromtheUnited–States–IsraelBinationalSciencesFoundation(BSF),Jerusalem,Israel.©CopyrightHewlett-PackardCompany19971IntroductionInthiswork,weconsidertheenumerationproblemoftwo-dimensionalbalancedbinaryn marrays,inwhicheachrow,andrespectivelyeachcolumn,hasthesamenumberof0’sand1’s(nandmareeven).Byabinaryn-vectorwerefertoavectorinIRnwithentriesrestrictedtof0;1g.Abinaryn-vectorviscalledbalancedifnisevenandhalfoftheentriesofvare1’s.Muchisknownaboutcodesthatmapunconstrainedinputsequencestoone-dimensionalbalancedbinaryn-vectors.ThosecodesgoalsobythenamesDC-freeorzero-disparitycodes[10].Wedenotethesetofallbalancedbinaryn-vectorsbyAn;clearly,jAnj=nn=2!:TheratiojAnj=2n=2 n nn=2 willbedenotedby n.TheredundancyofasetC f0;1gnisde nedbyn log2jCj.TheredundancyofAn,denoted n,isgivenby n=n log2jAnj= log2 n:(1)Itisknownthat1p2n n 1q 2n(2)(see[5],[8,p.309]).Averye cientencodingalgorithmduetoKnuth[5]mapsunconstrainedbinarywordsintoAnwithredundancydlog2ne.SeealsoimprovementsbyAl-BassamandBose[1],andTallini,Capocelli,andBose[12].Lesshasbeenknownabouttheredundancyoftwo-dimensionalbalancedarrays.Byabinaryn marraywemeanann marraywhosecolumnsarebinaryn-vectors.Abinaryn marray iscalledbalancedifnandmarebothevenandeachoneoftherowsandcolumnsof isbalanced.WedenotebyAn mtheset(orthecode)ofallbalancedn marrays.TheredundancyofAn m,denoted n m,isgivenby n m=nm log2jAn mj:Ane cientcodingalgorithmintoasubsetofAn mispresentedin[11]thathasredundancynlog2m+mlog2n+O(n+mloglogn).Initssimplerversion,thealgorithmin[11]balancestherowsusingoneofthealgorithmsin[1],[5],or[12];bytradingthosealgorithmswiththe(morecomputationallycomplex)enumerativecodingofAm,theredundancycanbereducedto12(nlog2m)+mlog2n+O(n+mloglogn).InSection2weprovetheupperbound n m n m+m n 12 nlog2(2m)+mlog2(2n) ;1andinSection3weshowthatthisboundistightuptoanadditivetermO(n+logm).Thisboundimpliesthatrequiringbalancedrowsinabinaryarraydoesnot\interferewithrequiringbalancedcolumns.Note,however,thatthoserequirementsarenotindependent:forinstance,ifallnrowsinabinaryn marrayarebalanced,andm 1ofthecolumnsarebalancedaswell,thensomustbetheremainingcolumn.Thecomputationoftheredundancyoftwo-dimensionalbalancedarrayscanberelevanttothecodingapplicationthatweoutlinenext.Incurrently-availablemagneticandopticalmemorydevices,dataisrecordedalongtracks,thustreatingtherecordingdeviceasone-dimensional.Recentproposalsforthedesignofopticalstorage|inparticularholographicmemory|trytotakeadvantageofthefactthattherecordingdeviceistwo-dimensional(oreventhree-dimensional),therebyincreasingtherecordingdensity[4],[9].Thenewapproach,however,introducesnewtypesofconstraintsonthedata|thoseconstraintsnowbecomemulti-dimensionalinnature,ratherthanone-dimensional.Thespeci cconstraintstobeusedintherecentlysuggestedrecordingtechniquesareyettobecrystallized.Nevertheless,experimentsreportedonholographicmemory,andexperiencegatheredinotherexistingopticaldevices,suggestthat0’sand1’sintherecordeddataneedtobebalancedwithincertainareasorpatterns.ThesetAn mmayturnouttobeusefulforthatpurpose.2UpperboundontheredundancyofAn mInthissectionweprovethefollowingupperboundon n m.Proposition2.1Foreveryevenpositiveintegersnandm, n m n m+m n 12 nlog2(2m)+mlog2(2n) :Proposition2.1isadirectcorollaryofthefollowinglowerboundonthesizeofAn m,combinedwith(1)and(2).Proposition2.2Foreveryevenpositiveintegersnandm,jAn mj 2nm nm mn:Proposition2.2isaspecialcaseofLemma2.4whichwestateandprovebelow.Weintroducesomenotationsthatwillbeusedhereafterinthiswork.Let beabinaryn marray(notnecessarilybalanced).Therowtypeof isanintegern-vectorw=(w1;:::;wn)wherewiisthesumoftheentriesoftheithrowof .2Foranintegern-vectorw=(w1;:::;wn),de neRm(w)tobethesetofallbinaryn marrayswhoserowtypeisw.Clearly,jRm(w)j=nYi=1mwi!(wede ne mw =0ifw0orwm).Forevennandanintegern-vectorw,denotebyUm(w)thesetofallarraysinRm(w)whosecolumnsarebalanced.ForevenmwehaveAn m=Um((m=2) 1n),where1ndenotestheall-onevectorinIRn.Forarealvectory,wedenotebykyk=kyk1thesumoftheabsolutevaluesoftheentriesofyandbykyk1thelargestabsolutevalueofanyentryofy.Thesupportofywillbedenotedbysupp(y).Notethatwheny1andy2arebinarym-vectors,thenky1 y2kisthenumberofpositionsonwhichtheydi er.Thesetf1;2;:::;ngwillbedenotedbyhni.Lemma2.3LetX1;:::;XnbeindependentBernoullirandomvariablestakingonf0;1gwithprobabilitiesProbfXi=1g=pi,i2hni,andsupposethatPni=1pi=n=2.Then,ProbnnXi=1Xi=n=2o n;withequalityholdingifandonlyifpi=12foralli.Lemma2.3followsfromaresultduetoHoe ding[7].Forthesakeofcomp