0% found this document useful (0 votes)
10 views

Boolean Logic

Uploaded by

Ashwaaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Boolean Logic

Uploaded by

Ashwaaa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

BY ER NIKH IL SIi

/4 s- 0
-

Boolean
L:ogic

3 1 Development of Boolean Loglc 3.; Basic Theorems of Boolean Algebra Logic

3.2 Bina,y Valued Quan1Jt1es 3.6 DeMorgan's Theorems


3 3 Logical Operations 3.9 More About Logic Gates
34 Basic Logic Gates
3 s Basic Postulates of Boolean Logic
3.G Principle of Duality

3.1 DEVELOPMENT OF BOOLEAN LOGIC

Long ago Aristotle construct ed a complete system of formal logic and wrote six famous works
on the subject, contribut ing greatly to the organizat ion of man's reasoning . For centuries
aftem•ard , mathema ticians kept on trying to solve these logic problems using conventio nal
algebra but only Grorgt· Boolt• could manipula te these symbols successfully to arrive al a
solution wiU, his O\-m mr1thcmatical system o( logic. Boole's revolutio nary paper 'An
luvcstigntio11 of tlie Imus of tlie ll1C11tgl1t' was published in 1854 which led to the developm ent of
new system, the trlgcbrn uf logic, ' BOOLEA N ALGEBRA' or ' BOOLEAN LOGIC'.
Boole's work remained confined to papers only until 1938 w hen Cln11de E. Shmmo,r wrote a
paper titled 'A Symllolic A11nlysis of Relay Switching Circuits'. 1n this paper he a pplied Boolean
Logic to solve relay logic problems . As logic problems are binary decisions and Boolean logic
effectively deals with these binary values. Thus it is also called 'Switcl1i11g Algebra'.

,I Wl ]
- SY ER NIKHJL SIR

COMPUTER SCIENCE WrTH PYTHON - XI


50

3.2 Rl~ARY VALUED QUJ\NTl1 l[S


· · · "Shou Id I carry the book or no. t ?"
• "Should
. 1 use
E,•eryd ay we have to m ake logic dec1s1ons :
cilculator or not?"; "Should I mi!'-S TV Programme or not?". Ead1 of these question,; requires n YES
or NO answer ns there are only lhl•sc two possible ans wers.
TI,crcforc. each ot the ,,l~w mentio,w d i~ a bin.iry decision. The decision which resulls Into
eflhor YES (TRUE) or NO (FALSE)
Binary decision m.11,.inA also applies to formal logic.
Is called a Binary Decision.
For C"<ample, Id us CC'ln5ider the following :
l. Indira G,,ndhi wos u,c only wom,m Prime Minister of
India.
2. JJ - 2 .,. 11. Values true and false are
3. Delhi i!- tJ1c bi~g~:-1 s tale in lndiil. called Truth values.
4. \\'hat do ,·0,1 sny ?
5. \Vhnl did I te ll y,)u yesterday ?
111
1~ nnd :!"'1 :-,•nh.•n re:- Ml' TRUE bul 3 rd i,; FALSE; 4 •h and 5 arc questio ns which cannot be
.-inswl•r~'C.I in TI~UE ., nd r, \1-',;t:.
Tiius. c:l•nlcnc:c-i which l~,,n be determine d l<> be trm· or fill~r arc ca lled lngical stnlememt,or..,trut/s
1,y
f1111ctim1s .ind the n,• ,ul t.; mLF or FALSE arc callt.>d /rut/, rnl11c.-.. The truth values .1rc depicted
/1>~im/ r,,11st,111I:- TRUC ,i nd FAl.Sr o r 1 and 0. I means
and O ml..'ai,, FALSE And the vJriablt•~ which can store these
TRUE
. .
truth ,·.1lt11.':> are called fo,i,:iml 1mrinNr, or hi11nn; v11l11cd Boolean variables can haw valuo
vnrinbfrs as these can s to re one of thl..' hvo values TRUE o r el thor as 1 (True) or as O (zero)
FALSE.

3.3 LOGICAL OPERATIONS


There arc some specific operation s thal can be applied on truth functions . Before learning about
these operation s, you must know about compoun d logical functions and logical operators.

33 I l"'Q ,.ol r.. t"''"' or Co·npou nd Stal ::rncnl


I =
Algebraic variables liken, I,, r or x, y, e tc. are combined with the help of 111ntl1emnticnl operntors

I like+,-, x, I to fonn algebraic expressions e.g.,


2 .,, A + 3 x 8 - 6 v C = ( l Ox Z)/2 x Y i.t•., 2A + 3 B- 6CclOZ /2 )~
Similarly, logic slatcmen ~ o r trulh functions are cornbin~d wit11 th~ help o f Logical O,,erators like
AND, OR and NOT lo form a Cm111101111d s/11/t'Tm:11/ or wgical.f11111:tio11. t'.gv

He prefers tea 11 t coflL"C.


He plays guitar ;• sh~ plays sitar.
l watch TV on Sundays , • I go for c;wimming.
n,ei,c logica l opt' r,,Lors .ire also used lo combine logical variables and logical constants 10 form
loticnl fXJ'rcsshm~ ,·.s.. assuming .r, }' arc logical variables
.'( NOT YOR Z
YAND XOR Z

BY ER NIK/ tt SH

Chapter 3 · BOOLEAN LOGIC


51
3.3.2 log co OpProlors
Before we s tart discussion a bou t logical operators, let us first
understand u•hal a Trntl, Table is .
A Truth Tobie Is a rnble which
represents all the possible j
-
values of logical variables ~
For example, following logical s tatements can have only one statements along with all the
of the two values (TRUE () C:,) or FALSE ( '\:0)) possible results of the given
combinations of values.
1. I want to have tea. 2. Tea is readily available. -
l us represent all the possible combinations of v.:ilues these statements can have in the tabular
Lef

orm :

I want to ha\'4.? tea T T F F


Tea is readily a,·ailoble T F T F
.......................................... T r, prcscots True

(Result) I'll have tea F rep•1.senls. Folse


T F F F

Or If we represent firs t statement as X a nd second statement as Y and result- as R then the above
table can also be \\"Tit-ten as follows :

T able 3.1
y 1 reomsents TRUE Y,1tun and
X R 0 represe'llS FALSE \'.1 1U9
1 1 1
1 0 0 ..,,.,;."f =
0 J 0 • If the result of any logical state.-
ment or expression Is always
I
0 0 0
TRUE or 1 fo( all Input combi-
nations, it ls called Tautology.
This is a truth table i.e., table of truth vnllles of tr11tl1 fim ctio1ts.
Now let us proceed with our discussion about logical operators
i.e.,
If the result of any logical
¢) NOT Operator ¢) OR Operator statement or expression Is
~) AND Operator always FALSE or 0 for all Input
combinations, ltls called Fallacy.
NOT Operator
1his operator operates on single variable and operation performed by NOT operator is called
f!)mpleme11tntio11 and the symbol we use for it' is (bar). Thus X means complement of X and YZ
means comple ment of YZ. As ·we know, the variables u sed in boolean equations have a unique
characteristic that they m ay assume only one of tw·o possible values O and 1, where O denotes
FALSE and 1 denotes TRUE value. TI.ms the complement operation can be defined quite simply.
0=1
1=0
T able 3.2 Truth Table for NOT Operators

