## Logic Gates Definition:

Logic gates are basically digital electronic circuits which are used to perform certain logical manipulations or operations. Digital logic gates are built with the help of transistors such as MOSFET and BJT.

A typical logic gate takes two inputs, performs certain logical operations on them and gives a single output. Inputs can be more than two but the logical operation is always the same according to the type of the gate. You will understand this point from the definition of every gate below. A special type of algebra is used for logic operations which is called Boolean Algebra. The inputs/outputs of logic gates are Boolean variables having values only **1** (means ON) or **0** (means OFF).

Logic gates are the backbone of today’s digital electronics world. This detailed lecture covers logic gates for beginners. We will discuss the following things

- Types of logic gates
- Truth tables of a logic gates along with logic circuits
- Logic gates symbols
- Q&A

**Types of Logic Gates**

There are three basic logic gates i.e AND, OR and NOT. Other types of logic gates are derived from these gates. We will discuss all logic gates one by one

**OR Gate:**

The output of the OR gate is always 1 if at least one of the inputs is 1. The OR logic operation between the inputs is denoted by a ‘**+**’ sign. If **A** and **B** are inputs and **Y** is the output then

**Y = A+B**

**OR Gate Symbol**

The OR gate operation can be fully understood with the help of the following logic diagram. The following circuit two switches A and B are connected in parallel. These switches are basically high-speed transistors.

**OR gate logic diagram**

If switch A is closed which means the value of variable A is 1, the current will pass through switch A to turn ON the LED. In this case the output is 1.

**Switch A is closed or 1**

If switch B is closed, the current will pass through switch B to turn ON the LED

**Switch B is closed or 1**

If both switches are open, I mean the transistors are OFF then current cannot pass to the LED so the output is 0. Hence for the output to be 1 at least one of the input (switches) must be 1.

Inputs | Output | |

A | B | Y |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

**OR Truth Table**

**AND Gate**

The output of the AND logic gate is always 0 if at least one of the inputs is 0 (see AND truth table below). The operation between the inputs is denoted by a ‘**.**’ sign. If **A** and **B** are inputs and **Y** is the output then

**Y = A.B**

**AND Gate Symbol**

The AND gate function can be fully understood with the help of the following logic diagram. The following logic circuit has two switches A and B are connected in series.

**AND logic circuit**

You can observe the LED can only be turned ON if both switches are closed. It means the output is only 1 when all the inputs are 1.

**When both switches are closed or 1**

Inputs | Output | |

A | B | Y |

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

**AND Gate Truth Table**

**NOT Gate**

The output of the NOT logic gate is 1 if the input is 0. If **A** is input and **Y** is the NOT gate output then

**NOT Gate Symbol**

The NOT gate function can be fully understood with the help of the following logic diagram. The switch A is connected in parallel to the load LED. The resistance of switch A is very very low as compared to the output load. If the switch is ON, it will shunt the current. If it is OFF then current will pass to the load. In short the working of NOT gate is just to invert the input.

**Switch A is open or 0**

**Switch A is closed or 1**

Input | Output |

A | Y |

0 | 1 |

1 | 0 |

**NOT Gate Table**

**NOR Gate**

The output of the NOR gate is always 0 if at least one of the inputs is 1 (see NOR truth table below). If **A** and **B** are inputs and **Y** is the output then

**NOR Gate Symbol**

The small bubble at the output represents NOT operation. The NOR gate function can be fully understood with the help of the following logic diagram. Just like NOT gate you can observe if at least one of the switches is ON, then LED is OFF.

**Switch A is closed or 1**

You can see in the above figure if either switch A or B or both are ON, the current will be shunted and output is 0. The output is 1 iff both switches are open.

**Both switches are open or 0**

Inputs | Output | |

A | B | Y |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 0 |

**NOR Gate Truth Table**

**NAND Gate**

The output of the NAND logic gate is always **0** if all the inputs are **1 **(refer to the NAND truth table below). If **A** and **B** are inputs and **Y** is the output then NAND operation between **A and B **is represented by

**NAND Gate Symbol**

