I was playing with some electronics recently, and I had bought three logic gates to make a small flat device that took two inputs, I1 and I2, and returned them in the opposite order (I2 then I1).

Unfortunately, I was using some acid to separate a couple of pieces of metal that were soldered together, and I hadn't put away my device, so a drop of acid fell down and melted away a section of one of the wires. Frantically I tested my device, and it just returned the inputs in the order they were entered.

I chucked the device away and bought some new materials, but the day after the rubbish was collected, I realised I forgot to make a circuit diagram. All I remembered was that the gates were 2 input, 1 output, and that they were symmetric in their inputs (so the first input being high and the second being low had the same output as the second input being high and the first low).

Can you recreate the circuit diagram for me, and tell me on which segment of wire the acid spilt?


  • The device was flat, so no wire crossings occured.

  • The diagram needs to be accurate up to topology.

  • The flow went strictly in the direction from the input side to the output side, so there were no loops.

  • The wires did split at points, but two wires only joined at a gate.

  • The device looked like this:

    I1 ->-               ->- O1  
          \             /        
           [THE CIRCUIT]         
          /             \        
    I2 ->-               ->- O2

    where originally I1=O2 and I2=O1, but after the acid was spilt I1=O1 and I2=O2.

  • $\begingroup$ I don't see why the input would change... $\endgroup$ Jan 25, 2017 at 6:37
  • 2
    $\begingroup$ ^vote with a note: I'd like to see more puzzles like this, perhaps with a new specific tag. If it doesn't give away too much, how about adding a list of 2-input gates, or a web link? I gather there are just 8 candidates, disregarding the condition of symmetry, but would like to be sure this is what you mean. (Ooops, now that I see the solutions, a list of gates would be for the sake of posterity.) $\endgroup$
    – humn
    Jan 25, 2017 at 8:34
  • $\begingroup$ Since the intended answer apparently relies on inputs floating low and this is by no means a safe assumption it should be included in the problem statement. $\endgroup$ Jan 26, 2017 at 7:09

4 Answers 4


Unfortunately I don't know how to draw the diagram but I will try to explain the logic behind it and where you dropped the acid you clumsy, you...

You build a

Swap circuit (you already stated that) that uses XOR (^) to swap the inputs.

