M is nice if it is possible to make it all + by a set of operation, each consisting of changing the sign of one row or the sign of one column.Making a biased coin flip fairChessboard problem in IMO2014Count Shared CustomersExtremely difficult puzzle - related to algorithmsHow many distinct Unruly boards are there?Finding neighbours of a certain cell using modular arithmeticMy Simple Combinatorial Method to Enumerate All Sudoku Solution GridsFinding a combinatorial formula for the following sequence of tablesFilling a modified sudoku/latin squareGCD Euclid's algorithm as solution to the 2-buckets water puzzle

Strong empirical falsification of quantum mechanics based on vacuum energy density

It grows, but water kills it

Should I outline or discovery write my stories?

Is there a working SACD iso player for Ubuntu?

What if a revenant (monster) gains fire resistance?

What should you do when eye contact makes your subordinate uncomfortable?

How can Trident be so inexpensive? Will it orbit Triton or just do a (slow) flyby?

The IT department bottlenecks progress. How should I handle this?

Where does the bonus feat in the cleric starting package come from?

Should I stop contributing to retirement accounts?

Create all possible words using a set or letters

Longest common substring in linear time

How to explain what's wrong with this application of the chain rule?

Approximating irrational number to rational number

Why do compilers behave differently when static_cast(ing) a function to void*?

What does chmod -u do?

"Spoil" vs "Ruin"

Biological Blimps: Propulsion

Non-trope happy ending?

Store Credit Card Information in Password Manager?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

The screen of my macbook suddenly broken down how can I do to recover

250 Floor Tower

Why does the Sun have different day lengths, but not the gas giants?



M is nice if it is possible to make it all + by a set of operation, each consisting of changing the sign of one row or the sign of one column.


Making a biased coin flip fairChessboard problem in IMO2014Count Shared CustomersExtremely difficult puzzle - related to algorithmsHow many distinct Unruly boards are there?Finding neighbours of a certain cell using modular arithmeticMy Simple Combinatorial Method to Enumerate All Sudoku Solution GridsFinding a combinatorial formula for the following sequence of tablesFilling a modified sudoku/latin squareGCD Euclid's algorithm as solution to the 2-buckets water puzzle













0












$begingroup$


Let $M$ be an $ntimes n$ matrix whose entries are $+$ and $-$.
Call $M$ nice if it is possible
to make it all $+$ by a set of operation, each consisting of changing the sign of one
row or the sign of one column.



Design a simple and efficient algorithm for deciding
whether the given M is nice.



For starts, I think that the the number of $+$ must be a multiple of $n$ (i.e: $ 0, n, 2n,...,n*n $). But i am not sure how to prove/continue, I would be happy for some help.










share|cite|improve this question









$endgroup$











  • $begingroup$
    What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
    $endgroup$
    – saulspatz
    Mar 15 at 18:07











  • $begingroup$
    you are right :/ Thanks
    $endgroup$
    – yyyyt
    Mar 15 at 19:35











  • $begingroup$
    By the way: There is no need to restrict this niceness property to quadratic matrices.
    $endgroup$
    – Wolfgang Kais
    Mar 16 at 8:02















0












$begingroup$


Let $M$ be an $ntimes n$ matrix whose entries are $+$ and $-$.
Call $M$ nice if it is possible
to make it all $+$ by a set of operation, each consisting of changing the sign of one
row or the sign of one column.



Design a simple and efficient algorithm for deciding
whether the given M is nice.



For starts, I think that the the number of $+$ must be a multiple of $n$ (i.e: $ 0, n, 2n,...,n*n $). But i am not sure how to prove/continue, I would be happy for some help.










share|cite|improve this question









$endgroup$











  • $begingroup$
    What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
    $endgroup$
    – saulspatz
    Mar 15 at 18:07











  • $begingroup$
    you are right :/ Thanks
    $endgroup$
    – yyyyt
    Mar 15 at 19:35











  • $begingroup$
    By the way: There is no need to restrict this niceness property to quadratic matrices.
    $endgroup$
    – Wolfgang Kais
    Mar 16 at 8:02













