The Wayback Machine - https://web.archive.org/web/20240828091657/https://www.geeksforgeeks.org/logic-gates/
Open In App

Logic Gates – Definition, Types, Uses

Last Updated : 03 May, 2024
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Logic gates are the fundamental components of all digital circuits and systems. In digital electronics, there are seven main types of logic gates used to perform various logical operations. A logic gate is basically an electronic circuit designed by using components like diodes, transistors, resistors, capacitors, etc., and capable of performing logical operations. In this article, we will study the definition, truth table, and other related concepts of logic gates. So let’s start with the basic introduction of logic gates.

What is a Logic Gate?

A logic gate is an electronic circuit designed by using electronic components like diodes, transistors, resistors, and more. As the name implies, a logic gate is designed to perform logical operations in digital systems like computers, communication systems, etc.

Therefore, we can say that the building blocks of a digital circuit are logic gates, which execute numerous logical operations that are required by any digital circuit. A logic gate can take two or more inputs but only produce one output. The output of a logic gate depends on the combination of inputs and the logical operation that the logic gate performs.

Logic gates use Boolean algebra to execute logical processes. Logic gates are found in nearly every digital gadget we use on a regular basis. Logic gates are used in the architecture of our telephones, laptops, tablets, and memory devices.

Types of Logic Gates

A logic gate is a digital gate that allows data to be manipulated. Logic gates, use logic to determine whether or not to pass a signal. Logic gates, on the other hand, govern the flow of information based on a set of rules.

The logic gates can be classified into the following major types:

1. Basic Logic Gates

There are three basic logic gates:

  1. AND Gate
  2. OR Gate
  3. NOT Gate

2. Universal Logic Gates

In digital electronics, the following two logic gates are considered as universal logic gates:

  1. NOR Gate
  2. NAND Gate

3. Derived Logic Gates

The following two are the derived logic gates used in digital systems:

  1. XOR Gate
  2. XNOR Gate

Let us now discuss each of these types of logic gates in detail one-by-one.

AND Gate

In digital electronics, the AND gate is one of the basic logic gate that performs the logical multiplication of inputs applied to it. It generates a high or logic 1 output, only when all the inputs applied to it are high or logic 1. Otherwise, the output of the AND gate is low or logic 0.

Properties of AND Gate:

The following are two main properties of the AND gate:

  • AND gate can accept two or more than two input values at a time.
  • When all of the inputs are logic 1, the output of this gate is logic 1.

The operation of an AND gate is described by a mathematical expression, which is called the Boolean expression of the AND gate.

For two-input AND gate, the Boolean expression is given by,

[Tex]Z = A.B [/Tex]

Where, A and B are inputs to the AND gate, while Z denotes the output of the AND gate.

We can extend this expression to any number of input variables, such as,

[Tex]Z=A.B.C.D… [/Tex]

Truth Table of AND Gate:

The truth table of a two input AND gate is given below:

Input

Output

A

B

A AND B

0

0

0

0

1

0

1

0

0

1

1

1

Symbol of AND Gate:

The logic symbol of a two input AND gate is shown in the following figure.

AND Gate Symbol

Symbol of Two-Input AND Gate

OR Gate

In digital electronics, there is a type of basic logic gate which produces a low or logic 0 output only when its all inputs are low or logic 0. For all other input combinations, the output of the OR gate is high or logic 1. This logic gate is termed as OR gate. An OR gate can be designed to have two or more inputs but only one output. The primary function of the OR gate is to perform the logical sum operation.

Properties of OR Gate:

An OR gate have the following two properties:

  • It can have two or more input lines at a time.
  • When all of the inputs to the OR gate are low or logic 0, the output of it is low or logic 0.

The operation of an OR gate can be mathematically described through a mathematical expression called Boolean expression of the OR gate.

The boolean expression for a two input OR gate is given by,

Z = A + B

The boolean expression for a three-input OR gate is,

Z = A + B + C

Here, A, B, and C are inputs and Z is the output variables. We can extend this boolean expression to any number of input variables.

Truth Table of OR Gate:

The truth table of an OR gate describes the relationship between inputs and output. The following is the truth table for the two-input OR gate:

Input

Output

A

B

A OR B

0

0

0

0

1

1

1

0

1

1

1

1

Symbol of OR Gate:

The logic symbol of a two-input OR gate is shown in the following figure.

OR Gate

Symbol of Two-Input OR Gate

NOT Gate