And the 3 operations were: (let's say the input was X and Y to make it easier to explain. No need to involve letters and numbers also)

A = X ^ Y
B = X ^ A
C = Y ^ A
Then just output B and C.

Why did the initial circuit work?

The first operation does what is says it does, but XOR is associative and commutative.
So the second one is similar to doing B = X ^ (X ^ Y) which is the same as Y = X ^ X ^ Y.
However, X ^ X is zero. and 0 ^ Y = Y. This means that the value of B is Y.
By the same logic on operation 3 you get C having the value of X.

And you dropped acid on

The output of the first operation A = X ^ Y.

And now it just does this

A = X ^ Y
B = 0 ^ X
C = 0 ^ Y
Then just output B and C.

And this outputs the original values because

The first operation does nothing of use.
0 ^ X = X, so the second operation just gives X.
In the same way, 0 ^ Y = Y.
Then you output the values, and they are the same as the initial ones.

I hope this is enough to get you to build your circuit schema again. I'm glad I could help.


Thanks to humn for providing this picture.

  • $\begingroup$ Correct - do you mind if I add a couple of diagrams and clear some things up? $\endgroup$
    – boboquack
    Jan 25, 2017 at 7:31
  • $\begingroup$ I will try but I don't promise anything. If the diagram provided by stack reader is correct just tell me. so I won't overload my brain for nothing. $\endgroup$
    – Marius
    Jan 25, 2017 at 7:48
  • $\begingroup$ I'm happy to do it for you - stack reader's diagram is correct except for where the 'oil spill' is - acid burns away, not fuses. $\endgroup$
    – boboquack
    Jan 25, 2017 at 7:50
  • $\begingroup$ If I don't post anything in the next 10 minutes I would probably need your help. $\endgroup$
    – Marius
    Jan 25, 2017 at 7:50
  • $\begingroup$ I guess I could use some help. I've tried but failed miserably. $\endgroup$
    – Marius
    Jan 25, 2017 at 8:23

Here is a horrible attempt at ascii

     |            |
     |            |
Where the O marks the acid spot.


The first XOR checks if the 2 inputs are different or not. If so, sends a 1. The other XOR change the signal if they received a 1 from the first XOR.
The oil spot blocked the switch signal from reaching the next XOR gates and therefore the change was not made.

  • $\begingroup$ @boboquack is this better? $\endgroup$ Jan 25, 2017 at 8:05
  • $\begingroup$ Yes, however Marius did answer first, so if he puts diagrams up, the checkmark will have to go to him. $\endgroup$
    – boboquack
    Jan 25, 2017 at 8:15
  • $\begingroup$ @boboquack. I'm not going to add a diagram, not because I don't want to, but because I can't. If this answer fits your requirements, you have my blessing to accept it. $\endgroup$
    – Marius
    Jan 25, 2017 at 9:59

Here's my solution First, the three gates are

All XOR gates

The are arranged such that

I1 and I2 are wired as inputs into an XOR gate, call the resultant wire M (for middle)
I1 and M are wired as inputs into an XOR gate, the resultant wire is O1
I2 and M are wired as inputs into an XOR gate, the resultant wire is O2

As a diagram, it looks like this:

I1--------XOR-O1 _XOR__/ / \ I2________XOR-O2

That satisfies the initial condition.

As for what the acid burned away, it would be the wire

Its the wire that exits the intial XOR gate before it splits to go into the two later XOR gates. That causes each subsequent XOR gate to have a 0 input, which makes the other input the output value. Hence, the XOR gate that outputs O1 is the result of 0 xor I1, which is I1, and the same for O2/I2

  • $\begingroup$ Welcome to Puzzling! Thanks for that answer! Unfortunately, this is the same as the other solutions :( Have you taken the site tour yet? $\endgroup$
    – boboquack
    Jan 25, 2017 at 21:52
  • $\begingroup$ It took a while to make the spoiler tags work. I got sniped! $\endgroup$
    – Jesse
    Jan 25, 2017 at 21:54
  • $\begingroup$ Here, we call it getting "ninja'd"! :D (No idea why...) $\endgroup$
    – boboquack
    Jan 25, 2017 at 21:58

I have a slightly cheeky answer.

The tricky thing about the question is that

you didn't specify what logic family you're using. Given the symptoms you describe, my best guess is that you were using transistor–transistor logic gates (TTL gates).

Given this assumption, contrary to what the other answers have stated, your circuit actually must have consisted of

three XNOR gates, connected like so:

 I1 ---+----------------)....)
       |                )XNOR)--- O1
       +---)....)   +---)....)
       +---)....)   +---)....)
       |                )XNOR)--- O2
 I2 ---+----------------)....)

Here's a truth table for what this circuit does, where "a" denotes the center junction:

 I1  I2  a  O1  O2
  0   0  1   0   0
  0   1  0   1   0
  1   0  0   0   1
  1   1  1   1   1

When that drop of acid fell,

it destroyed the wire coming out of the first XNOR gate. This caused the center junction "a" to become an unconnected input, and with TTL, an unconnected input usually behaves as a 1, not a 0.

Here's the resulting truth table:

 I1  I2  a  O1  O2
  0   0  1   0   0
  0   1  1   0   1
  1   0  1   1   0
  1   1  1   1   1

If the circuit were

made out of XOR gates, then the truth table would have been the following instead:

 I1  I2  a  O1  O2
  0   0  1   1   1
  0   1  1   1   0
  1   0  1   0   1
  1   1  1   0   0

Now, at this point, you might be wondering how realistic that assumption I made in the first spoiler block is. The answer is that

it's pretty realistic. For discrete logic gates, the most common logic families are probably TTL and CMOS. ("Discrete" means that they're individual parts that you can buy separately, as opposed to logic gates that are part of an integrated circuit.) With TTL, an unconnected input usually behaves as a 1, as I described. With CMOS, an unconnected input has unpredictable behavior; the outputs would probably vary seemingly at random. There are logic gates where an unconnected input will behave as a 0, but to the best of my knowledge, they're much less common. So, if we interpret the question as something that actually happened in real life, the most likely possibility is that the gates are TTL gates.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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