2. • Binary variables take on one of two values(0,1).
• Logical operators operate on binary values and binary variables.
• Basic logical operators are the logic functions AND, OR and NOT.
• Manipulation on binary information is done through logic circuits=Logic
Gates
– Logic gates implement logic functions.
– Gates are blocks of hardware that produce signals of 1
or 0 when input logic requirements are satisfied.
• The relationship between the input and output is based on a certain
logic, hence the term= Logic Gates
• Boolean Algebra: a useful mathematical system for specifying and
transforming logic functions.
– Boolean algebra as a foundation for designing and
analyzing digital systems!
BCA-III/CAO Dr. Ramandeep Kaur
3. • The three basic logical operations are:
– AND
– OR
– NOT
• AND is denoted by a dot (·) or a
concatenation.
• OR is denoted by a plus (+).
• NOT is denoted by an overbar ( ¯ ), a
single quote mark (') after, or (~) before
the variable.
BCA-III/CAO Dr.
Boolean Algebra and Logic Gates 3
4. • Examples:
is read “Y is equal to A AND B.”
is read “y is equal to A OR B.”
is read “Y is equal to NOT A.”
BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 4
Here, Y is an output function, A & B are binary variables
Note: The statement:
1 + 1 = 2 (read “one plus one equals two”)
is not the same as
1 + 1 = 1 (read “1 or 1 equals 1”).
= B
A
Y ×
B
A
Y +
=
A
Y =
5. • Logic gates have special symbols:
BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 5
OR gate
X
Y
Z = X + Y
X
Y
Z = X ·Y
AND gate
X Z = X
NOT gate or
inverter
9. • Tabular representation of Input-output relationship of binary
variables for each gate is = Truth Table
• Example: Truth tables for the basic logic operations, where
Z is the output function, with x,y as input variables:
BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 9
0
1
1
0
X
NOT
X
Z=
1
1
1
0
0
1
0
1
0
0
0
0
Z = X·Y
Y
X
AND OR
X Y Z = X+Y
0 0 0
0 1 1
1 0 1
1 1 1
11. • Boolean equations, truth tables and logic diagrams describe the
same function!
• Truth tables are unique, but expressions and logic diagrams are
not. This gives flexibility in implementing functions.
BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 11
X
Y F
Z
Logic Diagram
Logic Equation
Z
Y
X
F +
=
Truth Table
1
1 1 1
1
1 1 0
1
1 0 1
1
1 0 0
0
0 1 1
0
0 1 0
1
0 0 1
0
0 0 0
X Y Z Z
Y
X
F ×
+
=
12. BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 12
•Obtain the Truth Table of the above function
•Draw the logic diagram using Boolean expression
13. NAND (NOT - AND ) is the complement of
the AND operation.
13
Computer Organization MCA 107 by Ruby Dahiya
14. NOR (NOT - OR) is the complement of the
OR operation.
14
Computer Organization MCA 107 by Ruby Dahiya
15. • Writing XOR using and/or/not
• x y = x y+x y
BCA-III/CAO Dr. Ramandeep Kaur
15
x y xy
1 1 0
1 0 1
0 1 1
0 0 0
_
_
• eXclusive OR) A Boolean logic operation that
is widely used in cryptography as well as in
generating parity bits for error checking and
fault tolerance.
• XOR compares two input bits and generates
one output bit. The logic is simple.
• If the bits are the same, the result is 0. If the
bits are different, the result is 1.
Example: Buzzer
Game
16. BCA-III/CAO Dr. Ramandeep Kaur
16
x y xy
1 1 1
1 0 0
0 1 0
0 0 1
x o y = xy + x y
Example
For example, a hallway that has two
light switches.
If both light switches are in the same
position, the lights will be off.
17. BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 17
1.
3.
5.
7.
9.
11.
13.
15.
17.
Commutative
Associative
Distributive
DeMorgan
’s
2.
4.
6.
8.
X . 1 X
=
X . 0 0
=
X . X X
=
0
=
X . X
10.
12.
14.
16.
X + Y Y + X
=
(X + Y) Z
+ X + (Y Z)
+
=
X(Y + Z) XY XZ
+
=
X + Y X . Y
=
XY YX
=
(XY)Z X(YZ)
=
X + YZ (X + Y)(X + Z)
=
X . Y X + Y
=
X + 0 X
=
+
X 1 1
=
X + X X
=
1
=
X + X
X = X
Invented by George Boole in 1854
An algebraic structure defined by a set B = {0, 1}, together with two
binary operators (+ and ·) and a unary operator ( )
Idempotence
Complement
Involution
Identity element
18. BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 18
Boolean Algebra is defined in general by a set B that can
have more than two values
A two-valued Boolean algebra is also know as Switching
Algebra. The Boolean set B is restricted to 0 and 1.
Switching circuits can be represented by this algebra.
The dual of an algebraic expression is obtained by
interchanging + and · and interchanging 0’s and 1’s.
The identities appear in dual pairs. When there is only one
identity on a line the identity is self-dual, i.e., the dual
expression = the original expression.
Sometimes, the dot symbol ‘’ (AND operator) is not written
when the meaning is clear
19. BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 19
The order of evaluation is:
1. Parentheses
2. NOT
3. AND
4. OR
Consequence: Parentheses appear
around OR expressions
Example: F = A(B + C)(C + D)
20. • A + A · B = A (Absorption Theorem)
Proof Steps Justification
A + A · B
= A · 1 + A · B Identity element: A · 1 = A
= A · ( 1 + B) Distributive
= A · 1 1 + B = 1
= A Identity element
BCA-III/CAO Dr. Ramandeep Kaur
Boolean Algebra and Logic Gates 20