X X (i.e., NOT X)
0 1
Figure 3.1 Venn diagram for X
1 0
.c
BY ER NIKHIL SIR
COMPUTER SCIENCE WITH PYTHON - X,
52
1 cntation S)1 mbol. If - is used then
Several olher symbols e.g. -, ' are also used for th_e comp cm 1 t of X. NOT operation.
15
- Xis read is 'negation of X' and if' is used then X' 1s read as comp emei:' - . . .
· I · ble VeM diagram for X lS gwen tn
singular or unary operation as it op~ratcs on smg e vana ·
Fig, 3.1 where shaded area depicts X.

OR Operator
· ·
A second tmportant operator m boolean algebra 1s
· OR t
opera or \\
,J,id, denotes operation called
/Mien/ ntiditio11 and the symbol we use for it is +. The + symbol, therefore, does not have lhe
1nom1al' meaning, but is a logical ndditio11 or logical OR symbol Thus X + Y can be read as

X OR )'. For OR operation Lhe possiblt? input and output combinations are as follows :

O+O -=O
0 + 1=1
1+ 0= 1 Shaded Portion
1+1 = 1 soowsX + Y
And the truth table of OR operator is gi\'en below: X y

T able 3.3 Truth Tobie for OR Operator


Figure 3.? Venn diagram for X+ Y.
X y X + Y i.e. X OR '(1_
0 0 0
0 1 1
~ a11d
;\'Q/t! 1hat wftcn any Ont! of.\'
1 - 0 1 }' is I • •\ )' iJ l .

--- 1 1
- 1-
To avoid ambiguity, there arc other symbols e.g., U, v, and V have been recommended as
replacements for the + sign. Computer people s till use the + sign, however, whid, was the
symbol originally proposed by Boole.Venn diagram for X + Y is given (Fig. 3.2), where s haded
area depicts X + Y.

AND Operator
MiO operator performs another important operation of boolean algebra called logical 11111Iti-
plicalion and the symbol for AND operation is (.) dot. Thus X. )' will be read as X AND Y. The
rules for AND operation are :
0.0 = 0

0J
0.] = 0
Shaded Portion
l .0=0 showsX · Y
1.1 =1
and the truth table for A?\lD is as follows : X.Y
T able 3.4 Truth Tobie for AND Operator figure 3.3 Venn diagram for (X . Y).
~ Y- ---:-1_X_._Y_(!_L~-.-X-A_N_D_X_)._--.
I ~- 0 0

I ~ ~ ~ ~
~
~ ,\~x,.. that "';~' w/1,•n botll X a,uJ Y cm:

U-- l l
I s, then ,\1 ltets tl1t re.wit J.

Venn diagram for X • Y i!'i given in f.ig. 3.3; where shaded area depicts (X . Y).
BYERNIKQ
Chop•cr 3 • BOOLEAN LOGIC 53 ~

3.3.3 Evaluation of Boolean Expressions Using Tru th Tobie


Logical variables are combined by means of logical operators (AND, OR, NOT) to form a
boolean expression.

For example, X + Y . Z + Z is a boolean expression.


Tt is often convenient lo shorlen X . Y . Z to XYZ, and using this convention, above expression
can be written as X + YZ + Z
To study a boolean express ion, il is very useful lo cons~rud a
table of values for lhe ,•ariab les and lhen to evaluate the
A truth table of n Input variables
expression fo r each of the possible combin ations of variables
wfth hl>V(! t ' Input combinations
in tum. I.e., 2'' rows e..g., a 4.varlable
Consider the expression X + YZ. Herc three variables X, Y, Z truth table will have 2" /.~., 16
rows In It.
are forming the c~pression, each o f the variables can assume
the value O or 1. The possible combinations of values may be
arranged in .isce1, ding order as in Table 3.5. To s-eo
Truth Tablo Form.-llJOO
In action
T able 3.5 Possible Combinations of~ Y and Z
- - -
X y l
0 0 0
Scan
0 0 1 OR Code

0 1 0
0 1 l ~
~ , S i11ct• .\ . \, 2 are,,,,•.., o, hlndb{t') ,n
' wml (I wn1tl1 ,,,bl,• 1111-r1/i'i11r ; l llf)tlt m ri•
1 0 0 i1fil~ ll'lrl /,aw 2' i f' , 8 mll') Ill Iulo(, n1,•
1 0 1 left 171Q51 t'l.11w rm ll'ilt /1111\' /,al/ of tc,tal tm•
trlN (i.~ • -I CJllrwt / iu ;('f\.U 011d Im// IU
l 1 0 J's (i11 M ui SJ.
Tl1c.' t ro.1 c:ohmrn u-ill hen~ no of ; C'N)'t 1111d
1 1 1 I •, ltuli rJ rlion fi~t c-0l11m11 c-om('!t'ti11s: 8
,o 11 u1.1J w 0 11. TI1111 iz wiry. [,r1.1 cofur,m
So a column is added to list Y . Z (Table 3.6) /1,u .J O's 011d -I I \ m·.u col11mn /w, t11v

. o', fulkm <.'d b,· 1111t I 'i t:Qmpli•ting 1'i mu,


in 10,at and 1/1r lass culu11m has ,111e l)'s
T able 3.6 Truth Tobie for (Y . Z) fullcmw by tmt' I ·~ romrl1·1ing 8 tOll'S

Ii
,~
·- -
II )( y z Y. Z
0 0 0 0
0 0 1 0
0 1 0 0 ~
llmt AND opac11io11 is
0 1 l 1 or plh-d 011/y on
rolumm \' and Z
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
BY ER NIKHIL SIR
COMPUTER SCIENCE WITH PYTHON _ )J
54
. th
One more column is now added to hst lues of yz (Table 3.7)
e va
l able 3.7 Truth Tobie f or Y • Zand YZ.

X y z Y.Z
-yz
0 )
0 0 0
1 0 )
0 0
0 1 0 0 1
0 1 1 1 0 ~ .
\ c IC t//llt ) Z C'Ollt:JIIIS
1 0 0 0 1 u.m.clt•11t'llh.·d m/ues of
1 )/
1 0 1 0
1 1 0 0 1
1 1 1 1 0

Now values of X are ORed (log,cn· l dd't ' ) t the value s of YZ and the resul tant value s are
n t 1011 o
contained in the last column (Table 3.8).
T able 3.8 Truth Table for X + Yl.