The NAND logic gate operation can be fully understood with the help of the following logic diagram. Just like a NOT gate you can observe if all switches are ON, then LED is OFF because they will bypass the current due to their low resistance as compared to load. If at least one of the switches is OFF, the output is ON.

**All switches are open or 0**

**All switches are closed or 1**

Inputs | Output | |

A | B | Y |

0 | 0 | 1 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

**NAND Gate Truth Table**

**XOR Gate (exclusive OR) **

The output of the XOR logic gate is always **0** if all the inputs are **1 or 0 **(See XOR truth table below). If **A** and **B** are inputs and **Y** is the output then XOR operation between **A and B **is represented by

**XOR Gate Symbol**

The XOR gate function can be fully understood with the help of the following logic diagram. There are four switches. 2-pairs have the same name i.e A OR B. It means both A switches are at the same position at the same time. I mean both switches are 0 or 1 at the same time. Similar is the case for twin B switches. See XOR table below

**All switches are closed or 1**

If all switches are open or 0, still no current can pass through the load.

**At least one switch is ON or 1**

It can also be represented by another XOR logic circuit diagram given below

In the above diagram if A is OFF or 0, then A’ is ON or 1. The scenario is the same for B. The end result is quite equal to the previous logic diagram.

Inputs | Output | |

A | B | Y |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 0 |

**XOR Gate Truth Table**

**XNOR Gate (exclusive NOR)**

The output of the XNOR gate is always **1** if all the inputs are **1 or 0 **(XNOR truth table). If **A** and **B** are inputs and **Y** is the output then XNOR function between **A and B **is represented by

**XNOR Gate Symbol**

The exclusive NOR gate operation can be fully understood with the help of the following logic diagram. There are 2-pairs of four switches i.e A and A’, B and B’. It means A is ON then A’ is OFF and if A is OFF then A’ is ON. Same applies to switches B and B’.

**XNOR Logic Diagram**

You can see in the above figure if A and B are 1, then A’ and B’ are zero, the output is also 1. If A and B are 0, the A’ and B’ are 1, the output is still 1.

**A and B are closed or 1**

**A and B are open or 0**

On the other hand if A is 1 B is 0. Then A’ is 0 and B’ is 1. No current will pass through the circuit and output is 0.

Inputs | Output | |

A | B | Y |

0 | 0 | 1 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

**XNOR Gate Truth Table**

# Some Common Questions and Their Answers

**What is a logic circuit?**

A logic circuit is an electronic circuit made with logic gates instead of electronic devices. Digital logic circuits are important in digital electronics to see the circuit logicly.

**Are logic gates transistors?**

Yes logic gates are made with transistors. Refer to this video

**Are logic gates analog?**

Although logic gates are made with transistors. But the switching property of transistors make then digital. So logic gates are digital devices.

**How logic gates can be used as switches?**

Logic gates are basically switching devices. They can be used as decision makers and can ON/OFF an electronic devices billions of times per second.

**Which logic gates are universal?**

NAND and NOR gates are universal because every other gate can be built with the help of these gates They are easy to manufacture, cost effective and are basic components of IC (Integrated Circuits) logic gates.

**Which logic gates provide multiplication process?**

You can see above, the NAD and NAND gates provide multiplication of inputs.

**Why logic gates are used?**

Logic gates are use for logical calculations basically when we need to make decisions based on what is coming at the input of a circuit. Computers use logic gates to make decisions based on 1s and 0s. As you know digital computers work on 1s and 0s.

**Why logic gates are important?**

As I have already told you a digital computer have millions of logic gates which are used to perform many logical operations such as switching, additions, subtraction etc.

### Who invented logic gates?

**Konrad Zuse**designed and built electromechanical logic gates for his computer Z1 (from 1935–38).

**Which logic gates are ideal for parity checking?**

As you have read above XOR produces low output when both inputs are 1 or 0. Similarly XNOR gate produces 1 when both inputs are 1 or 0. So we can use them for even and or parity. Parity method can detect a single. If one of the bit is changed the result will be different.

## Leave a Reply