I have a certain transformations that goes as follows: Given $A=|abc\rangle$, $B=|xyz\rangle$, now I have cases as:

$$\text{if }c=1,z=1, b\oplus y=1 \implies \text{flip}(x)$$ $$\text{if }c=1, z=1 \implies \text{flip}(y)$$ $$\text{if }c=1\implies \text{flip}(z)$$ $$\text{if }b=1\implies \text{flip}(y)$$ $$\text{if }a=1\implies \text{flip}(x)$$

Can somebody just tell me the circuit for the bit-wise XOR that I have used between $b$ and $y$, i.e $b\oplus y=1$? The other gates I know are CNOT and Toffoli.

  • 2
    $\begingroup$ Hi! What have you done so far and what issues are you having? $\endgroup$
    – Mark S
    Apr 3 '19 at 17:26
  • $\begingroup$ I can make circuit, but the only problem is how to implement the $b\oplus y=1$ in the circuit? $\endgroup$
    – Upstart
    Apr 3 '19 at 17:37
  • $\begingroup$ So the circuit you have above is same as what you want but with first line replaced by $c=1,z=1 \implies \text{flip}(x)$? $\endgroup$
    – AHusain
    Apr 3 '19 at 19:56
  • 1
    $\begingroup$ But it looks like they(you?) forgot to uncompute $\endgroup$
    – AHusain
    Apr 3 '19 at 20:45
  • 1
    $\begingroup$ It's not a full answer, it is a part. That is why it is a comment. Can you answer my clarifying question so someone could actually answer it? $\endgroup$
    – AHusain
    Apr 3 '19 at 23:15

Why not simply try the following? enter image description here You could have used an ancilla and computed $y\oplus b$ (that requires two controlled-nots, one controlled off each of $b$ and $y$, not a Toffoli) provided you later uncomputed the ancilla to reset it back to 0. But having an ancilla is unnecessary.

Just to explain what's happening in the boxed part of my circuit, both gates only work if $c=z=1$. Then the two gates flip $x$ depending on the value of $b$ or $y$ respectively. So, if $b\oplus y=1$, only one flip is applied, because one value is 0 and one value is 1. If $b\oplus y=0$, then either $b=y=0$, and no flip is applied, or $b=y=1$ and two flips are applied. But 2 flips cancel each other, so if $b\oplus y=0$, no operation is applied.

  • $\begingroup$ Okay, thanx, just out of curiosity, if there had been an OR between $b$ and $y$ then there would have been 3 gates where the first would be controlled by $c=z=b=1$ and target $x$, second would be controlled by $c=z=y=1$ and target $x$, third would be controlled by $b=y=1$ and target as $x$. isn't it? $\endgroup$
    – Upstart
    Apr 5 '19 at 10:38
  • $\begingroup$ do you mean the value on y is replaced by y OR b? In that case, it is impossible to recover the value of y, and it is therefore impossible to implement b XOR y. $\endgroup$
    – DaftWullie
    Apr 5 '19 at 10:41
  • $\begingroup$ No, i just mean if $b \oplus y=1$ is replaced by $b ~~or~~y=1$ $\endgroup$
    – Upstart
    Apr 5 '19 at 11:39
  • $\begingroup$ then the third one would need c=z=b=y=1 $\endgroup$
    – DaftWullie
    Apr 5 '19 at 12:09
  • $\begingroup$ Yes i forgot to write $c=z=1$. Thanx, and can you tell me how these circuit can be drawn. any online source? $\endgroup$
    – Upstart
    Apr 5 '19 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.