M is nice if it is possible to make it all + by a set of operation, each consisting of changing the sign of...
Pole-zeros of a real-valued causal FIR system
Term for the "extreme-extension" version of a straw man fallacy?
Anatomically Correct Strange Women In Ponds Distributing Swords
Detecting if an element is found inside a container
Method to test if a number is a perfect power?
Is the destination of a commercial flight important for the pilot?
Is there a korbon needed for conversion?
Is expanding the research of a group into machine learning as a PhD student risky?
How to safely derail a train during transit?
Applicability of Single Responsibility Principle
How does Loki do this?
What is paid subscription needed for in Mortal Kombat 11?
How to Reset Passwords on Multiple Websites Easily?
What can we do to stop prior company from asking us questions?
Is HostGator storing my password in plaintext?
What is the best translation for "slot" in the context of multiplayer video games?
Why Were Madagascar and New Zealand Discovered So Late?
Avoiding estate tax by giving multiple gifts
What does "I’d sit this one out, Cap," imply or mean in the context?
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
Proof of work - lottery approach
Is a stroke of luck acceptable after a series of unfavorable events?
How long to clear the 'suck zone' of a turbofan after start is initiated?
How do I find the solutions of the following equation?
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
$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.
puzzle
$endgroup$
add a comment |
$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.
puzzle
$endgroup$
$begingroup$
What about $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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
add a comment |
$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.
puzzle
$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
puzzle
asked Mar 15 at 17:57
yyyytyyyyt
31
31
$begingroup$
What about $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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
add a comment |
$begingroup$
What about $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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 $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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 $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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
add a comment |
3 Answers
3
active
oldest
votes
$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.
$endgroup$
$begingroup$
Very elegant !!
$endgroup$
– yyyyt
Mar 19 at 13:56
add a comment |
$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.
$endgroup$
add a comment |
$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 $mathcal{O}(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. :-)
$endgroup$
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
$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.
$endgroup$
$begingroup$
Very elegant !!
$endgroup$
– yyyyt
Mar 19 at 13:56
add a comment |
$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.
$endgroup$
$begingroup$
Very elegant !!
$endgroup$
– yyyyt
Mar 19 at 13:56
add a comment |
$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.
$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.
answered Mar 16 at 22:56
Mike EarnestMike Earnest
25.9k22151
25.9k22151
$begingroup$
Very elegant !!
$endgroup$
– yyyyt
Mar 19 at 13:56
add a comment |
$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
add a comment |
$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.
$endgroup$
add a comment |
$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.
$endgroup$
add a comment |
$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.
$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.
answered Mar 15 at 18:30
saulspatzsaulspatz
17.1k31435
17.1k31435
add a comment |
add a comment |
$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 $mathcal{O}(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. :-)
$endgroup$
add a comment |
$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 $mathcal{O}(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. :-)
$endgroup$
add a comment |
$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 $mathcal{O}(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. :-)
$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 $mathcal{O}(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. :-)
answered Mar 16 at 7:54
Wolfgang KaisWolfgang Kais
8165
8165
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
$begingroup$
What about $$begin{bmatrix}&+&+&-\&-&-&+\&-&-&+end{bmatrix}$$ 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