In digital electronics, the NOT gate is another basic logic gate used to perform compliment of an input signal applied to it. It takes only one input and one output. The output of the NOT gate is complement of the input applied to it. Therefore, if we apply a low or logic 0 output to the NOT gate is gives a high or logic 1 output and vice-versa. The NOT gate is also known as inverter, as it performs the inversion operation.

Properties of NOT Gate:

  • The output of a NOT gate is complement or inverse of the input applied to it.
  • NOT gate takes only one output.

The logical operation of the NOT gate is described by its boolean expression, which is given below.

[Tex]Z= \overline{A} [/Tex]

The bar over the input variable A represents the inversion operation.

Truth Table of OR Gate:

The truth table describes the relationship between input and output. The following is the truth table for the NOT gate:

Input 

Output

A

NOT A

0

1

1

0

Symbol of NOT Gate

The logic circuit symbol of a NOT gate is shown in the following figure. Here, A is the input line and Z is the output line.

Logic gates

Symbol of NOT the Gate

NOR Gate

The NOR gate is a type of universal logic gate that can take two or more inputs but one output. It is basically a combination of two basic logic gates i.e., OR gate and NOT gate. Thus, it can be expressed as,

NOR Gate = OR Gate + NOT Gate

In other words, a NOR gate is an OR gate followed by a NOT gate.

Properties of NOR Gate:

The following are two important properties of NOR gate:

  • A NOR gate can have two or more inputs and gives an output.
  • A NOR gate gives a high or logic 1 output only when its all inputs are low or logic 0.

Similar to basic logic gates, we can describe the operation of a NOR gate using a mathematical equation called boolean expression of the NOR gate.

The boolean expression of a two input NOR gate is given below:

[Tex]C=\overline{A+B} [/Tex]

We can extend this expression to any number of input variables.

In the above boolean expressions, the variables A and B are called input variables while the variable C is called the output variable.

Truth Table of NOR Gate:

The following is the truth table of a two-input NOR gate showing the relationship between its inputs and output:

Input

Output

A

B

A NOR B

0

0

1

0

1

0

1

0

0

1

1

0

NOR Gate Symbol

Symbol of the NOR Gate

NAND Gate

In digital electronics, the NAND gate is another type of universal logic gate used to perform logical operations. The NAND gate performs the inverted operation of the AND gate. Similar to NOR gate, the NAND gate can also have two or more input lines but only one output line.

The NAND gate is also represented as a combination of two basic logic gates namely, AND gate and NOT gate. Hence, it can be expressed as

NAND Gate = AND Gate + NOT Gate

Properties of NAND Gate:

The following are the two key properties of NAND gate:

  • NAND gate can take two or more inputs at a time and produces one output based on the combination of inputs applied.
  • NAND gate produces a low or logic 0 output only when its all inputs are high or logic 1.

We can describe the expression of NAND gate through a mathematical equation called its boolean expression. Here is the boolean expression of a two input NAND gate.

[Tex]C=\overline{AB} [/Tex]

In this expression, A and B are the input variables and C is the output variable. We can extend this relation to any number of input variables like three, four, or more.

Truth Table of NAND Gate:

The truth table is a table of inputs and output that describes the operation of the NAND gate and shows the logical relationship between them:

Input

Output

A

B

A NAND B

0

0

1

0

1

1

1

0

1

1

1

0

Symbol of NAND Gate:

The logic symbol of a NAND gate is represented as a AND gate with a bubble on its output end as depicted in the following figure. It is the symbol of a two-input NAND gate.

NAND Gate Symbol

Symbol of NAND Gate

XOR Gate

In digital electronics, there is a specially designed logic gate named, XOR gate, which is used in digital circuits to perform modulo sum. It is also referred to as Exclusive OR gate or Ex-OR gate. The XOR gate can take only two inputs at a time and give an output. The output of the XOR gate is high or logic 1 only when its two inputs are dissimilar.

Properties of XOR Gate:

The following two are the main properties of the XOR gate:

  • It can accept only two inputs at a time. There is nothing like a three or more input XOR gate.
  • The output of the XOR gate is logic 1 or high, when its inputs are dissimilar.

The operation of the XOR gate can be described through a mathematical equation called its boolean expression. The following is the boolean expression for the output of the XOR gate.

[Tex]Z=A \oplus B [/Tex]

Here, Z is the output variable, and A and B are the input variables.

This expression can also be written as follows:

[Tex]Z=A \overline{B}+\overline{A}B [/Tex]

Truth Table of XOR Gate:

The truth table is a table of inputs and output that describe the relationship between them and the operation of the XOR gate for different input combinations. The truth table of the XOR gate is given below:

Input

Output

A

B

