Presidency School Bangalore North
COMPUTER SCIENCE
CH:
BOOLEAN LOGIC
What language does a Computer understands
• Computers do not understand natural languages nor
programming languages.
• They only understand the language of 0 or 1.(binary language)
• Because computer understands language of (0/1) which is binary value so
every operation is done with the help of these binary value by the computer.
WORKING OF ELECTRIC BULB
BOOLEAN LOGIC
• George Boole, Boolean logic is a form of algebra in which all
values are reduced to either 0 or 1.
• To understand boolean logic properly we have to understand
Boolean logic rule,Truth table and logic gates
BOOLEAN
It’s a datatype that has 2 values 0 or 1 .
0 or 1 can also be represented as TRUE OR FALSE (truth values)
,ON or OFF ,HIGH OR LOW. Etc
In python built in function
>>bool(0) False
>>bool(1) True
TRUTH TABLE
Truth table is a table which represent all the possible
values of logical variables/statement along with all the
possible results of the given combination of statements
OR(+) OPERATOR
Truth table
OR
A B C=A+B
1 1 1
1 0 1
0 1 1
0 0 0
AND OPERATOR
Truth table
AND
A B C=A.B
T T T
T F F
F T F
F F F
NOT OPERATOR
This operator operates on single variable
Operation performed is called complementation
Ex:not 5 ,not 0,not (5>6)
NOT
A A’ or ~A or A
1 0
0 1
A=A
NAND OPERATOR
return the inverted value of AND operation
Truth table
AND NAND(NOT
(AND) )
A B A.B A.B
1 1 1 0
0 1 0 1
1 0 0 1
0 0 0 1
NOR OPERATOR
return inverted value of OR operation
Truth table
OR NOR(NOT (OR) )
A B A+B A+B
1 1 1 0
0 1 1 0
1 0 1 0 Y=A+B
0 0 0 1
THINK PAIR SHARE
Imagine two switches connected in series with a bulb …when will the
bulb glow(AND gate)
Imagine two switches connected in parallel with a bulb …when will the
bulb glow(OR gate)
XOR OPERATOR:WHEN THERE IS ODD NUMBER OF 1,OUTPUT IS 1
Truth table
XOR
A B A + B
1 1 0
0 1 1
1 0 1 Y=A + B
0 0 0
BOOLEAN ALGEBRA
Using boolean logic verify
x + xy = x
X Y X.Y X+XY
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
X+Y =X.Y
x y X+Y X+Y X Y x.y
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0
LOGIC GATES AND CIRCUITS
• Logic gate is an idealized or physical device implementing a Boolean function.
• These are used to construct logic circuit.
V
LOGIC CIRCUITS
A logic circuit is a circuit that carries out a set of logic actions
based on an expression
CONSTRUCT THE LOGIC CIRCUIT OF FOLLOWING
1. AB
2. A+B
3. A + BC
4. AB+B’CD
5. AB+AC’+B’A’C
DE-MORGAN THEOREM
This states that
(X+Y)’ = X’ .Y’
(X.Y)’ = X’ +Y’