**Logic gate** are the basic building block of digital computers. Gates, actually are circuits which takes Some input usually (2 or more) to produce a single output. Gates have upon no memory and their output depends the present value of input. The **logic** **gate are used** to make combinational circuit (like Half adder, Full adder, half Subtractor, Full subtractor, Multiplexer, Demultiplexer, Decoder, Encoder And Magnitude comparator etc.) , Sequential circuit( like Flip flop, Latch, counters etc.), PLA(programmable Logic Array), PAL(programmable array logic). **There are seven types of gates out of which three are basic gates and four are derived gates.**

### What are basic logic gate?

The basic building block of a digital computer are known as Basic logic gate. There are three kinds of basic gates or just gate i.e. **AND-gate, OR-gate and NOT-gate(or inverters)** which are discuss below:

##### OR gate

This is a basic gate that takes two input and produces high output when any one of the input is high. OR gate produces low result when all inputs are Low. The OR gate is symbolized by **‘+’ **sign between the variable. If A and B are two inputs and X is the output, then OR gate is given by **X=A+B**.

A | B | X=A+B |

0 0 1 1 | 0 1 0 1 | 0 1 1 1 |

**Truth table of OR-gate**

##### AND gate

It is а basic gate that produces a high output when all inputs are high, and if any input are low, it produces a low output. AND gate is symbolize by** (.) **sign between the variables. If A and B are two input variables and X is the output variable then AND gate given by** X=A.B**

A | B | X=A.B |

0 0 1 1 | 0 1 0 1 | 0 0 0 1 |

**Truth table of AND-gate**

##### NOT gate

is an inverter gate. It just complements the input. It take only one input and if the input is high it produces low and vice-versa which are shown in truth table below:

A | A’ |

0 1 | 1 0 |

**Truth table of NOT-gate**

##### NOR gate:

is an inverter of OR gate. It produce a low output when any of the input is high and produces a high output when all inputs are low which are shown in truth table. It is also called universal logic gate.

A | B | X=(A+B)’ |

0 0 1 1 | 0 1 0 1 | 1 0 0 0 |

**Truth table of NOR-gate**

##### NAND gate

NAND gate is an inverter of AND gate. It produces high output when any one of the input is low. It produces low output, when all inputs are high.

A | B | X=(A.B)’ |

0 0 1 1 | 0 1 0 1 | 1 1 1 0 |

**Truth table of NAND-gate**

##### X-OR gate:

Exclusive OR is derived gate that is symbolized by $\overline{)+}$. It produces a high output only when both the inputs are of opposite logic. If both are of same logic at produces a low output.A | B | X=A’B+AB’ |

0 0 1 1 | 0 1 0 1 | 0 1 1 0 |

**Truth table of XOR-gate**

##### X-NOR gate

Exclusive NOR gate is a**derived gate**that is symbolized by $\odot $. The X-NOR gate produces output only when both the inputs, are of same logic. if the inputs are different logic it produces low output.

A | B | X=(A’B+AB’)’ |

0 0 1 1 | 0 1 0 1 | 1 0 0 1 |

**Truth table of XOR-gate**

### What is Universal gate?

The universal gate is a gate which can implement any Boolean Function without need to use any kind of other gate. NOR gate and NAND gate are also known as universal gate because we can implement the basic gate OR, AND, NOT gate From these two gates.

**Why are NAND and NOR gate is called universal logic gate?**

To prove these two gate are **universal gate**, That any Boolean function can be implemented using NAND and NOR gates we will show that the AND, OR and NOT operation can be perform using only these gate.

##### 1.NAND gate is an universal logic gate:

A | B | A’ | B’ | (A’.B’)’ |

0 0 1 1 | 0 1 0 1 | 1 1 0 0 | 1 0 1 0 | 0 0 0 1 |

**Truth table NAND gate as AND gate**

Above the truth table show that when two input A and B are attached between two NAND gate we found the same output as AND gate. So AND gate can be replaced by NAND gates as shown in the figure (The AND is replaced by a NAND gate inverter).

A | A | (A.A)’ |

0 1 | 0 1 | 1 0 |

**Truth table NAND gate as NOT gate**

All NAND inputs pin connect to the input signal A gives an output A’.

A | B | A’ | B’ | (A’.B’)’ |

0 0 1 1 | 0 1 0 1 | 1 1 0 0 | 1 0 1 0 | 0 1 1 1 |

**Truth table NAND gate as OR gate**

An OR gate is replaced by NAND gate as shown in above the logic symbol or truth table (Here we replace OR gate by NAND gate with all its input complemented by NAND gate inverters.

**Thus, the NAND gate is a universal logic gate since it can be implemented the AND, OR and NOT function.**

##### 2.NOR gate is an universal gate:

A | B | (A+B)’ | (A+B)” |

0 0 1 1 | 0 1 0 1 | 1 0 0 0 | 0 1 1 1 |

**Truth table NOR gate as OR gate**

If we apply two inputs A and B between two NOR gates then the output is same as OR gates which are shown above the truth table. Above the symbol show that the OR gates are replace by NOR gate.

A | A | A’ |

0 1 | 0 1 | 1 0 |

**Truth table NOR gate as NOT gate**

All NOR inputs pins connect input signal A gives an output (A+A)’ =A’. As this way NOR gate can be used as NOT gate(inverter).

A | B | A’ | B’ | (A’+B’)’ |

0 0 1 1 | 0 1 0 1 | 1 1 0 0 | 1 0 1 0 | 0 0 0 1 |

**Truth table NOR gate as AND gate**When two NOR gate output combine single NOR gate, then we can obtain AND gate.

**Thus, the NOR gate is a universal logic gate since it can be implemented the AND, OR and NOT logic gate.**