A XOR B

0

0

0

0

1

1

1

0

1

1

1

0

Symbol of XOR Gate:

The logic symbol of an XOR gate is shown in the following figure.

XNOR Gate

Symbol of XOR Gate

XNOR Gate

The XNOR gate is another type of special purpose logic gate used to implement exclusive operation in digital circuits. It is used to implement the Exclusive NOR operation in digital circuits. It is also called the Ex-NOR or Exclusive NOR gate. It is a combination of two logic gates namely, XOR gate and NOT gate. Thus, it can be expressed as,

XNOR Gate = XOR Gate + NOT Gate

The output of an XNOR gate is high or logic 1 when its both inputs are similar. Otherwise the output is low or logic 0. Hence, the XNOR gate is used as a similarity detector circuit.

Properties of XNOR Gate:

The following are two key properties of XNOR gate:

  • XNOR gate takes only two inputs and produces one output.
  • The output of the XNOR gate is high or logic 1 only when it has similar inputs.

The operation of XNOR gate can be described through a mathematical equation called the boolean expression of XNOR gate. Here is the boolean expression of the XNOR gate.

[Tex]Y=A \odot B [/Tex]

We can also write this expression as follows:

[Tex]Y=AB + \overline{A} \overline{B} [/Tex]

Here, the A and B are inputs and Y is the output.

Truth Table of XNOR Gate:

The truth table of the XNOR gate is given below. This truth table is describing the relationship between inputs and output of the XNOR gate.

Input

Output

A

B

A XNOR B

0

0

1

0

1

0

1

0

0

1

1

1

Symbol of XNOR Gate:

The logic symbol of XNOR gate is shown in the following figure. Here, A and B are inputs and Y is the output.

LOGIC Gate

Symbol of XNOR gate

Applications of Logic Gates

Logic gates are the fundamental building blocks of all digital circuits and devices like computers. Here are some key digital devices in which logic gates are utilized to design their circuits:

  • Computers
  • Microprocessors
  • Microcontrollers
  • Digital and smart watches
  • Smartphones, etc.

Based on Logic Gates – FAQs

What are Logic gates?

Logic gates are digital circuits that conduct logical operations on the input provided to them and produce appropriate output.

What are Universal gates?

To accomplish a specific logical process, universal gates are created by merging two or more fundamental gates. Universal gates are NAND and NOR gates.

What is the output of a NOT gate when input 0 is applied?

Because NOT gate is an inverter. As a result, if 0 is used as an input, the output will be 1.

Which logic gate is known as the “invertor”?

An invertor is also known as a NOT gate. The obtained output is the inverse of the input.

What is the Boolean expression for OR gate?

If A and B are the input, then the OR gate output can be given as Y=A+B.

What is the Boolean expression for the XNOR gate?

If A and B are the input, then the XNOR gate output can be given as Y=A.B+A’B’.



Previous Article
Next Article

Similar Reads

