# Logic Gates

## Logic Gates

### Basics of Logic Gates

**Logic gates**are the fundamental building blocks of digital circuits.- They perform basic logical functions that are fundamental to digital circuits.
- The most common types of logic gates are
**AND**,**OR**,**NOT**,**NAND**,**NOR**,**XOR**and**XNOR**. - All other logic operations can be derived from these basic ones.

### AND Gate

- The
**AND**gate produces an output of**1**only if all its inputs are**1**. - Otherwise, the output is
**0**. - In other words, it performs the logical AND operation.

### OR Gate

- The
**OR**gate produces an output of**1**if any of its inputs are**1**. - Otherwise, the output is
**0**. - It performs the logical OR operation.

### NOT Gate

- The
**NOT**gate, also known as an**inverter**, produces the inverse of its input. - If the input is
**1**, the output is**0**, and if the input is**0**, the output is**1**. - It performs the logical NOT operation.

### NAND Gate

- The
**NAND**gate is a combination of an AND gate and a NOT gate. - It produces an output of
**0**only if all its inputs are**1**, otherwise the output is**1**. - It performs the logical NAND operation.

### NOR Gate

- The
**NOR**gate is a combination of an OR gate and a NOT gate. - It produces an output of
**1**only if all its inputs are**0**, otherwise the output is**0**. - It performs the logical NOR operation.

### XOR Gate

- The
**XOR**(exclusive OR) gate produces an output of**1**if an odd number of inputs are**1**, and**0**otherwise. - It performs the logical exclusive OR operation.

### XNOR Gate

- The
**XNOR**(exclusive NOR) gate is a combination of an XOR gate and a NOT gate. - It produces an output of
**1**if there is an even number of**1**’s in the input and**0**, otherwise. - It performs the logical exclusive NOR operation.

### Usage of Logic Gates

- Logic gates are used in a wide variety of digital systems from simple systems like basic calculators and digital clocks to complex ones like microprocessors and computer memory units.
- They form the basis for solving complex logical and mathematical problems in digital systems.

### De Morgan’s Theorem

**De Morgan’s theorem**presents a method for simplifying complex logic gates.- The first rule is that the negation of a conjunction is equal to the disjunction of the negations (
**NOT (A AND B) = (NOT A) OR (NOT B)**). - The second rule is that the negation of a disjunction is equal to the conjunction of the negations (
**NOT (A OR B) = (NOT A) AND (NOT B)**). - De Morgan’s theorem plays a crucial role in Boolean algebra which is foundational for digital circuit design.