X y z v.z vz X+YZ
0 0 0 0 1 1
0 0 1 0 ] l ,\C'\1' ob~..--: ,·r/ir t?.fl"'"i ,,
X - ) Z ... (l, n\\D1 11£ 1· ,m J 2.
0 1 0 0 1 1 r1,r r~!alt !:Jl t,.,, ,. co1•1r le111t111ed
0 1 1 1 0 0 J J 1l1t ,1 OR,.-1 u irt, .\'

1 0 II r ,r,,, ,,,~ ,/1 ,~ (I <":/.I wlw11


0 0 1 1 ' 1/:t n>/wmu \ ,mJ rz 1..11 , •
1 0 1 0 1 l Q, vrh, ,,,o{J, rJ 1l11 , •• • J in •mr of

1 1 1r tu'IJ co/u•1:,u ,\ orJ }L . tit,


0 0 1 1 r~ulr n f .
1 1 1 1 0 1
Please note here, while evaluating: boolean expression there IS a preced
ence order which Is to be taken care of always. Always
the order of evalua11on of logical oper.itors Is' r· ·1 ;. T • • D and "Or If there are parent hesis, then the expression In
parenthesis ls evaluated first.

EXA~ PLE 3.1 Usi11g Boolcnn logic, verify using tn,t1r tnblc tlurl
X + XY = X for cad, X, Yiu 10, 1] .

Sol11tio11. As the expression X + XY = X is a two-variab
le
1. ?fame the pe.rson who develo ped expression, so we require possi ble comb ination of value s of
boolean logic. X, Y. Truth Table will be as follow s:
2. What is the other name of boolean
logic ? In which year was the boolean ,c y XY X+XY
logic/algebra developed ? 0 0 0
3. What is a buwy decision ? What do you 0
0 l
mean by a binary valued variable ? 0 0
1 0
4. What do you mean by tautology and 0
1 1
fallacy ? 1
5. What is a logic gate ? Name the three
Comparing the columns X + XY and X find
basic logic gates. b th th
o ' we
e columns are identical; hence verified. '
BY ER NIKH IU SIR
Craptrr 3 · BOOLEAN LOGIC
55
(X,\ • rt Usiug Bc>olem, logic, Vt'rify 11si11g tnitlr lablt' tl,nt ( X t Y)' = X' Y' far t'tldl X, )' ill lO,
,.
n.
Soluti on. As it is a 2-varia ble c>..prcs sion, lrulh lnble will be as follow s
:
-
X
0
y
0
X+V {X + Y)' - X' =.J__ I
Y' _ fr:_
0 1 l I
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 l l 0 0 (l 0
Comp aring U,e colum ns (X + Y)' and X' Y', bolh the column s arc idenlic
al, hence verified.
EX4\MPL£ 3. • Prtpnrt" n tnblt.' of ro111hi11ntio11s for tf1e/illlowi11g hoolcmi lug,c l'XJ1rl.'5sio11s:
(n) X Y +XY (b) XYZ +X fz (c) XYZ +XY
Soluti on. (n) As X Y + XY is a 2-variable expres sion, ils truth lable is as
X
0
y -r
x r-
v xv ~
follow s:
XY
- XY+X
- Y
0 1 1 1 0 1
0 1 1 0 0 1 \
1 0 0 1 0 0 0
1 1 0 0 0 \ 0 0
(b) Truth table for this 3 variabl e expres sion is as follows :

X y z x y z --- XYZ X YZ IXvz+x~l


0 0 0 1 l l 0 \ 0 0
0 0

I
1 1 1 0 0 1 1
0 1 0 1 0 1 I 0 0 0
0
1
1
0
1
0
1
0
0
1
0
1
I 0
0
0
0
0
0
1 0 1 0 1 0 0 0 0
1 1 0 0 0 \ l 1 0 1
1
~- 1
--- --1 -I -o o --
----- 0 o l _o__ 0

(c) T ruth table for X YZ ➔ XY i:; as follo ws :


X • y z
-X V z- XYZ I X y
XYZ +XV
- - ---- ---- ---- --
~ :1~1: ~ \ ~ ~\
1. Which gates implement logical 0 0
addition , logical multiplication and
0 0
complementation ?
2.. What is the other name of ?Wt gate ? 0 1
0 J 1 1 0 0 0 0
I
3. What is a lruth table , What is the 0
othe.r name of Lrut.h table : 1 0 0 1 l
o \ 1
(1) A + O~ ? {ii) A .. 1 = ?
1 0 1 0 0 l l 1
(iii) A . 0 :=? (iv) A . l = ?

~L ~
1 l 0 0
4. How many input combinations can be
the.re in the truth table of a logic system 1 0 0 0
having (N) lnput binaty variables ? --·-
~ 56 - • - · ' ,,11 '1 " ' - ...,. . ,
COMPUTER SCIENCE WITH PYTHON _ XI

EXAM PLC 3.4 Prepare lmlli table for tl1c following boolean expressions :

(a) X(Y + Z) + XY (b) XY (Z + YZ) + Z (c) A [(B + Q + C]

Solution . (a) Truth table for X(Y + Z) + XY is as follows :

y z z XY I
"
0 0 0
V
1 1
CV +ZJ X(Y +Z)
1 0 0
X(Y +Z) + XY
0
0 0 1 1 0 1 0 0 0
0 1 0 0 1 1 0 0 0
0 1 1 0 0 0 0 0 0
1 0 0 1 l 1 1 1 l
1 0 1 1 0 1 1 1 1
1 1 0 0 1 1 l 0 1
1 1 1 0 0 0 0 0 0

(b) Truth Table for XY(Z + YZ) + Z is as follows :

II X y z V z YZ Z + Yl XY XY(Z + VZ) XY(Z • Y2) + Z


0 0 0 1 1 0 0 0 0 1
0 0 1 1 0 0 1 0 0 0
0 1 0 0 1 1 1 0 0 1
0 1 1 0 0 0 1 0 0 0
1 0 0 1 1 0 0 1 0 1
1 0 1 1 0 0 1 1 1 1
1 1 0 0 1 l 1 0 0 1
1 1 1 0 0 0 1 0 0 0

(c) Truth Table for A[(B +q+C ) is as follows :


- -~~

A 8 C i c (i +C) (B + C) + c AC(i + C) + C]
0 0 0 1 1 1 1 0
0 0 1 1 0 1 1 0
0 1 0 0 1 0 1 0
0 1 1 0 0 1 1 0
1 0 0 1 1 1 1 1
1 0 1 1 0 1 1 1
1 1 0 0 1 0 1 1
1 1 1 0 0 1 1 1
- S SCRIB D ( Search o) Read free for 30 days 0
I"""\

BY ER NIK IL SIR

Choplor 3 : BOOLEAN LOGIC 57

3.4 BASIC LOGIC GATES


After Slta1111011 applied boolean logic in telephone switching circuits, engineers realized that
boolean algebra c-0uld be applied to compute r electronics as well.
ln the computer s, these boolean operation s are performe d by logic gates.

What is a Logic Gate ?


A Gate is a basic electronic circuit which operates on one or more signals to produce an output
signal.
Gates are digital (hvo-statc) circuits because the input and outplllt signals are either low voltage
(denotes 0) or high voltage (denotes 1). Gates nre often called logic circuits because they can be
analyzed \\ith boolean logic. There are three types of logic gates :
~> lm·erter {NOT gate) ....
It~@ ?- --- -- --
... .;,;;;==
,.,;;;;;;.
...·~
===~
~) OR gate A Gate Is a basic electronic
circuit which operatl!S on one or
~) AND gate more signals to produce an
output signal.
3.4.1 Inverter (NOT Gate)
An Inverter (Not Gate) is a gate with only one input signal
and one output signal; the output state is always the opposite
of the input state. An Inverter (Not Gate) Is a gate
with only one Input signal and
An inverter is also called a NOT gate because the output is not one output signal; the output
the same as the input. The output is sometimes called the state Is always the opposite of
complement (opposite) of the input. the Input state.

Following tables summari se the operation :

T able 3.9 Truth Tobie for NOT gate T able 3.10 Alternative Truth Tobie for NOT Gate

X x X x
Low High 0 1

High Low 1 0

A lov,, input i.e.1 0 produces high output i.e., 1, and vice


versa. The symbol for inverter is given in adjacent
x--[>-- x
Fig. 3.4. Figure 3.4 NOT gate symbol

3.4.2 OR Gate
The OR Gate has hvo or more input signals but only one output signal. U any of the input
signals is 1 (high), the output signal is 1 (high).
If all inputs are Othen output is also 0. If one or more inputs
are 1, the output is 1.
The OR Gate has two or more
An OR gate can have as many inputs (2 or more inputs) as input signals but only one
desired. No matter how many inputs are there, the action of output signal. If any of the input
OR gate is the same : one or more 1 (high) inputs produce signals Is 1 (high), the output
signal Is 1 {high).
output as 1.
BY ER "!IKHIL SIR
COMPUTER SCIENCE WITH PYTHON _ t
58

Following tables show OR action


T able 3.11 Two Input OR Gate T able 3.12 Three Input OR Gate

y X y z F
' .X
0 0 0
F
0 0 0
l
0
I
1 1 0 0
0
,i 0 1 0 1
1 0
0 1 1 1
I l 1
) 0 0 1
I \ l - l
J 0 1 1
1 l 0 1
The symbol for OR gate is given below : 1 1
1 l

D
A
B F
C
D
(c)
(a)
fr~u c .,,5 (a) Two input OR gate (b) Three input OR gate (c) Four input OR gate.

J -~.3 AND gate


The AND Gate can have two or more than two input signals
and produce an output signal When all the inputs are 1 i.e., high
I nJ2 a --♦'
:: J
The AND Gate can have two or
then the output is 1 othernrise output is Oonly. more than two Input signals and
1f any of the inputs is 0, the output is 0. To obtain output as 1, produce one output signal When
all the inputs are 1 1.e., high thenl
all inputs must be 1.
the output Is l otherwise outPII ~
An AND gate can have as many inputs (2 or more inputs) as 0 only. I
desired. Following tables iHustrate AND action.

T able 3.13 Two Input AND Gate r able 3.14 Three Input AND Gate

X y F X y z F
0 0 0 0 0 0 0
0 1 0 0 0 1 0
] 0 0 0 1 0 0
1 1 1 0 1 1 0
II,,,. J .\ l
l 0 0 0
1 0 l 0 II,,•.
1 1 0 0 f ., . r z
1 1 1 1
The symbol for AND is

;=O-• (a)
i~· (c)

figure 3.6 (o) 2•input AND gate (b) 3•input ANO gate (c) 4•input AND gate
BY ER NIKHlfslR
Chapter 3 : BOOLEAN LOGIC 59 ....J
3.5 BASIC POSTULATES OF BOOLEAN LOGIC
Boolean logic algebra, being a system of mathematics, consists offimdame11tal laws that are used
to build a workable, cohesive framework upon which are based the theorems of boolean
algebra. These fundamental laws are known as Basic J!OSl11/ates of boolemt logic nlgebra. TI,ese
postulates s tate basic relations in boolean algebra, that follow :

1. Jf X ;,e O then X = 1 ; and H X ~1 then X = O


II. OR Relations (Logical 11dditim1)
0+ 0= 0
0 + 1 =l
l +0 =1
J+ l =1
111. AND Relations (Losicnl M11ltiplicnfio11)
0 . 0=0
0 . 1= 1
l . 0=1
1 . 1= 1
J fV. Complement Rules :
0 =1
1'= 0

3.6 PRINCIPLE OF DUALITY


This is a very important principle used in boolean. logic. lhis states that starting with a boolean
relation, a110/lter boolean relatio11 can be derived by :
l. changing ead1 OR sign ( +)to an AND sign(.)
2. changing each AND sign (.) to an OR sign { + )
3. replacing each 0 by l and each 1 by 0.
The derived relation using duality principle is called dual of
origi11al expression.
For instance, we take post11latc II related to logical addition,
1. lV'rite the dual of : 1 - 1- : whkh states :
2. Give the dual of the following in (a)O +O=O (b)O + l=l (c)l+O=l (d)l+l=l
Boolean algebra :
Now working according to above guidelines, + is changed
(1) X . X' = 0 for each X
to(.) and O's are replaced by J's, these become
(i1) X + o::, X for each X.
3. What is the significance of Principle of (i) 1. 1 =1 (ii) 1. 0 =0 (iii) 0 . 1 ::: 0 (iv) 0. 0 = 0
Duality ? which are nothing but snme ns that of postulate ll1 related to
4. Write dual of the following Boolean logical multiplication. So i, ii, iii, iv are the duals of a, b, c &
.Expression : d. We'Ube applying this duality principle in the theorems of
(a)(x + y') (b) xy + xy' + x' Y
boolean algebra which is our next topic.
(c) a' + a' b+ b' (d)(x + y' + z)(x + Y)
BY ER NIKHIL SIR
60 COMPUTER SCIENCE WITH PYTHON _ XI

3.7 BASIC THEOREMS OF BOOLEAN ALGEBRA/LOGIC


Basic postulates of boolean algebra are used to define basic flzeorems of boolean algebra that
provide all the tools necessary for manipulating boolean expressions. AltJ,ough simple in
appearance, these theorems may be used to construct the boolean algebra

3.7 .1 Properties of O and 1


(a) O+ X ..,, X (b) 1 +X=l
(c) 0. X - 0 (d) l. X = X
Proof. (a) O+ X = X (c)O.X=O
Truth table for above expression is given As both the possible values of X (0 and 1) are to be
belo,,._, in Table 3.15, where R signifies the ANDed with 0, so, the truth table for this expression
output
is as follows where (R signifies the output)

T able 3.15 Truth Tobie for o +x =X.


T able 3.17 Truth Tobie for O. X = 0.

~ ~~
I ~
0 X R
0 0 0
,
I - - - - - I

0 1 1

as X can have values either O or 1 Both the values of X(O and 1) when ANDed with
(postulate I) both the values ORed with 0 produce the output as 0. Hence proved.
produce the same output as tl1at of X.
Therefore, 0. X = 0 is a fnllaetJ .
Hence proved.

(b)l + X = 1 (d)l. X = X
Truth table for this expression is given Now both the possible values of X (0 and 1) are
below in Table 3.16, where R signifies the to be ANDed with 1. Thus the truth table for it
output. will be as follows :

T able 3.16 Truth Tobie for 1 + X = 1 T able 3.18 Truth Tobie for 1.X =X

~ ~~I
~
1 X
1 0 . - - - - - 1 I

1 l

Again X can have values O or 1. Both the Now observe both the values (0 and 1) when
values (0 and 1) ORed with 1 produce the ANDed with 1 produce the same output as tltal of
output as 1. Hence proved. X. Hence proved. Here properties b and c are
Therefore 1 + X = 1 is a tautology. duals of each other and properties a and d are
duals of each other.
BY ER NIKH1Lf~R

Chapter 3 : BOOLEAN LOGIC 61 tj


3.7.2 lndernpotence Low
This law slates that
(n) X +X = X (b) X .X = X

Proof. (a) X + X = x (b) X. X= X


To prove this law, we will make truth Here X is ANDcd with itself. Again we ,-viii
table for above expression. As X is to be prepare truth table for this expression taking 2
ORed with itself only, we will prepare possible values of X (0 and 1)
truth table with the two possible values of
X (i.e., 0 and 1).

T able 3.19 Truth Table for X + X =X T able 3.20 Truth Table for X .X = X

X X - R X X R
0 0 0 0 0 0
1 l 1 1 1
I 1
I
0.0=0 (ref. postulate Ill)
0 ... 0 = 0 (ref 110s111/ate fl)
and 1.1 = 1 (ref. postulate JIT)
and 1 + 1=1 (ref postulate II)
⇒ X . X = X, as it holds true for both values of
⇒ X + X = X, as it holds true for both X. Hence proved.
values of X. Hence proved.

(a) and (l,) are duals of each other.

3. 7 .3 Involution I
This law states that : ( X) = X
To prove this, again we'll prepare truth table which is given below.
(
T able 3.21 Truth Tobie for X= X
In Boolean Algebra, if an

I~ I~I~ I
expression holds true then
its dual is also true and
vice-versa.

First column represents possible values of X, second column represents complement of X (i.e.,
X) and the third column represents complement of X (i.e.,
X) which is same as that of X. Hence
proved.
Th.is law is also called double-i11version rule.

3.7.4 Complementarity Low


These laws state that
(n) X + X =1

(b) X. X• O
BY ER NIKHIL SIR
COMPUTER SCIENCE WITH PYTHON - XI
62
Proof. {a) X + X = 1 (b) X . X= 0
Truth table for this expression is as follows:
We will prove X + X =1 ""ith the help of
truth table whid1 is given beJo,.,,, :

T able 3.22 Truth Table for X + X = 1 T able 3.23 Truth Tobie for X .X = 0

~ ~
X x X+K
0
1
1
0
1
1
I I x~x I
Here, in the first column possible values of X j as O.1 = 0 (ref 11ost11lnte Ill)
have been taken, second column consists of and 1. o=O (ref. posh,fate 111)
X values (com11lcmt•rzt t1n/,,cs of X), X and X
values are ORed and the output is shown in I •
=> X. X ; 0, as it holds true for both lhe
third column as values of X. Hence proved . Observe here
0 J.] = 1 , (ref. postulate I[) X. X = 0 is dual of X + X =1.
1+ 0 = l (ref. ,,m:tulntc If) Changing ( + ) to ( . ) and 1 to 0, and we get
⇒ X + X = 1, as it holds true for both possible x.x = 0.
values of X.
It is a fnllncy.
Hence proved. It is a fn1tli..,l11:_.."}f.

3 .7.5 Cornmu·oti\e ~cw


These laws slate that
(a) Y-) = )' X (b) X . )' = r. X
Proof.
(a) X + Y=Y + X (b) X . Y=Y . X
Truth Table for X + Y = Y + X is given belov.r: Truth table for X. Y = )'. Xis given below :
T able 3.24 Truth Tobie for X + Y = Y + X T able 3.25 Truth Tobie for X. Y = Y .X

I X
0
y
0
X+Y
0
Y+X
0
X
0
y
0
X.Y
0
Y.X
0
0 1 l I 0 ) 0 0
1 0 1 1 1 0
• 0 0
l 1 l 1 1 1 1 1
Compare the columns X + Y and Y +X, both Both of the columns X . Y and Y . X are
I of these are identical. Hence proved. identical, hence proved.

3.7.6 Associa tive Low


These laws state that
(n) X r ()' ➔ 1-J = (.\ - Y) J. Z (b) X (YZ) ~ (XY) Z
Proof. (n) Truth table for X + (Y + Z) = (X + Y) + 2 is given on next page.
BY ER NIKH IL SIR

Chapter 3 : BOOLEAN LOGIC 63


·1 able 3.26 Truth Tobie for X +(Y + l) = (X + Y) +Z
X y z Y+Z X+Y X + (Y+ Z) (X + Y) ♦ Z
0 0 0 0 0 0 0
0 0 1 1 0 1 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 0 1 1 1
1 0 1 1 1 1 1
1 1 0 1 1 1 ]
1 ] 1 1 1 1 1
Compare the columns X + ( Y + Z) and (X + Y) + Z, both of
these are identical. Hence prove d 1.
Since rule (b) is dual of rule (n), hence it is also proved.

3 .I- -,
This law stntcs that : (n) ' ) .., \) · """7 (b) , ) '7 .. (X + Y )(X ~ z,
Pr...l'.lf. (n) Truth fable for X(Y + Z) = XY + XZ is given below
:
T able 3.27 Truth Tobie for X (Y + Z) = XY + XZ

X y z Y+Z XY xz X(Y + Z) XY+X Z


0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 0 1 1 1
1 1 0 1 1 0 1 1
1 1 1 1 l 1 1 1
Both the columns X(Y + Z) and XY + Y2 are identical, hence
proved.
(b) Since rule (b) is dual of rule (a), hence it is also proved.
However, we are giving the algebraic proof of law X + YZ =(X
+ Y)(X + Z)
R.H.S. =(X + Y)(X +Z) =XX + XZ + XY + YZ
=X +XZ +XY + YZ
(XX = X. Indempotence law)
=X + XY + XZ +YZ =X(l + Y) + XZ + YZ
= X.1 + XZ+ YZ (1 + Y = 1. property of Oand l)
= X + XZ + Y2 ( X .1 = X, property of Oand 1) X + Yl expres.sion is sum of two
= X(l +Z) + YZ = X.1 + YZ (1 + Z =l, property of Oand product-terms (X.l ,Yl} and
1) (X + Y)(X + Z) Is product of sum-terms
=X+ YZ (X .1 = X, property of Omrd l) (X + Y,X + Z). So, this law is a useful
one to convert a sum-of-product type
=l.H .S.
expression to product-of-sum type
Hence proved. expression and vlce-versa.

Recall that if a boolean expression is true then its dual is also true.
BY ER NIKHIL SIR
N _~
COMPUTER SCIENCE WITH PYTHO
64

3.7.8 Absorption Low


, ,. (b) X (X-'- YJ = X
) ,X ~,X) "" "
Accordin g to thi s law : (n
Proof.
l (b )X (X +Y )c: X
(a) X+ XY = X als o proved.
l Since rule (b) is dual of rul e (n), it is aic proof of
en below : HO\vever, we are giv ing the
alg ebr
Truth table for X + XY = X is giv
T able 3.28 Truth Tobie for X
+ XY = X
- -
I this law.

X+ XY
L.H.S. = X(X + Y) = X . X + XY
y XY
X =X .X + XY
0 0 0
0 = X+ XY
0 0
0 1 (X . X = X : lndempolenct Law)
0 1
1 0
1 1 = X(l + Y)
1 1
=X .1
ntical. Hence (using 1 + Y = 1, ,,ropcrties of 0, 1)
Column X an d X + XY are ide
it can be pro ved algebraicall
y as of 0, 1)
pro ved . Also = X (X .1 = X, using properly j
L.H.S. = X + XY = R.H.S
= X( l + )')
Hence pro ved .
Putting 1 + Y =1
(ref JIY<lperlies of 0, 1 ~,eorcm J)
of 0, 1)
I 3
X .1 = X = R.H .S. (ref. properties
Hence pro ved.
Logic Algebra
3.7 .9 Some Ot he r Rules of Boolean
en bel ow :
ere are som e mo re rul es of Boolean algebra wh ich are giv
Th tributive /mv)
X) = X + Y (So me tim es also ref err ed to as the third dis
X - now,
by truth tab les . As yo u are qu ite fam ilia r wi th tru th tables
Titls rul e can easily be pro ved oth er pro ofs of the se rul es are be
ing given
yo u as an exe rci se, the
tru th table pro of is lef t for
he re:
X+Xl✓ =X+ Y

Proof.
L.H.S =X +X Y
(Pu ttin g X = X . J, preperty of
O and 1)
=X .l + XY
(Putting 1 as 1+ Y, ·: 1 + Y =1,
property of Oa11d 1)
= X(] + Y) + XY
=X +X Y+ XY

I = X + Y(X + X)
(X + X =1. complementnrity law
)
=X +Y .1
= X+ Y (Y.1 = Y, property of O and 1)

= RH .S.
Hence pro ved .
BY ER Nl fIL S'R
Chapter 3 : BOOLEAN LOGIC
65 ~
All th~ theorems of Boolean algebra, which we have covered so far, are summarised in the
followmg table :

1. Pr,l/ 1,'rfii ~ 1,J t O+ X=X ; 0 . X =O


2. J'rn1wti,·;; ,if 1 1 + X =1 ;
-
1.X =X
3. 1"d, wpot,·11ce lm1• X+X = X ;
-
X.X = X
-
-
4. llli'fllulitll:
l_x = ~
5. I Cc1111r!, JJ:t"IJl.17itJJ J,,,,. X + X = 1; x.x = 0
I
- 6.7. Ccmrr 111t 1tn.• li1,1•
\,,oci11: .,· : .1• •
X +Y=Y + X; X .Y=Y.X
X + (Y + 2) =(X + Y) + Z; X(YZ) = (XY)Z
X (Y + Z) = XY + XZ ; X + ¥Z = (X + Y)(X + Z)
I
8. Dz<trih Ir." J, .i•

9. .-\h,o;J ft,, I /, .. l' X +XY=X; X . (X + Y) = X


--
10. 0,: I
I (3rd ,lt~/11but:.-.: la:l'J
I X + XY=X +Y
3.8 0 EMORGAN'S THEO REMS
One of the mos t powerful identities used in Boolean logic is DeMorgan's theorem. Augustus
DeMorgn,a had paved the way to Boolean logic by discovering these two important theorems.
This section introduces these l:\vo theorems of DeMorgan.

3 .8. l DeMorgan's First Theorem


It states that X + Y = X Y
Proof. To prove this theorem, we need to recall complementarity laws, which state that
X + X =1 and X. X =0
i.e., a logical variable/expression when added with its complement produces the output as 1 and
when multiplied with its complement produces the output as 0.
Now to prove DeMorgan's first theorem, we will use complementarity laws.
Let us assume that P = X + Y where, P, X, Y are Logical/Boolean variables. Th~ according to
complementation law : P + P =1 and P. P = 0.
That means, if P, X, Y are Boolean variables then this complementarity law must hold for
variable P too. 1n other words, if P i.e., if X + Y =X Y then
(X + Y) + X Y must be equal to 1. (as X + X =1)

and (X + Y) . X Y must be equal to 0. (as X.X =0)

Let us first prove the first part, i.e.,


(X + Y) + (X Y) = 1
(X + Y) + X Y =((X + Y) + X).((X + Y) + Y) (ref. X + Y2 =(X + Y)(X + Z))
= (X + X + Y).(X + Y + Y)
=(1 + Y).(X + 1) (ref. X + X =1)
=1.1 (ref. 1 + X =1)

=1 So first part is proved.


66 BY ER NIKHIL S IR I
COMPUTER SCIENCE WITH PYTHQ
N - XI

Now Jet us prove the second part i.e.,


(X + Y).X Y=O
(X + Y) . X Y= X Y.(X + Y) (ref. X (YZ)==(XY)Z)
=XYX+XYY (ref X (Y + Z) =XY + X4J
= XXY+XYY
=0.Y+X.O (ref. X. X;:~
= O+ 0 = 0
So, second part is also proved, thus: X 1-1" = X ¥
3.8.2 DeA'o rgan's Second Theorem
This tJ1eorem states that: X. )' = X + l'
Proof. Again to prove this theorem, wC! will make use of complementarity law i.e.,
X + X = 1 and X. X =0.
If XY' s complement is X + Y then it must be true that
(a) XY + (X + Y) ==1 and (b) XY(X + Y) = O
To prove the fi"~I 1•,11-t Now the ,,·co11d / "11 J i.e.,
L. H.S = XY + (X + Y) XY .(X + Y)=O
=(X + Y} +XY (ref. X + Y= Y + X) L.H.S = XY. (X + Y)
=XYX +XYY
= (X + Y + X) . ( X + Y + Y) (ref X (Y + Z) = XY + ~
(ref. X + YZ = (X + Y)(X + Z))
= XXY +XYY
= (X + X + Y). (X + Y + Y) (ref. X. X=O)
= 0. Y + X . 0
I .' = (1 + Y) . (X + 1) (ref. X + X =1)
=0+0 =O=RH.S.
= 1. 1 (ref. 1 + X = 1)
XY.(X + Y)=O
= l =R.H.S
and XY + (X + Y) = l
⇒ X) = X + f . Hence the theorem.
Although the identities above represent DeMorgan's theorem, the transformation is more easily
performed by following these steps : ,_m,P tl f1 _ __:J
(1) Complement the entire function
(it) Change all the ANDs (.) to ORs (+) and all the ORs (+) 'Break the line, change the sign"
to ANDs (.) to demorganize a boolean
expression.
(iii) Complement each of the individual variables. L. -
This process is called demorganization. For example,

AB+A +AB=AB.A.AB
---
[Changed + to. and complemented individual expressions]
=AB . A . AB [': AB =AB and A ==A)
=AB.AB.A
= 0.A [AB.AB =OJ
=0 [·: O.A ::O]
BYERN IKHI~

Chapter 3 : BOOLEAN LOGIC 67 [ ~

Altematively, you may solve it as follows :

AB + A+ AB = [A+ BJ +A+ ABJ


- . . (·: AB= A+ B ; DeMorgn11' s 2-' tl1eorem)

=(A+B) + (A+AB) = (A+B)·(A +AB) (': (X+Y)=X .Y


= = = -
=A . B .(A .AB) DeMorgan's 2"" tl1eorem)

= A. B(A .(A + B)) =AB(AA + AB) = AB (0 + AB) (AA =0)


= AB.0 + ABAB = O+ AABB
= O+AA .0 (BB =0)
= 0+0 = 0
Basic Duality of Boolean logic
We already have talked about duality principle. If you observe all the theorems and rules
covered so far, you11 fmd a basic duality which underlies all boolean algebra. The postulates
and theorems which have been presented can all be divided into pairs.
For example, X + X . Y =X
lts dual will be X .(X + Y) =X , (Remember change . to + and vice-1Jersa ; complement O and 1.)
Similarly, (X + Y) + Z = X +(Y + Z) is the dual of (X . Y) .z =: X .(Y . Z)
and X + 0 = X is dual of X .1 = X
In proving the theorems or rules of boolean algebra, it is then necessary to prove only one
theorem, and the dual of the theorem follows necessarily . In effect, all boolemt algebra is prcrlicntd
011this huo-for-one basis.
ExAMPLE 3.5 Give the dunl of the following result in Boolean
algebra : X . X' =0 for each X.
Solution. Using duality principle, dual of X. X' = 0 is
L Which of the following Boolean
equations is/are incorrect ? Write the X + X' = 1 (By changing (.) to (+) and vice-versa and by
correct forms of the incorrect ones : replacing l's by O's and vice-versa ).
(a) A + A'= 1 (b) A + 0 = A EXAMPLE. 3.6 Give Ille dual of X + 0 = X for encl, X.
(c) A.l = A (d) AA' = 1
Solution. Using duality principle, dual of X + O=X is Xl = X
(e) A+ AB = A fJ) A (A + B)' = A
(g) (A+ B)' = A'+ B (h) (AB)'= A' B' EXAMPLE 3.7 State tht: principle of duality in boolean algebra and
(i) A + 1 = 1 (J) A + A = A give tl1e dual oftl1c boolenu expression : (X + Y).(X + Z).(Y + Z)
(k) A+ A' B = A+ B Solution. Principle of duality states that from every boolean
(l) Z + l'Z = (X + T) (X + A) relation, another boolean relation can be derived by
2. Find the complement of the following (1) changing each OR sign(+) to an ANO (.) sign
functions applying De'Morgan's theorem
(a) F (x, y, z) = x' yz' + x' y' z (i1) changing each AND(.) sign to an OR (+)sign
(b) F(x,y,z)= x(y'z+yz) (iii) replacing each 1 by O and each O by 1.
3. What ls the logical product of several
The new derived relation is known as the dual of the
VUiables called ? What is the logical
original relation.
sum of several variables called ?
4. What is the procedure "'Break the line, Dual of (X + Y) . (X + Z) . ( y + Z) will be :
change the sign,. ?
(X. Y) + (X .Z) +(Y .Z)=XY +X Z + YZ
BY ER NIKHIL SIR
68 COMPUTER SCIENCE WITH PYTHON ~ ~

3.9 MOR[ ABOUT LOGIC GATES


We have covered three basic logic gates NOT, OR, AND so for. But thcre nre some more logic
gates also which are derived from three basic gates (i.e., AND, OR and NOl). These gates are
more popular than NOT, OR and AND and arc widely u sed in industry. This section introduces
NOR, NANO, XOR, XNOR gates.

3 9. 1 NOR Gate 1
The Nor Ga-te- h-as_tw
_ o_ o_r.._
rn_or,~
The Nor Gate has two or more input signals but only one
Input signals but only on,
output signal. If all the inputs are 0 (i.e., low), then the output
output sfgnal. If all the Inputs are I
signal is 1 (high). O (/.~., low), then the output I
If either of the two inputs isl (high), the output will be O (low). signal Is 1 (high). I
NOR gate i~ not1,ing but imierted OR gate.
The NOR gate can have as many inputs (2 or more inputs) as desired. No matter how many
inputs are there, the action of NOR gate is the same i.e., All O(/ow) inputs produce output as 1.
Following troth Tables (3.29 and 3.30) ilJustrate NOR action.

T able 3.29 Z~lnput NOR gate T able 3.30 3-lnput NOR gate

X V F X y z F
0 0 l 0 0 0 1
0 1 0 0 0 1 0
1 0 0 0 1 0 0
1 J 0 0 1 1 0
F X ~Y 1 0 0 0
] 0 1 0 F X- Y ~ Z
F 1 1 0 0
1 1 1 0
(s)

(b)
:=1> (c)
F

f~ (d)

figure 3.7 (a) Logical _meaning of NOR gate (b) 2 input NOT gate
(c} 3 mput NOR gate (d) 4 input NOR gate

3.9.2 NAND Gate


The NANO Gate has two or more input signals but onl
· aJ 11 all o f the inputs
output s1~ .
· Y one
are I (high), then the output
produced is O~ow). The NANO Gate has two or mort
input signals but only ont
NANO gate is inverted AND gate. Th~, for all 1 (lrigh) inputs, it output signal. If all of the inpll\S
produces 0 (low) output, othenv1se for any other · ~re 1 (high), then the ocrtl)'Jt
. . ·t od
com b matJon, 1 · pr uces a
1 (/ . h
ug ) output. NANO gateinput can produced Is O(low).
also have as many inputs as desired.
BY ER NIKHI

Chapter 3 : BOOLEAN LO GIC 69

NANO action is illustra ted in following Truth Tables (3.31 and 3.32).

T able 3.31 2-input NANO gate T able 3.32 3-input NANO gate
X y F X y z F
0 0 1 0 0 0 1
0 1 1 0 0 1 1
1
1
0
1
1
0
~~ 0
0
1
1
0
1
1
1
~ F XY
1 0 0 1
1 0 ] 1
The logical meani ng of NANO gate can
be shown as follow s : 1 1 0 1 F XYl
1 1 1 0
X F
r
The symbo ls of 2, 3, 4 input NANO gates are given below :

(a) (b) (c)

Figure 3.8 (o) 2-input NANO gate (b) 3-input NANO gate (c) 4-input NANO gate.

3.9.3 XOR Gale (Exclusive O R Gate)


Exclus ive-OR
The XOR Gate can also have two or more inputs but produces one output signal
combination having
gate is differe nt from OR gate. OR gate produc es output 1 for any input
ations that have
one or more l' s, but XOR gate p roduce s output 1 for only those inpu t combin
odd numbe r of l's.
In boolea n algebra EB sign stands for XOR operation. Thus A XOR gate produce s output 1 for
XOR B can be written as A EB B. only those Input combinations
that have odd number of l ' s.
Follow ing Truth Tables (3.33 and 3.34) illustra te XOR
operat ion.

T able 3.33 2-input XOR gate T able 3.34 3-input XOR gate

No. of t's
X y F No. of 1's X y z F
n en/odd
0 0 Even 0 0 0 0
Even 0
1 1 Odd 0 0 1 1
Odd 0
0 1 Odd 0 1 0 1
Odd 1
1 0 Even 0 1 1 0
Even 1
Odd 1 0 0 1
Even 1 0 1 0
Even 1 l 0 0
Odd 1 1 1 1

L
BY ER NIKH IL SI
COMPUTER SCIENCT WITH PYTHON , ~
70

The symb ols of XOR gates are gi"en beJow:

=D
w
- = { )- ~
v- ~

(a) z-input XOR gate (b) 3-input XOR gate (c) 4~input XOR
gate.
f ~;ire ;/'

XOR addition can be summ arise d as follows :


I
Remember odd number of l's
OEB l=l, l EBO= l , l EBl=O produce output 1.
0@0 =0,

3. 9 .! ~"!O~ Ge," if,dus\~ NOR gu·cl


The XNOR Gate is logicaJly equivaJent to an inverted
XOR
. Thus XNO R XNOR gate produces outi>ut 1 fo,
i.e., XOR gate followed by a NOT gate (inventor)
has only those input combinations
produ ces 1 (high) outpu t when the input comb ina tion that have even number of l's.
3.36) illust rate
even numb er of J's. Following tables (3.35 and
XNOR action.

T able 3.35 2-inp ut XNOR gote T able 3.36 3-inp ut XNOR gote

y F Ho. of 1's X y z F
No. c,f 1's X
1 Even 0 0 0 I
Even 0 0
0 Odd 0 0 l 0
Odd 0 I
0 0 Odd 0 l 0 0
Odd 1
1 l Even 0 l 1 1
Even l
Odd 1 0 0 0

Even 1 0 1 1

Even 1 1 0 1
The XNOR Gate Is logically
Odd J 1 1 0
equivalent to an inverted XOR
i.~., XOR gate followed by a NOT
gate (inventor).

Following are the XNOR gate symbols :

= D - =I>- ~
~ ~
~
4-input XNOR gate.
figure 3.10 (o) 2-input XH0R gate (b) 3-input XN0R gate (c)

, XNOR gates represents


The bubble (small circle), on the outputs of NANO, NOR
compiemen ta Hon.
• ·ts.
• arcw
• g 1ogtc
.. • des·1grun
Now that \Ve are familiar with logic gates, we can use them ;,..,
BYERNIK~
Chapter 3 : BOOLEAN LOGIC
71
[XAM PLE 3.8 Design a circuit to realise tlie Joi/owing : F(n, b, c) = AB + AC + BA c
Solution. The given boolean expression can also be written as follows :

F (a, b, c) = A . B + A . C + B. A .C
or F (n, b, c) = (A AND B} OR (A ANO (NOT q }OR ( (NOT B) AND (NOT B) AND q
A
Now these logical operators AND AB
B
can easily be imple mented in
form of logic gales. Thus circuit A
AND
AC F
diagram for above expression C
will be as follows : AB+A"C ♦ BAC
B BAC
AND
A
C

EXAM rLE 3.9 Draw the diagram of digital circuit for tire ftmctio,z :
F(X, Y, Z) = (X + Y). (X + Z) .(Y + Z).
Solution. Above expression can also be written as :
F (X, Y, Z) = (X OR Y) AND ((NOT X) OR .( NOT Z) ) AND {Y OR Z)

x - -"""' X+Y
Y - --1
Thus circuit diagram will be
X x+z AND
F

z . - -....- - (X + Y) . (X +Z) . (Y+ Z)

Y+Z
z - --1

LET Us REVIS E
1. Why are NAND and NOR ga~es called :=i
Universal gates ?
2. Which gates are called Universal gates
~ The decision which results into either YES (TRUE) or NO (FALSE)
and why?
is called a binary decision.
3. State the purpose of reducing the swi-
tching functions to the minimal form. 1, The statements which can be determined to be True or False are
called loyical statements or truth functions.
4. Draw a logic circuit diagram using
HAND or NOR only to implement the •lz Trurh values are TRUE and FALSE or 1 and 0.
Boolean function F (a, b)- a' b' , ab. Truth cable is a table which represents all rhe possible values of
<'(.i
S. What is inverted AND gate called ? logical variables/ sraiements along with all che possible results of
What is inverted OR gate called ? the given combinations of values.
6. When does an XOR gate produce a high 'ti If result of any logical statement or expression is always TRUE or
output ? When does an XUOR gate 1, it is called tautology and if the resulc is always FALSE or 0 ii is
produce a high output ? called fallacy.
bl t:K Nlt\HIL ~ IK
Chopler 3 : BOOLEAN LOGIC
73 /

s=ol\ltc:f Ptobl,Ms

I. State w/JicJ, oft/Jc Jollowi11g are logical stnte,mmts :


(1) J\ Cl 1 .~, '· t$ 11/:-,• rnlkd II1, ·u ta. (i,) Try, ,,, , trll fir-. /.
(m) U11 11111 It'll 11 lit. (ll') .A ltSlflllill j5 tl1c lt'Orld Cl id.cl cl1m1111icm. wen.
(,') l \ 7rn ,fif tfillt n1111,· lit,· '

Solution. Statement (1) and (Iv) nre logical statements since these statements result into either true of
false values.

2 Prove thnl X. (X + Y)-= X by lnttli tal,le metltod.


S,1lulion.

X y X+Y X. (X + Y)
0 0 0 0
0 1 1 0
1 0 1 1
1 1 1 l

From the above table it is obvious that X. (X + Y) = X because both these columns are identical.
3. Give dunls for t1te following :
(1) X + X Y (ir) XY + XY + XY (ii,) (A + 0) .(A.1. A)
(iv) AB+AB (v)ABC+ABC+ABC
Solulmn. Using duality p rinciple, changing (+) to(.) and vice-versa and by replacing O's with l 's and
l's v.rith O's, the duals for the given expressions are as follows:
(1) X . (X + Y) (i1) (X + Y).(X + Y) . (X + Y)
(iii) (A . l) + (A+O+A) (iv)(A+B).(A + B)
{v) (A+B+C).(A+B+C).(A+B+C)
4. Draw logic circuit diagram for thefollowi11g expression : Y = 11l1 + br + cn.
Solu tion.
Be-------t sb

y
be

ca

5. State the distributive Jaws of boo/en11 algebra. How do tlzey differ from tire distributive laws of ordi11nry
algebra ? (Delhi 1991)

Solution. Distributive laws of boolean algebra state that


(i) X(Y + Z) = XY + XZ (i1) X + Yl=(X + Y)(X + Z)
pt law X(Y + Z) = XY + xz holds good for all values of X, Y and Zin ordinary algebra whereas
x + yz =(X + Y)(X + 2) holds good onJy for two values (0, 1) of X, Y and Z.
BY ER NIKHIL SIR

COMPUTER SCIENCE WITH PYTHON _ XI


74
1-1 11sing a tr11tlr table
: (Delhi 101\1
( , Name tlie law sJwwn below 011d verrify
A + B.C = (A + B).(A + CJ
· · cuit shown below :
11 ) Obtain the Boolean Expression for th e Iog,c c,r

X
F
i y

z
w

"''IL.I ·on.
(a) Distributive Law

A 8 C A+S A+C BC A +BC (A + B) • (A + C)


0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0
0 l 0 ] 0 0 0 0

0 1 I 1 1 1 1 ]

1 0 0 1 1 0 1 ]

1 0 1 I 1 0 1 1
1 1 0 1 I 0 1 l
1 1 ] l 1 l 1 1

From columns(A + B)(A + C)and A+BC, we observe that


A+ BC = (A+ B)(A +q. Hence verified.
(b) F=XY +(Z+W )

, . State n11d venfi.J lnvol11tiou lnw.


Sofut1on. Involution law states: X=X
Tn1th Table for X = X

,
J
X
0
X x
1 0
1 0 1

8. (a) Verify tlzt following using /milt table:


(t) X. X' =0 (it) X + I = l
(b) Wrile lite equivalenl Boolea u expression for the Logic Circuit :
u _ ,______,,
V --+---1 ~--1

r-- y

You might also like