What are Bases? - Definition, Examples, Types, Properties and Uses
Base is a chemical compound that consists of OH- ions and accepts protons. Base in Chemistry are those compounds that turn red litmus blue and when reacted with acid they neutralize the reaction to give salt and water. The pH value of the base is greater than 7. Bases are bitter in taste and slippery in touch. The bases which are soluble in water a
10 min read
Mobile Technologies - Definition, Types, Uses, Advantages
Mobile technology is a type of technology in which a user utilizes a mobile phone to perform communications-related tasks, such as communicating with friends, relatives, and others. It is used to send data from one system to another. Portable two-way communications systems, computing devices, and accompanying networking equipment make up mobile tec
10 min read
Cursors in DBMS - Definition, Types, Attributes, Uses
Database Management System(DBMS) supports Data Manipulation Language statements like Insert, Update and Delete queries. Each database syntactically differs but the functionality remains the same in the mentioned operations. In this article, let us see about performing insert, update and delete queries using the cursor. Cursors Whenever DML statemen
5 min read
Cleansing Agents - Definition, Types, Properties, Uses
In everyday life, chemistry plays a significant role. The most basic needs - shelter, food, clothing, and medicines - are all chemical substances. Organic, analytical, physical, inorganic, and biological aspects are all important in pharmaceutical chemistry. Chemistry has an impact on every part of the lives, both directly and indirectly. From the
11 min read
What is Fertilizer? - Example, Definition, Types, and Uses
Fertilizers are chemicals that are applied to soil or to plants to supply essential plant nutrients. The fertilizers contain nitrogen, potassium, and phosphorus, all of which are essential nutrients for plants. There are two types of fertilizers: Organic fertilizer is derived from plants and animals and Inorganic fertilizer is derived from chemical
8 min read
Equation in Maths | Definition , Types, Uses and Examples
Equations in Maths are statements that equates two terms involving variables and constants. Equations are a form of statement that shows that the two expressions are equal. There are various types of equations - Linear, Quadratic, Polynomial, Logarithmic, Trigonometric as well as some other shape equations like equations of Line, Circle, Ellipse, P
15+ min read
What is Internet? Definition, Uses, Working, Advantages and Disadvantages
Pre-Requisite: Introduction to Internet The Internet is the foremost important tool and the prominent resource that is being used by almost every person across the globe. It connects millions of computers, webpages, websites, and servers. Using the internet we can send emails, photos, videos, and messages to our loved ones. Or in other words, the I
12 min read
Carbon Resistors - Definition, Working, Uses, Advantages
Resistor definition indicates that it is a basic component found in all electrical gadgets. The resistor is a two-terminal passive electrical component. According to its definition, the resistor is used to limit the passage of electric current in a circuit. Let's take a closer look at what a carbon resistor is, its components, and its applications
7 min read
Alloys - Definition, Composition, Properties and Uses
A substance created from the mixing of two or more metals is referred to as an alloy. Combinations of metals and other elements can also be used to create alloys. The properties of alloys are frequently dissimilar to the qualities of their constituent components. When compared to pure metals, alloys frequently have greater strength and hardness. Re
8 min read
Properties of Acids - Definition, Examples, Properties, Uses
Acids have a corrosive effect. When we cook acidic foods in brass or copper utensils, the metal reacts and corrodes. When copper reacts with acid, it creates copper salt. Copper salts are toxic and taint the flavour of cooked food. This is why we don't keep liquid foods in metallic containers. Tea should also be served in copper mugs. Tin, a brilli
6 min read
What is Gold? - Definition, Properties, Uses and Applications
Gold is frequently found in its free elemental form, as nuggets or grains, in rocks, veins, and alluvial deposits. It can be found in a solid solution series with silver, naturally alloyed with other metals like copper and palladium, and as mineral inclusions like pyrite. Gold is a chemical element with the symbol Au and the atomic number 79, makin
6 min read
What is Sodium Chloride? - Definition, Preparation, Properties, Uses
Salt's chemical name is sodium chloride. Sodium is an electrolyte that regulates your body's water content. Sodium is also involved in nerve impulses and muscle contractions. Sodium chloride is a medication used to treat or prevent sodium loss caused by dehydration, excessive sweating, or other factors. What is Sodium Chloride (or Common Salt)? It
6 min read
p-Block Elements - Definition, Properties, Uses, Examples
Some metals, all nonmetals, and metalloids are among these elements. Normal or representative elements are s-block and p-block elements combined (except zero group elements). Each periodic table period concludes with a member of the zero group (18th group), i.e. a noble gas with a closed shell ns2np6 configuration. Prior to the noble gas group, the
7 min read
What is Copper? - Definition, Occurrence, Properties, Uses
Copper(II) salts are commonly encountered compounds that often impart blue or green colours to minerals such as azurite, malachite, and turquoise and have been widely and historically used as pigments. Copper used in construction, typically for roofing, oxidises to form green verdigris. Copper compounds are used to make bacteriostatic agents, fungi
6 min read
Dinitrogen - Definition, Preparation, Properties, Uses
Nitrogen is the lightest element in Periodic Table Group 15, also known as the pnictogens. Dinitrogen, a colourless and odourless diatomic gas with the formula N2, is formed when two atoms of the element join together at STP. Dinitrogen is the most abundant uncombined element, accounting for around 78% of the Earth's atmosphere. Nitrogen is found i
6 min read
Dioxygen - Definition, Properties, Preparation, Uses
Oxygen is a member of the periodic table's chalcogen group, a highly reactive nonmetal, and an oxidizing agent that readily forms oxides with most elements and other compounds. Oxygen is the most abundant element on Earth, and it is the third-most abundant element in the universe after hydrogen and helium. Diatomic oxygen gas now accounts for 20.95
5 min read
Dihydrogen as Fuel - Definition, Uses, Examples
Hydrogen is the first element on the modern periodic table. It has the simplest atomic structure as compared to all other elements. In atomic form, it has one proton and one electron. On the other hand, in elemental form, it exists as a diatomic (H2) molecule called dihydrogen. If Hydrogen loses its one electron, it will become an elementary partic
7 min read
Hydrogen Chloride - Definition, Preparation, Properties, Uses
As a hydrogen halide, the compound hydrogen chloride has the chemical formula HCl. It is a colourless gas at ambient temperature that emits white fumes of hydrochloric acid when it comes into contact with air-water vapour. In technology and industry, hydrogen chloride gas and hydrochloric acid are critical. Hydrochloric acid, an aqueous solution of
7 min read
Actinides - Definition, Properties, Formation, Uses
The d and f block mainly contains elements that include groups 3-12. The f block has elements in which 4f and 5f are progressively filled. These elements are placed below the periodic table in a separate table. The d and f block elements are majorly known as transition or inner transition elements. Actinides Actinides are elements with atomic numbe
9 min read
Polyhalogen Compounds - Definition, Properties, Uses
Hydrocarbons having one or more hydrogen atoms substituted by halogen atoms are known as haloalkanes and haloarenes. Haloalkanes and haloarenes are distinguished by the fact that haloalkanes are formed from open-chain hydrocarbons (alkanes), whereas haloarenes are derived from aromatic hydrocarbons. Polyhalogen Compounds Polyhalogen compounds are c
9 min read
What is Bandwidth? Definition, Working, Importance, Uses
Pre-Requisite: Introduction to Bandwidth Network bandwidth is the maximum capacity of a wired or wireless communications link to deliver data via a network connection in a given amount of time. Bandwidth is typically defined as the number of bits, kilobits, megabits, or gigabits that may be sent in one second. Bandwidth and capacity are terms that
8 min read
What is Pilot Survey? - Definition, Importance, Uses
The pilot survey refers to a sample survey that is conducted to know whether our questionnaire prepared is understandable or not. Some important advantages of a pilot survey include questions being tested, problems that can arise from the large survey can be guessed and solutions can be found, and some aspects of the data being estimated. A pilot s
6 min read
Fungi - Definition, Characteristics, Classification, Uses
Variety in living organic entities should be visible wherever on the planet. The locale of the earth is profoundly assorted and is known as the district of super biodiversity. Twelve nations on the planet have the greater part of the biodiversity on the planet. India is additionally one of them. There are various living creatures on earth of variou
7 min read
Pteridophyta - Definition, Characteristics, Classification, Uses
Pteridophyta is a division of the kingdom Plantae that consists of plants that dominated the planet before the evolutionary appearance of seed-producing plants. Pteridophytes lack both flower and seed and reproduce mainly with the help of spores. Pteridophytes are the first group of plants that have evolved to show the vascular system. The Plant Ki
7 min read
Electroplating | Definition, Principle, Process And Uses
Electroplating refers to the process of coating a metal onto another metal or alloy with the help of an electric current. It is also known as electrochemical deposition or electrodeposition. Let's learn the electroplating process in detail, including its working principle, advantages, examples and uses. Table of Content What is Electroplating?Setup
6 min read
Brewster's Law - Definition, Formula, Derivation, Example, Uses
Brewster's Law states that when unpolarized light strikes a surface at a specific angle (Brewster angle), the reflected light becomes polarized perpendicular to the plane of incidence. According to Brewster Law of polarization, the refractive index of a medium is equal to the tangent of the polarizing angle. This law finds applications in making po
8 min read
Commutator - Definition, Construction, Working, Uses
A commutator is an essential component in electric motors, generators, and dynamometers. Its primary function is to reverse the direction of current flow in the windings of the machine. This ensures continuous rotation in one direction in motors and converts alternating current (AC) to direct current (DC) in generators. As the armature rotates with
12 min read
Synecdoche - Meaning, Definition, Uses & Examples
Synecdoche: English language like other languages is interesting in its unique manner. Learning its grammar & vocabulary along with finding out ways to make the language rich & polished is a very fulfilling process. Figures of speech are one of the most interesting topics. One of the figures of speech that we often use in our daily lives is
9 min read
Gymnosperms - Definition, Characteristics, Uses and Examples
Gymnosperms are a group of seed-bearing plants that do not produce flowers or fruits. Gymnosperms are not surrounded by fruit. They are believed to have first appeared during the Carboniferous period and became the dominant land plants during the Mesozoic era. In this article, we will cover gymnosperm notes, their classification, characteristics, a
7 min read
Alum - Formula, Types, Production, Properties, Uses
Alum is an important inorganic compound which are double sulfates of a monovalent metal (such as potassium, sodium, or ammonium) and a trivalent metal (such as aluminum, chromium, or iron). Alum is widely used in industries as well as medical purposes. It has antiseptic property and is used after shave. It is often called "Fitkari." In this article
6 min read