Finding numbers by given XOR values.
Given XOR values of 3 indices how can we find the numbers?
Like say if I have indices from 1 to 7, how can I find the numbers by given XOR values?
I have:
$X_{1} oplus X_{3} oplus X_{5}=V_1$
$X_{1} oplus X_{3} oplus X_{6}=V_2$
- $X_{1} oplus X_{4} oplus X_{6}=V_3$
- $X_{2} oplus X_{4} oplus X_{6}=V_4$
- $X_{2} oplus X_{4} oplus X_{7}=V_5$
- $X_{2} oplus X_{5} oplus X_{7}=V_6$
- $X_{3} oplus X_{5} oplus X_{7}=V_7$
How can I find any $X_{i}$ from the above data? Is there any pattern?
binary binary-operations binary-programming bit-strings
add a comment |
Given XOR values of 3 indices how can we find the numbers?
Like say if I have indices from 1 to 7, how can I find the numbers by given XOR values?
I have:
$X_{1} oplus X_{3} oplus X_{5}=V_1$
$X_{1} oplus X_{3} oplus X_{6}=V_2$
- $X_{1} oplus X_{4} oplus X_{6}=V_3$
- $X_{2} oplus X_{4} oplus X_{6}=V_4$
- $X_{2} oplus X_{4} oplus X_{7}=V_5$
- $X_{2} oplus X_{5} oplus X_{7}=V_6$
- $X_{3} oplus X_{5} oplus X_{7}=V_7$
How can I find any $X_{i}$ from the above data? Is there any pattern?
binary binary-operations binary-programming bit-strings
add a comment |
Given XOR values of 3 indices how can we find the numbers?
Like say if I have indices from 1 to 7, how can I find the numbers by given XOR values?
I have:
$X_{1} oplus X_{3} oplus X_{5}=V_1$
$X_{1} oplus X_{3} oplus X_{6}=V_2$
- $X_{1} oplus X_{4} oplus X_{6}=V_3$
- $X_{2} oplus X_{4} oplus X_{6}=V_4$
- $X_{2} oplus X_{4} oplus X_{7}=V_5$
- $X_{2} oplus X_{5} oplus X_{7}=V_6$
- $X_{3} oplus X_{5} oplus X_{7}=V_7$
How can I find any $X_{i}$ from the above data? Is there any pattern?
binary binary-operations binary-programming bit-strings
Given XOR values of 3 indices how can we find the numbers?
Like say if I have indices from 1 to 7, how can I find the numbers by given XOR values?
I have:
$X_{1} oplus X_{3} oplus X_{5}=V_1$
$X_{1} oplus X_{3} oplus X_{6}=V_2$
- $X_{1} oplus X_{4} oplus X_{6}=V_3$
- $X_{2} oplus X_{4} oplus X_{6}=V_4$
- $X_{2} oplus X_{4} oplus X_{7}=V_5$
- $X_{2} oplus X_{5} oplus X_{7}=V_6$
- $X_{3} oplus X_{5} oplus X_{7}=V_7$
How can I find any $X_{i}$ from the above data? Is there any pattern?
binary binary-operations binary-programming bit-strings
binary binary-operations binary-programming bit-strings
edited Dec 10 '18 at 14:42
asked Dec 10 '18 at 14:31
Sahil Silare
12119
12119
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Guide:
Let me solve for $X_7$.
First, I will compute $$X_1 oplus ldots oplus X_7 = V_1 oplus ldots oplus V_7$$
Then I can compute
$$X_1 oplus X_2 oplus X_3 oplus X_4 oplus X_5 oplus X_6 = V_1 oplus V_4$$
by considering the first and the fourth.
Now, we can compute $X_7$ by summing these two equations.
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
|
show 4 more comments
Build the matrix $A$ in which the entry $A_{i,j}$ is $1$ if in the $i$th equation there is $X_j$ appearing on the left hand side and $0$ otherwise.
The XOR system is equivalent to the following system of linear equations over the field $mathbb F_2$:
$$
left(
begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 0 \
1 & 0 & 1 & 0 & 0 & 1 & 0 \
1 & 0 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 0 & 1 \
0 & 1 & 0 & 0 & 1 & 0 & 1 \
0 & 0 & 1 & 0 & 1 & 0 & 1 \
end{array}
right) cdot
begin{pmatrix} X_1\X_2\X_3\X_4\X_5\X_6\X_7 end{pmatrix}
=
begin{pmatrix} V_1\V_2\V_3\V_4\V_5\V_6\V_7 end{pmatrix}
$$
The matrix on the left is the matrix $A$ that I made you build at the beginning.
The system is certainly solvable if the matrix $A$ is invertible in $mathbb F_2$.
In our case, $det(A)=-3$, so it is possible to solve the system.
This is the inverse matrix:
$$
left(
begin{array}{ccccccc}
1 & 1 & 1 & 0 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 0 & 1 & 1 & 1 \
end{array}
right) .
$$
To compute $X_i$, read the $i$th row and look for the columns where $1$ is present. Those are the indices of your original equations that you have to XOR together. For instance, for $X_1$ you have to XOR together
$$
X_1 = V_1 oplus V_2 oplus V_3 oplus V_5 oplus V_6 .
$$
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
|
show 5 more comments
Take XOR of all equations. This tells you that
$$ X_{1} oplus X_{2} oplus dots X_{7}=V_1 oplus V_2 oplus dots V_7 .$$
Now, to find value of any particular $X_i$ take xor of two equations where all variables except $X_i$ appear and then xor with the xor of all seven.
For instance, (1)&(4) gives you $X_7$, (1)&(5) gives you $X_6$ and so on.
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
add a comment |
If we XOR lines 1 and 2, we get
$$
X_5oplus X_6 = V_1oplus V_2
$$
XORing lines 4 and 5 gives us
$$
X_6oplus X_7 = V_4oplus V_5
$$
XORing these two together, we get
$$
X_5oplus X_7 = V_1oplus V_2oplus V_4oplus V_5
$$
Finally, XORing this with either line 6 or 7 gives us $X_2$ and $X_3$ respectively.
From this you should be able to squeeze out the remaining unknowns. Just be clever about which lines you XOR, and keep track of what you already know so that you can hope to eliminate those at every turn.
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
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%2f3033987%2ffinding-numbers-by-given-xor-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Guide:
Let me solve for $X_7$.
First, I will compute $$X_1 oplus ldots oplus X_7 = V_1 oplus ldots oplus V_7$$
Then I can compute
$$X_1 oplus X_2 oplus X_3 oplus X_4 oplus X_5 oplus X_6 = V_1 oplus V_4$$
by considering the first and the fourth.
Now, we can compute $X_7$ by summing these two equations.
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
|
show 4 more comments
Guide:
Let me solve for $X_7$.
First, I will compute $$X_1 oplus ldots oplus X_7 = V_1 oplus ldots oplus V_7$$
Then I can compute
$$X_1 oplus X_2 oplus X_3 oplus X_4 oplus X_5 oplus X_6 = V_1 oplus V_4$$
by considering the first and the fourth.
Now, we can compute $X_7$ by summing these two equations.
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
|
show 4 more comments
Guide:
Let me solve for $X_7$.
First, I will compute $$X_1 oplus ldots oplus X_7 = V_1 oplus ldots oplus V_7$$
Then I can compute
$$X_1 oplus X_2 oplus X_3 oplus X_4 oplus X_5 oplus X_6 = V_1 oplus V_4$$
by considering the first and the fourth.
Now, we can compute $X_7$ by summing these two equations.
Guide:
Let me solve for $X_7$.
First, I will compute $$X_1 oplus ldots oplus X_7 = V_1 oplus ldots oplus V_7$$
Then I can compute
$$X_1 oplus X_2 oplus X_3 oplus X_4 oplus X_5 oplus X_6 = V_1 oplus V_4$$
by considering the first and the fourth.
Now, we can compute $X_7$ by summing these two equations.
answered Dec 10 '18 at 14:44
Siong Thye Goh
99.5k1465117
99.5k1465117
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
|
show 4 more comments
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
Can you provide more info if the index is 6 instead of 7?
– Sahil Silare
Dec 10 '18 at 14:50
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
For $x_6$, you can sum up the first and the fifth. If you are looking for $x_6$, look for two equations without that variable and also the sum of the equations should cover the other variables.
– Siong Thye Goh
Dec 10 '18 at 14:55
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
No, I mean like if I have indices 1 to 6 then how can I compute individual values by constructing equations?
– Sahil Silare
Dec 10 '18 at 15:52
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
hmm... i don't quite understand your question.
– Siong Thye Goh
Dec 10 '18 at 15:59
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
Let say I have $X_{1},X_{2},X_{3}cdots X_{6}$ then how can I find values by finding any 3 number's XOR values?
– Sahil Silare
Dec 10 '18 at 16:00
|
show 4 more comments
Build the matrix $A$ in which the entry $A_{i,j}$ is $1$ if in the $i$th equation there is $X_j$ appearing on the left hand side and $0$ otherwise.
The XOR system is equivalent to the following system of linear equations over the field $mathbb F_2$:
$$
left(
begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 0 \
1 & 0 & 1 & 0 & 0 & 1 & 0 \
1 & 0 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 0 & 1 \
0 & 1 & 0 & 0 & 1 & 0 & 1 \
0 & 0 & 1 & 0 & 1 & 0 & 1 \
end{array}
right) cdot
begin{pmatrix} X_1\X_2\X_3\X_4\X_5\X_6\X_7 end{pmatrix}
=
begin{pmatrix} V_1\V_2\V_3\V_4\V_5\V_6\V_7 end{pmatrix}
$$
The matrix on the left is the matrix $A$ that I made you build at the beginning.
The system is certainly solvable if the matrix $A$ is invertible in $mathbb F_2$.
In our case, $det(A)=-3$, so it is possible to solve the system.
This is the inverse matrix:
$$
left(
begin{array}{ccccccc}
1 & 1 & 1 & 0 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 0 & 1 & 1 & 1 \
end{array}
right) .
$$
To compute $X_i$, read the $i$th row and look for the columns where $1$ is present. Those are the indices of your original equations that you have to XOR together. For instance, for $X_1$ you have to XOR together
$$
X_1 = V_1 oplus V_2 oplus V_3 oplus V_5 oplus V_6 .
$$
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
|
show 5 more comments
Build the matrix $A$ in which the entry $A_{i,j}$ is $1$ if in the $i$th equation there is $X_j$ appearing on the left hand side and $0$ otherwise.
The XOR system is equivalent to the following system of linear equations over the field $mathbb F_2$:
$$
left(
begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 0 \
1 & 0 & 1 & 0 & 0 & 1 & 0 \
1 & 0 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 0 & 1 \
0 & 1 & 0 & 0 & 1 & 0 & 1 \
0 & 0 & 1 & 0 & 1 & 0 & 1 \
end{array}
right) cdot
begin{pmatrix} X_1\X_2\X_3\X_4\X_5\X_6\X_7 end{pmatrix}
=
begin{pmatrix} V_1\V_2\V_3\V_4\V_5\V_6\V_7 end{pmatrix}
$$
The matrix on the left is the matrix $A$ that I made you build at the beginning.
The system is certainly solvable if the matrix $A$ is invertible in $mathbb F_2$.
In our case, $det(A)=-3$, so it is possible to solve the system.
This is the inverse matrix:
$$
left(
begin{array}{ccccccc}
1 & 1 & 1 & 0 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 0 & 1 & 1 & 1 \
end{array}
right) .
$$
To compute $X_i$, read the $i$th row and look for the columns where $1$ is present. Those are the indices of your original equations that you have to XOR together. For instance, for $X_1$ you have to XOR together
$$
X_1 = V_1 oplus V_2 oplus V_3 oplus V_5 oplus V_6 .
$$
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
|
show 5 more comments
Build the matrix $A$ in which the entry $A_{i,j}$ is $1$ if in the $i$th equation there is $X_j$ appearing on the left hand side and $0$ otherwise.
The XOR system is equivalent to the following system of linear equations over the field $mathbb F_2$:
$$
left(
begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 0 \
1 & 0 & 1 & 0 & 0 & 1 & 0 \
1 & 0 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 0 & 1 \
0 & 1 & 0 & 0 & 1 & 0 & 1 \
0 & 0 & 1 & 0 & 1 & 0 & 1 \
end{array}
right) cdot
begin{pmatrix} X_1\X_2\X_3\X_4\X_5\X_6\X_7 end{pmatrix}
=
begin{pmatrix} V_1\V_2\V_3\V_4\V_5\V_6\V_7 end{pmatrix}
$$
The matrix on the left is the matrix $A$ that I made you build at the beginning.
The system is certainly solvable if the matrix $A$ is invertible in $mathbb F_2$.
In our case, $det(A)=-3$, so it is possible to solve the system.
This is the inverse matrix:
$$
left(
begin{array}{ccccccc}
1 & 1 & 1 & 0 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 0 & 1 & 1 & 1 \
end{array}
right) .
$$
To compute $X_i$, read the $i$th row and look for the columns where $1$ is present. Those are the indices of your original equations that you have to XOR together. For instance, for $X_1$ you have to XOR together
$$
X_1 = V_1 oplus V_2 oplus V_3 oplus V_5 oplus V_6 .
$$
Build the matrix $A$ in which the entry $A_{i,j}$ is $1$ if in the $i$th equation there is $X_j$ appearing on the left hand side and $0$ otherwise.
The XOR system is equivalent to the following system of linear equations over the field $mathbb F_2$:
$$
left(
begin{array}{ccccccc}
1 & 0 & 1 & 0 & 1 & 0 & 0 \
1 & 0 & 1 & 0 & 0 & 1 & 0 \
1 & 0 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 1 & 0 \
0 & 1 & 0 & 1 & 0 & 0 & 1 \
0 & 1 & 0 & 0 & 1 & 0 & 1 \
0 & 0 & 1 & 0 & 1 & 0 & 1 \
end{array}
right) cdot
begin{pmatrix} X_1\X_2\X_3\X_4\X_5\X_6\X_7 end{pmatrix}
=
begin{pmatrix} V_1\V_2\V_3\V_4\V_5\V_6\V_7 end{pmatrix}
$$
The matrix on the left is the matrix $A$ that I made you build at the beginning.
The system is certainly solvable if the matrix $A$ is invertible in $mathbb F_2$.
In our case, $det(A)=-3$, so it is possible to solve the system.
This is the inverse matrix:
$$
left(
begin{array}{ccccccc}
1 & 1 & 1 & 0 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 1 & 0 \
1 & 1 & 0 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 1 & 0 & 1 \
1 & 0 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 1 & 0 & 1 & 1 \
0 & 1 & 1 & 0 & 1 & 1 & 1 \
end{array}
right) .
$$
To compute $X_i$, read the $i$th row and look for the columns where $1$ is present. Those are the indices of your original equations that you have to XOR together. For instance, for $X_1$ you have to XOR together
$$
X_1 = V_1 oplus V_2 oplus V_3 oplus V_5 oplus V_6 .
$$
edited Dec 10 '18 at 18:19
answered Dec 10 '18 at 14:54
Federico
4,689514
4,689514
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
|
show 5 more comments
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
Can you explain the first line more?
– Sahil Silare
Dec 10 '18 at 18:07
1
1
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
$X_1oplus X_3oplus X_5$ is nothing other than standard addition $X_1+X_3+X_5$ in the field $mathbb F_2 = mathbb Z/(2mathbb Z)$. Therefore your system of XOR equations is actually a linear system of equations in the field $mathbb F_2$. The same theory of linear systems on $mathbb R$ or $mathbb C$ applies here. In particular, your system is solvable if the matrix has full rank. Here I compute the standard determinant and find out which is $-3$, which is not $0$ in $mathbb F_2$, so the matrix is invertible
– Federico
Dec 10 '18 at 18:13
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
The first row is just telling you to build the usual matrix that you would build for a linear system of equations. You simply write $X_1+X_3+X_5 = (1,0,1,0,1,0,0) cdot (X_1, X_2, X_3, X_4, X_5, X_6, X_7)$
– Federico
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
Please add the matrix A for better understanding!
– Sahil Silare
Dec 10 '18 at 18:14
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
@SahilSilare sorry i didn't have time before. I hope this helps you solve any other system that you might encounter. Just remember that solving XOR systems is like solving linear systems in $mathbb F_2$
– Federico
Dec 10 '18 at 18:20
|
show 5 more comments
Take XOR of all equations. This tells you that
$$ X_{1} oplus X_{2} oplus dots X_{7}=V_1 oplus V_2 oplus dots V_7 .$$
Now, to find value of any particular $X_i$ take xor of two equations where all variables except $X_i$ appear and then xor with the xor of all seven.
For instance, (1)&(4) gives you $X_7$, (1)&(5) gives you $X_6$ and so on.
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
add a comment |
Take XOR of all equations. This tells you that
$$ X_{1} oplus X_{2} oplus dots X_{7}=V_1 oplus V_2 oplus dots V_7 .$$
Now, to find value of any particular $X_i$ take xor of two equations where all variables except $X_i$ appear and then xor with the xor of all seven.
For instance, (1)&(4) gives you $X_7$, (1)&(5) gives you $X_6$ and so on.
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
add a comment |
Take XOR of all equations. This tells you that
$$ X_{1} oplus X_{2} oplus dots X_{7}=V_1 oplus V_2 oplus dots V_7 .$$
Now, to find value of any particular $X_i$ take xor of two equations where all variables except $X_i$ appear and then xor with the xor of all seven.
For instance, (1)&(4) gives you $X_7$, (1)&(5) gives you $X_6$ and so on.
Take XOR of all equations. This tells you that
$$ X_{1} oplus X_{2} oplus dots X_{7}=V_1 oplus V_2 oplus dots V_7 .$$
Now, to find value of any particular $X_i$ take xor of two equations where all variables except $X_i$ appear and then xor with the xor of all seven.
For instance, (1)&(4) gives you $X_7$, (1)&(5) gives you $X_6$ and so on.
answered Dec 10 '18 at 14:48
Alex Smart
614
614
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
add a comment |
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
This game is only playable when the system is very simple as in this case. Check my answer for the general treatment of the problem.
– Federico
Dec 10 '18 at 15:14
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
"The general problem ( solving a set of equations Xi1⊕Xi2⊕Xi3=ai ) is NP-complete." How is that?! A system of XOR equations is just a linear system in $mathbb F_2$. Look math.stackexchange.com/questions/169921/…
– Federico
Dec 10 '18 at 15:32
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
You are of course right. Finding the maximum number of equations that can be satisfied is NP-hard but finding whether the equations can all be satisfied simultaneously is not.
– Alex Smart
Dec 10 '18 at 16:24
add a comment |
If we XOR lines 1 and 2, we get
$$
X_5oplus X_6 = V_1oplus V_2
$$
XORing lines 4 and 5 gives us
$$
X_6oplus X_7 = V_4oplus V_5
$$
XORing these two together, we get
$$
X_5oplus X_7 = V_1oplus V_2oplus V_4oplus V_5
$$
Finally, XORing this with either line 6 or 7 gives us $X_2$ and $X_3$ respectively.
From this you should be able to squeeze out the remaining unknowns. Just be clever about which lines you XOR, and keep track of what you already know so that you can hope to eliminate those at every turn.
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
add a comment |
If we XOR lines 1 and 2, we get
$$
X_5oplus X_6 = V_1oplus V_2
$$
XORing lines 4 and 5 gives us
$$
X_6oplus X_7 = V_4oplus V_5
$$
XORing these two together, we get
$$
X_5oplus X_7 = V_1oplus V_2oplus V_4oplus V_5
$$
Finally, XORing this with either line 6 or 7 gives us $X_2$ and $X_3$ respectively.
From this you should be able to squeeze out the remaining unknowns. Just be clever about which lines you XOR, and keep track of what you already know so that you can hope to eliminate those at every turn.
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
add a comment |
If we XOR lines 1 and 2, we get
$$
X_5oplus X_6 = V_1oplus V_2
$$
XORing lines 4 and 5 gives us
$$
X_6oplus X_7 = V_4oplus V_5
$$
XORing these two together, we get
$$
X_5oplus X_7 = V_1oplus V_2oplus V_4oplus V_5
$$
Finally, XORing this with either line 6 or 7 gives us $X_2$ and $X_3$ respectively.
From this you should be able to squeeze out the remaining unknowns. Just be clever about which lines you XOR, and keep track of what you already know so that you can hope to eliminate those at every turn.
If we XOR lines 1 and 2, we get
$$
X_5oplus X_6 = V_1oplus V_2
$$
XORing lines 4 and 5 gives us
$$
X_6oplus X_7 = V_4oplus V_5
$$
XORing these two together, we get
$$
X_5oplus X_7 = V_1oplus V_2oplus V_4oplus V_5
$$
Finally, XORing this with either line 6 or 7 gives us $X_2$ and $X_3$ respectively.
From this you should be able to squeeze out the remaining unknowns. Just be clever about which lines you XOR, and keep track of what you already know so that you can hope to eliminate those at every turn.
edited Dec 10 '18 at 14:53
answered Dec 10 '18 at 14:37
Arthur
111k7105186
111k7105186
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
add a comment |
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
@Federico Sure. But if you don't apply "lucky algorithms" the times where you're lucky with your givens, and instead use the full machinery every time, then 1) that's boring, 2) when are you going to use the lucky algorithms? and 3) it's good to think for oneself from time to time.
– Arthur
Dec 10 '18 at 15:35
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
I agree, but I thought it would have been more instructive for the OP to learn the general scheme, as he didn't seem to be aware of the relation with linear systems over $mathbb F_2$, and that completely trivializes the question
– Federico
Dec 10 '18 at 18:30
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
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%2f3033987%2ffinding-numbers-by-given-xor-values%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