You are on page 1of 31

BOOLEAN

LOGIC
By:
Kanika Ahluwalia
BIG Q: WHY DO WE NEED
BOOLEAN ALGEBRA WHEN
WE ALREADY HAVE
MATHEMATICS ALGEBRA?
• DESCRIBE WHAT A TRUTH TABLE IS
• DESCRIBE VARIOUS LOGICAL OPERATIONS
• EVALUATE BOOLEAN EXPRESSIONS USING
TRUTH TABLES
• DESCRIBE WHAT IS A LOGIC GATE AND
DIFFERENTIATE BETWEEN VARIOUS LOGIC
GATES.
BOOLEAN ALGEBRA
 In mathematics and mathematical logic, Boolean algebra is the branch
of algebra in which the values of the variables are the truth
values true and false, usually denoted 1 and 0 respectively.
 Whereas in elementary algebra expressions denote mainly numbers, in
Boolean algebra they denote the truth values false and true. These values are
represented with the bits (or binary digits), namely 0 and 1
 Boolean algebra was introduced by George Boole in his first book The
Mathematical Analysis of Logic (1847), and set forth more fully in his An
Investigation of the Laws of Thought (1854)
 In computing, logical operations are
necessary because they model the way
that information flows through
LOGIC electrical circuits, such as those inside
a CPU. These types of operations are
OPERATION called boolean operations.

S
 The elements in a circuit which behave
according to Boolean logic are
called logic gates.
WHAT IS A TRUTH TABLE?
 Boolean Algebra Truth Tables are used to represent the boolean
expression of a logic gate function is commonly called a Truth
Table. A logic gate truth table shows each possible input
combination to the gate or circuit with the resultant output
depending upon the combination of these input(s).
FUNDAMENTAL
LOGIC OPERATIONS
 The following seven logic operations take inputs that are either true (1) or false (0) and produce a
single output value that is also true or false.
 Most of these operations can take more than two inputs, except for the NOT operation which takes
only one input.
 AND

 OR
 NOT

 NAND
 NOR

 XOR
 XNOR
 The AND logic operation returns true only if both of its
inputs are true. If either of the inputs is false, the output
is also false.
 In computer programming, the AND operation is
usually written as && (two ampersands).
AND GATE  In Boolean algebra, the AND operation of two inputs A
and B can be written as AB.
 Here is the truth table for an AND operation, and the
circuit diagram of an AND logic gate.
AND GATE

AND

A B A.B

0 0 0

1 0 0

0 1 0

1 1 1
OR GATE
 The OR logic operation returns true if either of its inputs are true. If all inputs
are false, the output is also false.
 In computer programming, the OR operation is usually written
as || (two vertical bars).
 In Boolean algebra, the OR value of two inputs A and B can be written
as A+B.

 Do not mistake the OR operation for arithmetic addition, even though they


both use the "+" symbol. They are distinct operations.
OR GATE
OR

A B A+B

0 0 0

1 0 1

0 1 1

1 1 1
Q1: What are truth values?
NOTEBOOK Q2: What do you mean by logic
operations and logic gates?
WORK Q3:What is a truth table ? What is its
27.07.21 significance?
NOT GATE
 The NOT logic operation returns true if its input is false, and false if its input is true.
 In computer programming, the NOT operation is usually written as ! (an exclamation mark).
 In Boolean algebra, the NOT value of an input A can be written as A̅ (A with an overscore).

NOT

A A̅

0 1

1 0
OR LOGIC OPERATION
 The Boolean operator “OR” is used to
express that as long as one of two or
more conditions are, met the value of
a specified query is true.
AN EXAMPLE  For example, to build an audience
OF BOOLEAN which encompasses anyone who
LOGIC AT WORK
enjoys Mexican, Chinese, or French
IN BUILDING
AUDIENCES : Cuisine, the following audience
OR definition would apply:
 Using the “OR” operator would ensure
that anyone who has shown an
affinity for at least one of these
cuisines will be included in the
audience created.
AND LOGIC OPERATION
As a Boolean operator, “AND” serves to indicate that ALL
specified conditions must be met in order for a query to return true.

