Logic Gates | Brilliant Math & Science Wiki (2024)

Logic gates are devices that implement Boolean functions, i.e. it does a logic operation on one or more bits of input and gives a bit as an output. They are the basic building blocks of any digital system. It is an electronic circuit having one or more inputs and only one output. The relationship between the input and output is based on a certain logic. Hence logic gates are named as AND gate, OR gate, NOT gate, etc.

Boolean functions are of interest to logicians, philosophers, computer scientists, programmers, electronic engineers and linguists alike. They are the basis of today's computing technology.

Contents

  • Truth Tables
  • Primary Logic Gates
  • Universal Logic Gates
  • Derived Logic Gates
  • Implementation in Digital Circuits
  • Additional Problems

Truth Tables

Truth tables are basically a way to define Boolean functions exhaustively. They consist of rows of all possible permutations of input bits along with their corresponding values of functions.

How many \(n\)-ary boolean functions exist?

The size of the domain of an \(n\)-ary Boolean function would be \(2^n\).
This means that we would have \(2^n\) rows in our truth tables.

Since there are 2 ways to fill in the outputs of each of the \(2^n\) possible inputs, we have a total of \(2^{2^n}\) possible functions. \(_\square\)

Primary Logic Gates

There are three primary logic gates: AND, OR and NOT. All other logic gates could be represented as a combination of these.

\[\]AND
Truth Table

aba AND b
000
010
100
111

Symbol Logic Gates | Brilliant Math & Science Wiki (1)

\[\] \[\]OR
Truth Table

aba OR b
000
011
101
111

Symbol Logic Gates | Brilliant Math & Science Wiki (2)

\[\] \[\]NOT
Truth Table

aNOT a
01
10

Symbol Logic Gates | Brilliant Math & Science Wiki (3) \[\]

Universal Logic Gates

Though all logic gates can be designed by primary logic gates, but NAND or NOR alone can be implemented to design all primary logic gates. Thus, these are called universal logic gates.

\[\]NAND

A NAND B = NOT (A AND B)

Truth Table

aba NAND b
001
011
101
110

Symbol Logic Gates | Brilliant Math & Science Wiki (4)

\[\] \[\]NOR

A NOR B = NOT (A OR B)

Truth Table

aba NOR b
001
010
100
110

Symbol Logic Gates | Brilliant Math & Science Wiki (5) \[\]

Derived Logic Gates

Derived logic gates are formed from the combination of two or more of the primary logic gates. We'll discuss some important derived logic gates here.

\[\]XOR

A XOR B = (A OR B) AND (NOT (A AND B))

Intutively, XOR is exclusive OR, i.e, A OR B but not both.

Truth Table

aba XOR b
000
011
101
110

Symbol Logic Gates | Brilliant Math & Science Wiki (6)

\[\] \[\]XNOR

A XNOR B = NOT (A XOR B) = (A AND B) OR (NOT (A) AND NOT (B))

Truth Table

aba XNOR b
001
010
100
111

Symbol Logic Gates | Brilliant Math & Science Wiki (7) \[\]

Implementation in Digital Circuits

Logic gates are built using different combinations of transistors, which are basically electrically controlled switches. There are two types of transistors: PNP and NPN. We will be using the latter in the following examples:

Logic Gates | Brilliant Math & Science Wiki (8)

An NPN transistor allows a main current to flow from its input - called 'collector' - to its output - called 'emitter' - when a small current is applied to the 'base'. This corresponds to a closed switch, and the logical state '1'.When no current is applied to the base, the transistor does not allow current to flow from the collector to the emitter anymore. This corresponds to an open switch, and the logical state '0'.

\[\]

AND

Logic Gates | Brilliant Math & Science Wiki (9)

When a current is applied to the base of both transistors (i.e. when \(a = 1\) \(AND\) \(b = 1\)), the main current is free to flow from the top collector of transistor 'a' all the way to the bottom emitter of transistor 'b'.If only one of the two bases is 'on', the main current will be blocked when reaching the transistor in the 'off' state, and will not be able to flow. Obviously, if both transistors are 'off', no current will be flowing either.

\[\]

OR

Logic Gates | Brilliant Math & Science Wiki (10)

When a small current is applied to either of the two transistors - or, even better, both of them - the main current is free to flow from the top to the bottom of the circuit.Only when both transistors are in the 'off' state, no current will be flowing.

\[\]

NOT

Logic Gates | Brilliant Math & Science Wiki (11)

This particular gate can be done even with one single transistor.When no current is applied to the base of the transmitter (i.e. \(a = 0\)), the main current won't be able to flow through the transistor, and its only way out will be to go through the wire \( \overline{a}\); thus \( \overline{a} = 1\).On the other hand, when a small current is applied to the base of the transistor (\(a = 1)\), all the main current will flow through it, and no current will go to wire \( \overline{a}\); thus \( \overline{a} = 0\).

Note: While the AND and the OR gate shown are pretty straightforward when building an actual circuit, a NOT gate requires some additional components to ensure proper working conditions. Nonetheless, the basic concept behind it stays the same.

Additional Problems

The combination of various logic gates are really important in digital electronics as they are the basis of all arithmetic operations in digital computers.

Logic gates can be used in many fun questions on Brilliant! See one for yourself:

C = A XOR B C = A NOR B C = A AND B C = A OR B

Logic Gates | Brilliant Math & Science Wiki (12) Which of the following functions is implemented by the above schematic?

Logic Gates | Brilliant Math & Science Wiki (2024)

References

Top Articles
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated:

Views: 5807

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.