Skip to main content

Section 5.1 The OR Gate

The basic building block of computers is the switch - in modern computers a transistor - able to turn a signal on or off. A computer does all its work with these switches, manipulating the binary information that represents data. These switches are combined in various ways to produce what are known as logic gates. Logic gates take one or more input signals and produce an output based on the current input.
As a first example, consider two switches that are implemented in parallel - electricity can pass from a battery to a light bulb if either switch is on. (Note that this is a highly simplified version of how electrical circuits really work) In the figure below, the electricity is being routed through the top switch that is on. The fact that the bottom switch is in the off position does not change the fact that power can reach the bulb.
Switch circuit demonstrating one input case for an OR gate.
If only the bottom switch is on, or if both switches are on, the power can still reach the bulb to light it:
Switch circuit demonstrating another input case for an OR gate.
Switch circuit demonstrating an OR gate with both switches closed.
The only way the light bulb will not be on is if both switches are in the off position:
Switch circuit demonstrating an OR gate with both switches open.
These switches are demonstrating the Boolean logic rule of OR. The OR rule says that if either input (switch) is on, the output (light) is on. This can be summarized in terms of a truth table. A truth table shows each possible set of input and the output those inputs produces.
For the circuit shown above, we can think of the top switch as Input 1 and the bottom switch as Input 2. We will call on โ€œ1โ€ and off โ€œ0โ€. There are four possible sets of inputs for the two switches: 00 - both off, 10 - top on, 01 - bottom on, 11 - both on. In every situation but 00, the output is on (1). The truth table below shows those four possibilities:
Table 5.1.1. Truth table for OR
Input 1 Input 2 Output
0 0 0
0 1 1
1 0 1
1 1 1
Although the computer will only think in terms of 1 and 0, those can stand for any piece of information that has a true/false or yes/no answer. For example, maybe our two inputs represent โ€œIs it raining right now?โ€ and โ€œIs rain forecast for later?โ€ and our output represents โ€œBring an umbrellaโ€. The logical rule OR is appropriate to decide if we need to have an umbrella with us. If it is raining now, or if it is expected to rain later (or if it is raining now and is expected to rain later) then we need an umbrella.

Aside: George Boole.

Checkpoint 5.1.2.

For a two-input OR gate, when is the output 0?
  • Both inputs are 0.
  • Exactly one input is 0.
  • Both inputs are 1.
  • At least one input is 1.

Checkpoint 5.1.3.

You have attempted of activities on this page.