Level 4: At least one

Task

Build a logical OR gate.

OR outputs 1 if at least ONE input is 1.

Solution

Use De Morgan's law: A OR B = NOT(NOT A AND NOT B). Translated to circuit:

1. Invert both inputs A and B — place two NOT gates, feed each input to its own NOT. 2. Feed the outputs of both NOTs to AND inputs — AND outputs 1 only when BOTH inverted inputs are 1, which happens when original A and B are BOTH 0. 3. Invert the AND output with a third NOT — now output is 1 when original A and B are NOT both 0, i.e. when at least one is 1. That is OR.

Connect the last NOT output to Output.