AN EXAMPLE In the event that a client were building an audience and wanted to


OF BOOLEAN target only users who had shown an affinity for Sports
LOGIC AT WORK Cars and Fishing and History
IN BUILDING
AUDIENCES : AND

The use of the “AND” operator means that a user must meet ALL
of the specified criteria to be included in the audience; users who
merely like Fishing or like only Fishing and History (etc.) will be
excluded from this audience definition.
NOT LOGIC OPERATION
AN EXAMPLE OF BOOLEAN LOGIC AT WORK IN
BUILDING AUDIENCES : NOT<
 The “NOT” Boolean operator is used to exclude nodes from an audience definition. As it
applies to the creation of an audience definition, “NOT” will exclude all users falling under
the node which has been prepended by “NOT.”
 For example, to create an audience of users over the age of 18 (NOT 13-17 years of age) with
a demonstrated interest in travelling
 n this instance, the “NOT” which prepends 13-17 means that no users within this age range
will be included in this audience definition. It is also worth noting that the “AND” operator is
used here as well. Translated into plain English, this definition would be read as “Users who
are not between ages 13 and 17 who have an interest in travelling
BOOLEAN LOGIC
ILLUSTRATED WITH THE
HELP OF SETS
THREE INPUT OR GATE
THREE INPUT AND GATE
NOR GATE
 NOR gate is a digital circuit that has two or more inputs and produces an
output, which is the inversion of logical OR of all those inputs.
 The following table shows the truth table of 2-input NOR gate

A B Y = (A+B)’

0 0 1

0 1 0

1 0 0

1 1 0
NOR GATE
 Here A, B are the inputs and Y is the output. If both inputs are ‘0’, then the output, Y is ‘1’. If
at least one of the input is ‘1’, then the output, Y is ‘0’. This is just opposite to that of two
input OR gate operation.
 The following figure shows the symbol of NOR gate, which is having two inputs A, B and one
output, Y.
 NOR gate operation is same as that of OR gate followed by an inverter. That’s why the NOR
gate symbol is represented like that.
NAND GATE
 The NAND logic operation (which stands for "NOT AND") returns true if
either of its inputs are false, and false if either of its inputs are true.

 In Boolean algebra, the NAND value of two inputs A and B can be written
as  (AB with an overscore).
 NAND has the distinction of being one of two "universal" logic gates because
any other logic operation can be created using only NAND gates. (The other
universal logic gate is NOR.)
NAND GATE
NAND

___
A B AB

0 0 1

1 0 1

0 1 1

1 1 0
UNIVERSAL GATES

NAND & NOR gates are called as universal gates. Because we can implement any Boolean
function, which is in sum of products form by using NAND gates alone. Similarly, we can
implement any Boolean function, which is in product of sums form by using NOR gates alone.
SPECIAL GATES
Ex-OR & Ex-NOR gates are called as special gates. Because, these
two gates are special cases of OR & NOR gates.
Ex-OR gate
The full form of Ex-OR gate is Exclusive-OR gate. Its function is same as that
of OR gate except for some cases, when the inputs having even number of
ones.
The following table shows the truth table of 2-input Ex-OR gate.

A B Y = A⊕B
0 0 0
0 1 1
1 0 1
1 1 0

The output of Ex-OR gate is ‘1’, when odd number of ones present at the inputs. Hence, the
output of Ex-OR gate is also called as an odd function.
 Ex-NOR gate
 The full form of Ex-NOR gate is Exclusive-NOR gate. Its function is same as that of NOR
gate except for some cases, when the inputs having even number of ones.
 The following table shows the truth table of 2-input Ex-NOR gate.

A B Y = A⊙B
0 0 1
0 1 0
1 0 0
1 1 1

The output of Ex-NOR gate is ‘1’, when even number of ones present at the inputs.
Hence, the output of Ex-NOR gate is also called as an even function.
NOTEBOOK WORK
Q 1: Draw  the truth tables and symbolic representation of NOR, NAND, XOR and XNOR
gates.
Q 2: Why NAND & NOR gates are also known as universal gates?
 Q 8,10,15,17 of the text book.

You might also like