0












0








0





$begingroup$


Let $M$ be an $ntimes n$ matrix whose entries are $+$ and $-$.
Call $M$ nice if it is possible
to make it all $+$ by a set of operation, each consisting of changing the sign of one
row or the sign of one column.



Design a simple and efficient algorithm for deciding
whether the given M is nice.



For starts, I think that the the number of $+$ must be a multiple of $n$ (i.e: $ 0, n, 2n,...,n*n $). But i am not sure how to prove/continue, I would be happy for some help.










share|cite|improve this question









$endgroup$




Let $M$ be an $ntimes n$ matrix whose entries are $+$ and $-$.
Call $M$ nice if it is possible
to make it all $+$ by a set of operation, each consisting of changing the sign of one
row or the sign of one column.



Design a simple and efficient algorithm for deciding
whether the given M is nice.



For starts, I think that the the number of $+$ must be a multiple of $n$ (i.e: $ 0, n, 2n,...,n*n $). But i am not sure how to prove/continue, I would be happy for some help.







puzzle






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Mar 15 at 17:57









yyyytyyyyt

31




31











  • $begingroup$
    What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
    $endgroup$
    – saulspatz
    Mar 15 at 18:07











  • $begingroup$
    you are right :/ Thanks
    $endgroup$
    – yyyyt
    Mar 15 at 19:35











  • $begingroup$
    By the way: There is no need to restrict this niceness property to quadratic matrices.
    $endgroup$
    – Wolfgang Kais
    Mar 16 at 8:02
















  • $begingroup$
    What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
    $endgroup$
    – saulspatz
    Mar 15 at 18:07











  • $begingroup$
    you are right :/ Thanks
    $endgroup$
    – yyyyt
    Mar 15 at 19:35











  • $begingroup$
    By the way: There is no need to restrict this niceness property to quadratic matrices.
    $endgroup$
    – Wolfgang Kais
    Mar 16 at 8:02















$begingroup$
What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
$endgroup$
– saulspatz
Mar 15 at 18:07





$begingroup$
What about $$beginbmatrix&+&+&-\&-&-&+\&-&-&+endbmatrix$$ This is a nice $3times3$ matrix with $4$ plus sings. (Start by flipping the first row.)
$endgroup$
– saulspatz
Mar 15 at 18:07













$begingroup$
you are right :/ Thanks
$endgroup$
– yyyyt
Mar 15 at 19:35





$begingroup$
you are right :/ Thanks
$endgroup$
– yyyyt
Mar 15 at 19:35













$begingroup$
By the way: There is no need to restrict this niceness property to quadratic matrices.
$endgroup$
– Wolfgang Kais
Mar 16 at 8:02




$begingroup$
By the way: There is no need to restrict this niceness property to quadratic matrices.
$endgroup$
– Wolfgang Kais
Mar 16 at 8:02










3 Answers
3






active

oldest

votes


















0












$begingroup$


A matrix is nice iff every row is equal or opposite to the first row.




Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.



Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.



Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    Very elegant !!
    $endgroup$
    – yyyyt
    Mar 19 at 13:56


















0












$begingroup$

Here are some hints to get you started.



A particular element changes sign if and only if the number of times its row is flipped, plus the number of times its column is odd. The order of the flips doesn't matter. Also, we see that there is no point in flipping a line more than once; flipping it twice is the same as not flipping it. So, we can assume each line is flipped at most once.



If two elements in the same column of a nice matrix have the same sign, then in changing to a matrix of all plus signs, their rows must be flipped the same number of number of times.






share|cite|improve this answer









$endgroup$




















    0












    $begingroup$

    Clearly, all (both) possible $1times 1$ matrices are nice. For $2times 2$ matices, we find that they are nice if and only if the number of entries that are $-$ is even. For larger matices, we see that if it is nice, then also every quadratic sub-matrix that can be obtained by removing rows and columns is (and must be) nice. If we want the check the niceness of a $ntimes n$ matrix this way, we see that for $n>2$, we must only check the $(n-1)^2$ $2times 2$ sub-matices in adjacent rows and columns. This might sound much, but the complexity is only $mathcalO(n^2)$, so it's barely different than checking all entries of the matrix.



    As @saulspatz already noted, there is no need to change a row or column more than once. To find a set of operations that turns a nice matrix into the "all $+$-matrix" (containing only $+$-entries), we can do the following: Find an initial $-$-entry and chose to "flip" its column as the initial element of our set of operations (we could also flip the row, which we will see later). Flipping this column, there might have been $+$-elements that are now $-$, so we must add the flippings of the corresponding rows to our set. After applying these operations, the initial column has turned to "all $+$". We won't change these entries again, because that would require an unneccessary operation to change it back. The row of the initial element (which we dont't flip) also might contain $-$-entries that need to be changed, so we must add the flippings of the corresponding columns to our set of operations. Now, after applying these operations, also the row of our initial element has become "all $+$". Any additional operation would affect either the row or the column of our initial element and thus would require an unneccessary operation to change it back, so our set of operations is complete and will turn the nice matrix into the "all $+$ matrix".



    The order in that we apply the operations doesn't matter, each operation is inverse to itself and flipping all rows and all columns will change every entry of the matrix twice, so applying all possible flippings, the matrix will be returned to its original state. There are only $2n$ possible operations, and if we have a set of $k$ operations, the complementary set of $2n-k$ operations will have the same resulting matrix. This means, that we will need at most $n$ operations to make a nice $ntimes n$ matrix the "all $+$-matrix" (and flipping the row of our initial element instead of ots column could be more efficient).



    At last: How many of the $2^n^2$ possible $ntimes n$ matices are nice? To count them, we can count the different resulting matrices when appling a possible set of flippings to the "all $+$-matrix". As we have seen, for each of the $2^2n$ possible sets of operations, the complementary set will have the same resulting matrix. Except for these duplicates, the results will all be different, so there are $2^2n-1$ nice $ntimes n$ matrices.



    Thanks for this nice question. :-)






    share|cite|improve this answer









    $endgroup$












      Your Answer





      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "69"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3149610%2fm-is-nice-if-it-is-possible-to-make-it-all-by-a-set-of-operation-each-consist%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0












      $begingroup$


      A matrix is nice iff every row is equal or opposite to the first row.




      Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.



      Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.



      Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.






      share|cite|improve this answer









      $endgroup$












      • $begingroup$
        Very elegant !!
        $endgroup$
        – yyyyt
        Mar 19 at 13:56















      0












      $begingroup$


      A matrix is nice iff every row is equal or opposite to the first row.




      Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.



      Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.



      Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.






      share|cite|improve this answer









      $endgroup$












      • $begingroup$
        Very elegant !!
        $endgroup$
        – yyyyt
        Mar 19 at 13:56













      0












      0








      0





      $begingroup$


      A matrix is nice iff every row is equal or opposite to the first row.




      Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.



      Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.



      Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.






      share|cite|improve this answer









      $endgroup$




      A matrix is nice iff every row is equal or opposite to the first row.




      Therefore, a simple algorithm is to check if each row is equal or opposite to the first row.



      Proof: Suppose every row is either equal or opposite to the first row. Flip all rows which are opposite the first row, so now all rows are the same. Then, flip all negative columns.



      Suppose $M$ is nice. Then there is a sequence of flips starting from the matrix $P$ whose entries are all $+$ and ending at $M$. Note $P$ has the property that every row is equal or opposite the first. Furthermore, flipping any row or column preserves this property. Therefore, $M$ has the property as well.







      share|cite|improve this answer












      share|cite|improve this answer



      share|cite|improve this answer










      answered Mar 16 at 22:56









      Mike EarnestMike Earnest

      25.6k22151




      25.6k22151











      • $begingroup$
        Very elegant !!
        $endgroup$
        – yyyyt
        Mar 19 at 13:56
















      • $begingroup$
        Very elegant !!
        $endgroup$
        – yyyyt
        Mar 19 at 13:56















      $begingroup$
      Very elegant !!
      $endgroup$
      – yyyyt
      Mar 19 at 13:56




      $begingroup$
      Very elegant !!
      $endgroup$
      – yyyyt
      Mar 19 at 13:56











      0












      $begingroup$

      Here are some hints to get you started.



      A particular element changes sign if and only if the number of times its row is flipped, plus the number of times its column is odd. The order of the flips doesn't matter. Also, we see that there is no point in flipping a line more than once; flipping it twice is the same as not flipping it. So, we can assume each line is flipped at most once.



      If two elements in the same column of a nice matrix have the same sign, then in changing to a matrix of all plus signs, their rows must be flipped the same number of number of times.






      share|cite|improve this answer









      $endgroup$

















        0












        $begingroup$

        Here are some hints to get you started.



        A particular element changes sign if and only if the number of times its row is flipped, plus the number of times its column is odd. The order of the flips doesn't matter. Also, we see that there is no point in flipping a line more than once; flipping it twice is the same as not flipping it. So, we can assume each line is flipped at most once.



        If two elements in the same column of a nice matrix have the same sign, then in changing to a matrix of all plus signs, their rows must be flipped the same number of number of times.






        share|cite|improve this answer









        $endgroup$















          0












          0








          0





          $begingroup$

          Here are some hints to get you started.



          A particular element changes sign if and only if the number of times its row is flipped, plus the number of times its column is odd. The order of the flips doesn't matter. Also, we see that there is no point in flipping a line more than once; flipping it twice is the same as not flipping it. So, we can assume each line is flipped at most once.



          If two elements in the same column of a nice matrix have the same sign, then in changing to a matrix of all plus signs, their rows must be flipped the same number of number of times.






          share|cite|improve this answer









          $endgroup$



          Here are some hints to get you started.



          A particular element changes sign if and only if the number of times its row is flipped, plus the number of times its column is odd. The order of the flips doesn't matter. Also, we see that there is no point in flipping a line more than once; flipping it twice is the same as not flipping it. So, we can assume each line is flipped at most once.



          If two elements in the same column of a nice matrix have the same sign, then in changing to a matrix of all plus signs, their rows must be flipped the same number of number of times.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Mar 15 at 18:30









          saulspatzsaulspatz

          17.1k31435




          17.1k31435





















              0












              $begingroup$

              Clearly, all (both) possible $1times 1$ matrices are nice. For $2times 2$ matices, we find that they are nice if and only if the number of entries that are $-$ is even. For larger matices, we see that if it is nice, then also every quadratic sub-matrix that can be obtained by removing rows and columns is (and must be) nice. If we want the check the niceness of a $ntimes n$ matrix this way, we see that for $n>2$, we must only check the $(n-1)^2$ $2times 2$ sub-matices in adjacent rows and columns. This might sound much, but the complexity is only $mathcalO(n^2)$, so it's barely different than checking all entries of the matrix.



              As @saulspatz already noted, there is no need to change a row or column more than once. To find a set of operations that turns a nice matrix into the "all $+$-matrix" (containing only $+$-entries), we can do the following: Find an initial $-$-entry and chose to "flip" its column as the initial element of our set of operations (we could also flip the row, which we will see later). Flipping this column, there might have been $+$-elements that are now $-$, so we must add the flippings of the corresponding rows to our set. After applying these operations, the initial column has turned to "all $+$". We won't change these entries again, because that would require an unneccessary operation to change it back. The row of the initial element (which we dont't flip) also might contain $-$-entries that need to be changed, so we must add the flippings of the corresponding columns to our set of operations. Now, after applying these operations, also the row of our initial element has become "all $+$". Any additional operation would affect either the row or the column of our initial element and thus would require an unneccessary operation to change it back, so our set of operations is complete and will turn the nice matrix into the "all $+$ matrix".



              The order in that we apply the operations doesn't matter, each operation is inverse to itself and flipping all rows and all columns will change every entry of the matrix twice, so applying all possible flippings, the matrix will be returned to its original state. There are only $2n$ possible operations, and if we have a set of $k$ operations, the complementary set of $2n-k$ operations will have the same resulting matrix. This means, that we will need at most $n$ operations to make a nice $ntimes n$ matrix the "all $+$-matrix" (and flipping the row of our initial element instead of ots column could be more efficient).



              At last: How many of the $2^n^2$ possible $ntimes n$ matices are nice? To count them, we can count the different resulting matrices when appling a possible set of flippings to the "all $+$-matrix". As we have seen, for each of the $2^2n$ possible sets of operations, the complementary set will have the same resulting matrix. Except for these duplicates, the results will all be different, so there are $2^2n-1$ nice $ntimes n$ matrices.



              Thanks for this nice question. :-)






              share|cite|improve this answer









              $endgroup$

















                0












                $begingroup$

                Clearly, all (both) possible $1times 1$ matrices are nice. For $2times 2$ matices, we find that they are nice if and only if the number of entries that are $-$ is even. For larger matices, we see that if it is nice, then also every quadratic sub-matrix that can be obtained by removing rows and columns is (and must be) nice. If we want the check the niceness of a $ntimes n$ matrix this way, we see that for $n>2$, we must only check the $(n-1)^2$ $2times 2$ sub-matices in adjacent rows and columns. This might sound much, but the complexity is only $mathcalO(n^2)$, so it's barely different than checking all entries of the matrix.



                As @saulspatz already noted, there is no need to change a row or column more than once. To find a set of operations that turns a nice matrix into the "all $+$-matrix" (containing only $+$-entries), we can do the following: Find an initial $-$-entry and chose to "flip" its column as the initial element of our set of operations (we could also flip the row, which we will see later). Flipping this column, there might have been $+$-elements that are now $-$, so we must add the flippings of the corresponding rows to our set. After applying these operations, the initial column has turned to "all $+$". We won't change these entries again, because that would require an unneccessary operation to change it back. The row of the initial element (which we dont't flip) also might contain $-$-entries that need to be changed, so we must add the flippings of the corresponding columns to our set of operations. Now, after applying these operations, also the row of our initial element has become "all $+$". Any additional operation would affect either the row or the column of our initial element and thus would require an unneccessary operation to change it back, so our set of operations is complete and will turn the nice matrix into the "all $+$ matrix".



                The order in that we apply the operations doesn't matter, each operation is inverse to itself and flipping all rows and all columns will change every entry of the matrix twice, so applying all possible flippings, the matrix will be returned to its original state. There are only $2n$ possible operations, and if we have a set of $k$ operations, the complementary set of $2n-k$ operations will have the same resulting matrix. This means, that we will need at most $n$ operations to make a nice $ntimes n$ matrix the "all $+$-matrix" (and flipping the row of our initial element instead of ots column could be more efficient).



                At last: How many of the $2^n^2$ possible $ntimes n$ matices are nice? To count them, we can count the different resulting matrices when appling a possible set of flippings to the "all $+$-matrix". As we have seen, for each of the $2^2n$ possible sets of operations, the complementary set will have the same resulting matrix. Except for these duplicates, the results will all be different, so there are $2^2n-1$ nice $ntimes n$ matrices.



                Thanks for this nice question. :-)






                share|cite|improve this answer









                $endgroup$















                  0












                  0








                  0





                  $begingroup$

                  Clearly, all (both) possible $1times 1$ matrices are nice. For $2times 2$ matices, we find that they are nice if and only if the number of entries that are $-$ is even. For larger matices, we see that if it is nice, then also every quadratic sub-matrix that can be obtained by removing rows and columns is (and must be) nice. If we want the check the niceness of a $ntimes n$ matrix this way, we see that for $n>2$, we must only check the $(n-1)^2$ $2times 2$ sub-matices in adjacent rows and columns. This might sound much, but the complexity is only $mathcalO(n^2)$, so it's barely different than checking all entries of the matrix.



                  As @saulspatz already noted, there is no need to change a row or column more than once. To find a set of operations that turns a nice matrix into the "all $+$-matrix" (containing only $+$-entries), we can do the following: Find an initial $-$-entry and chose to "flip" its column as the initial element of our set of operations (we could also flip the row, which we will see later). Flipping this column, there might have been $+$-elements that are now $-$, so we must add the flippings of the corresponding rows to our set. After applying these operations, the initial column has turned to "all $+$". We won't change these entries again, because that would require an unneccessary operation to change it back. The row of the initial element (which we dont't flip) also might contain $-$-entries that need to be changed, so we must add the flippings of the corresponding columns to our set of operations. Now, after applying these operations, also the row of our initial element has become "all $+$". Any additional operation would affect either the row or the column of our initial element and thus would require an unneccessary operation to change it back, so our set of operations is complete and will turn the nice matrix into the "all $+$ matrix".



                  The order in that we apply the operations doesn't matter, each operation is inverse to itself and flipping all rows and all columns will change every entry of the matrix twice, so applying all possible flippings, the matrix will be returned to its original state. There are only $2n$ possible operations, and if we have a set of $k$ operations, the complementary set of $2n-k$ operations will have the same resulting matrix. This means, that we will need at most $n$ operations to make a nice $ntimes n$ matrix the "all $+$-matrix" (and flipping the row of our initial element instead of ots column could be more efficient).



                  At last: How many of the $2^n^2$ possible $ntimes n$ matices are nice? To count them, we can count the different resulting matrices when appling a possible set of flippings to the "all $+$-matrix". As we have seen, for each of the $2^2n$ possible sets of operations, the complementary set will have the same resulting matrix. Except for these duplicates, the results will all be different, so there are $2^2n-1$ nice $ntimes n$ matrices.



                  Thanks for this nice question. :-)






                  share|cite|improve this answer









                  $endgroup$



                  Clearly, all (both) possible $1times 1$ matrices are nice. For $2times 2$ matices, we find that they are nice if and only if the number of entries that are $-$ is even. For larger matices, we see that if it is nice, then also every quadratic sub-matrix that can be obtained by removing rows and columns is (and must be) nice. If we want the check the niceness of a $ntimes n$ matrix this way, we see that for $n>2$, we must only check the $(n-1)^2$ $2times 2$ sub-matices in adjacent rows and columns. This might sound much, but the complexity is only $mathcalO(n^2)$, so it's barely different than checking all entries of the matrix.



                  As @saulspatz already noted, there is no need to change a row or column more than once. To find a set of operations that turns a nice matrix into the "all $+$-matrix" (containing only $+$-entries), we can do the following: Find an initial $-$-entry and chose to "flip" its column as the initial element of our set of operations (we could also flip the row, which we will see later). Flipping this column, there might have been $+$-elements that are now $-$, so we must add the flippings of the corresponding rows to our set. After applying these operations, the initial column has turned to "all $+$". We won't change these entries again, because that would require an unneccessary operation to change it back. The row of the initial element (which we dont't flip) also might contain $-$-entries that need to be changed, so we must add the flippings of the corresponding columns to our set of operations. Now, after applying these operations, also the row of our initial element has become "all $+$". Any additional operation would affect either the row or the column of our initial element and thus would require an unneccessary operation to change it back, so our set of operations is complete and will turn the nice matrix into the "all $+$ matrix".



                  The order in that we apply the operations doesn't matter, each operation is inverse to itself and flipping all rows and all columns will change every entry of the matrix twice, so applying all possible flippings, the matrix will be returned to its original state. There are only $2n$ possible operations, and if we have a set of $k$ operations, the complementary set of $2n-k$ operations will have the same resulting matrix. This means, that we will need at most $n$ operations to make a nice $ntimes n$ matrix the "all $+$-matrix" (and flipping the row of our initial element instead of ots column could be more efficient).



                  At last: How many of the $2^n^2$ possible $ntimes n$ matices are nice? To count them, we can count the different resulting matrices when appling a possible set of flippings to the "all $+$-matrix". As we have seen, for each of the $2^2n$ possible sets of operations, the complementary set will have the same resulting matrix. Except for these duplicates, the results will all be different, so there are $2^2n-1$ nice $ntimes n$ matrices.



                  Thanks for this nice question. :-)







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Mar 16 at 7:54









                  Wolfgang KaisWolfgang Kais

                  8165




                  8165



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3149610%2fm-is-nice-if-it-is-possible-to-make-it-all-by-a-set-of-operation-each-consist%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Solar Wings Breeze Design and development Specifications (Breeze) References Navigation menu1368-485X"Hang glider: Breeze (Solar Wings)"e

                      Kathakali Contents Etymology and nomenclature History Repertoire Songs and musical instruments Traditional plays Styles: Sampradayam Training centers and awards Relationship to other dance forms See also Notes References External links Navigation menueThe Illustrated Encyclopedia of Hinduism: A-MSouth Asian Folklore: An EncyclopediaRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to Play10.1353/atj.2005.0004The Illustrated Encyclopedia of Hinduism: A-MEncyclopedia of HinduismKathakali Dance-drama: Where Gods and Demons Come to PlaySonic Liturgy: Ritual and Music in Hindu Tradition"The Mirror of Gesture"Kathakali Dance-drama: Where Gods and Demons Come to Play"Kathakali"Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceMedieval Indian Literature: An AnthologyThe Oxford Companion to Indian TheatreSouth Asian Folklore: An Encyclopedia : Afghanistan, Bangladesh, India, Nepal, Pakistan, Sri LankaThe Rise of Performance Studies: Rethinking Richard Schechner's Broad SpectrumIndian Theatre: Traditions of PerformanceModern Asian Theatre and Performance 1900-2000Critical Theory and PerformanceBetween Theater and AnthropologyKathakali603847011Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceBetween Theater and AnthropologyBetween Theater and AnthropologyNambeesan Smaraka AwardsArchivedThe Cambridge Guide to TheatreRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeThe Garland Encyclopedia of World Music: South Asia : the Indian subcontinentThe Ethos of Noh: Actors and Their Art10.2307/1145740By Means of Performance: Intercultural Studies of Theatre and Ritual10.1017/s204912550000100xReconceiving the Renaissance: A Critical ReaderPerformance TheoryListening to Theatre: The Aural Dimension of Beijing Opera10.2307/1146013Kathakali: The Art of the Non-WorldlyOn KathakaliKathakali, the dance theatreThe Kathakali Complex: Performance & StructureKathakali Dance-Drama: Where Gods and Demons Come to Play10.1093/obo/9780195399318-0071Drama and Ritual of Early Hinduism"In the Shadow of Hollywood Orientalism: Authentic East Indian Dancing"10.1080/08949460490274013Sanskrit Play Production in Ancient IndiaIndian Music: History and StructureBharata, the Nāṭyaśāstra233639306Table of Contents2238067286469807Dance In Indian Painting10.2307/32047833204783Kathakali Dance-Theatre: A Visual Narrative of Sacred Indian MimeIndian Classical Dance: The Renaissance and BeyondKathakali: an indigenous art-form of Keralaeee

                      Method to test if a number is a perfect power? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Detecting perfect squares faster than by extracting square rooteffective way to get the integer sequence A181392 from oeisA rarely mentioned fact about perfect powersHow many numbers such $n$ are there that $n<100,lfloorsqrtn rfloor mid n$Check perfect squareness by modulo division against multiple basesFor what pair of integers $(a,b)$ is $3^a + 7^b$ a perfect square.Do there exist any positive integers $n$ such that $lfloore^nrfloor$ is a perfect power? What is the probability that one exists?finding perfect power factors of an integerProve that the sequence contains a perfect square for any natural number $m $ in the domain of $f$ .Counting Perfect Powers