You are on page 1of 17

BOOLEAN ALGEBRA by ANSHAY AGARWAL

Boolean algebra, the algebra of logic, is also known as switching


algebra.

BINARY DECISION
Any decision which results into a YES (TRUE) or NO (FALSE) is called
a binary decision.
YES

NO

TRUE

FALSE

For example:
13 2 = 11.

These two are true statements.

PM of India is Manmohan Singh.


Delhi is biggest state in India.
What is your name?

This is a false statement.


This is a question which cannot be
answered as true or false.

Sentences that can be answered as true or false are called


logical statements or truth functions.
The results TRUE or FALSE are called truth values.

LOGICAL OPERATIONS
Logical function or Compound statement
Algebraic variables like a, b, c, x, y etc. are combined
with help of mathematical operators like +,-,x,/.
Similarly, logical statements or truth functions are
combined with help of logical operators to form a logical
function. For example
He prefers tea not coffee.
He plays piano and she plays sitar.
On Sundays, I watch TV or go for swimming.
The AND, OR, NOT are the logical operators.
Logical operators
TRUTH TABLE
A truth table is a table which represents all the possible values
of logical variables along with all possible results of given
combinations of values.
For example,
I want to have tea

T represents TRUE

Tea is readily available

F represents FALSE

(Result)Ill have tea

Or if we represent first statement as X and second statement


as Y and result as R then we can write above table as-

X
1
1
0
0

Y
1
0
1
0

R
1
0
0
0

TRUTH TABLE
1 represents TRUE
0 represents FALSE
OPERATORS
NOT

OR

AND

NOT Operator
It operates on one input and gives the opposite of that as output.
If the input is 0, output will be 1
If the input is 1, output will be 0
Since, it operates on one input it is called a unary operator.
This is known as complementation.
It is represented by an inverted coma ( ) or a bar over the
variable.
For example
Complement of X will be represented as X or X.
0=1
1=0
Truth table for NOT operation isX
0
1

X
1
0

A logic variable can contain any of the two values 0 and 1.

OR Operator
It represents the operation called logical addition.
The symbol used for OR operator is +.
So, X+Y can be read as X OR Y.
0+0=0
0+1=1
1+0=1
1+1=1

If any of the input is 1 then the output will be 1


Truth table for OR operator is
X
0
0
1
1

Y
0
1
0
1

X+Y
0
1
1
1

For three input operators, first apply operator on two


operands then apply the result on third.
X
0
0
0
0
1
1

Y
0
0
1
1
0
0

Z
0
1
0
1
0
1

X+Y+Z
0
1
1
1
1
1

1
1

1
1
AND Operator

0
1

1
1

It operates on two or more inputs.


It represents operation called logical multiplication.
The symbol used for AND operation is a dot ( . ).
So, X.Y can be read as X AND Y.
0.0 = 0
0.1 = 0
1.0 = 0
1.1 = 1

If any off the input is 0 then output will be 0


The truth table for AND operator is
X
0
0
1
1

Y
0
1
0
1

X.Y
0
0
0
1

For three input operators, first apply AND operation on two operands
and then apply operation on the result and third operand. Truth table
for 3 inputs isX
0
0
0
0
1
1

Y
0
0
1
1
0
0

Z
0
1
0
1
0
1

X.Y.Z
0
0
0
0
0
0

1
1

1
1

0
1

0
1

BOOLEAN EXPRESSIONS
Logical variables are combined by means of logical operators to
form Boolean expression.
For exampleo X+Y
o X + YZ + Z
o Y + Z
Boolean expressions are evaluated by constructing the truth
table.
Consider the expression- X + (Y.Z)
To study this expression, first consider all the combinations of X,
Y and Z. total number of combinations for 3 variables is 23 = 8.

X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

Z
0
1
0
1
0
1
0
1

Calculate Y.Z
X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

Z
0
1
0
1
0
1
0
1

Y.Z
0
0
0
1
0
0
0
1

Now find (Y.Z)

X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

Z
0
1
0
1
0
1
0
1

Y.Z
0
0
0
1
0
0
0
1

(Y.Z)
1
1
1
0
1
1
1
0

Now find value of X + (Y.Z)


X

Y.Z

(Y.Z)

X + (Y.Z)

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1

0
0
0
1
0
0
0
1

1
1
1
0
1
1
1
0

1
1
1
0
1
1
1
1

To evaluate the Boolean expressions, a precedence order has to


be followed Parenthesis ()
NOT

PRIORI
TY

AND
OR

Example: Verify using truth table that X + XY = X


X
0
0
1

Y
0
1
0

XY
0
0
0

X+XY
0
0
1

Notice that all the value of


X and X+XY are same. This
verifies that X=X+XY

Example: Verify using truth table that (X + Y) = XY


X
0
0
1
1

Y
0
1
0
1

X
1
1
0
0

Y
1
0
1
0

X+Y
0
1
1
1

(X+Y)
1
0
0
0

XY
1
0
0
0

Notice again that all the value


of (X+Y) and XY are same.
This verifies that (X+Y)=XY

Exercise:
Prepare truth table for expression: XY + XY and verify that it is
equal to X
Prepare truth table for expression: XYZ + XY

BASIC POSTULATES OF BOOLEAN ALGEBRA


If X = 0 then X = 1 and if X = 1 then X = 0
Logical addition (OR relations)
o 0+0=0
o 0+1=1
o 1+0=1
o 1+1=1
Logical multiplication (AND relations)
o 0.0=0
o 0.1=0
o 1.0=0
o 1.1=1
Complement rules (NOT relations)
o 0 = 1
o 1 = 0

Principle of duality
o Change each OR (+) to AND (.)
o Change each AND (.) to OR (+)
o Replace each 0 by 1 and 1 by 0

Basic theorems of Boolean algebra


Properties of 0 and 1
o 0+X=X
o 1+X=1
o 0.X=0
o 1.X=X
Proof
These properties can be proved by creating a truth table
For eg.

For 0+X
0
0
0

X
0
1

0+X
0
1

X
0

0.X
0

For 1.X
0
0

The other two proofs are left as exercise.

Indempotence law
o X+X=X
o X.X=X

Proof

For X + X = X
X
0
1

X
0
1

X+X
0
1

X
0
1

X.X
0
1

For X . X = X
X
0
1

Involution law
(X) = X
Proof
X
0
1

X
1
0

(X)
0
1

X
1
0

X+X
1
1

Complementary law
o X + X = 1
o X . X = 0
Proof
For X + X = 1
X
0
1

For X . X = 0

X
0
1

X
1
0

X.X
0
0

Commutative law
o X+Y=Y+X
o X.Y=Y.X
Proof
For X + Y = Y + X

X
0
0
1
1

Y
0
1
0
1

X+Y
0
1
1
1

Y+X
0
1
1
1

X.Y
0
0
0

Y.X
0
0
0

For X . Y = Y . X

X
0
0
1

Y
0
1
0

Associative law
o X+(Y+Z)=(X+Y)+Z
o X.(Y.Z)=(X.Y).Z

Proof
For X + ( Y + Z ) = ( X + Y ) + Z
X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

Z
0
1
0
1
0
1
0
1

Y+Z
0
1
1
1
0
1
1
1

X+Y
0
0
1
1
1
1
1
1

X+(Y+Z) (X+Y)+Z
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1

X.Y
0
0

X.(Y.Z)
0
0

o For X . ( Y . Z ) = ( X . Y ) . Z
X
0
0

Y
0
0

Z
0
1

Y.Z
0
0

(X.Y).Z
0
0

0
0
1
1
1
1

1
1
0
0
1
1

0
1
0
1
0
1

0
1
0
0
0
1

0
0
0
0
1
1

0
0
0
0
0
1

0
0
0
0
0
1

Distributive law
o X(Y + Z) = XY + XZ
o X + YZ = (X + Y)(X + Z)
Proof
For X(Y + Z) = XY + XZ
X
0
0
0
0
1
1
1
1

Y
0
0
1
1
0
0
1
1

Z
0
1
0
1
0
1
0
1

Y+Z
0
1
1
1
0
1
1
1

X.Y
0
0
0
0
0
0
1
1

X.Z
0
0
0
0
0
1
0
1

X.(Y+Z) X.Y+X.Z
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1

For X + YZ = (X + Y)(X + Z)
Here is an algebraic proof of this rule
R.H.S. = (X + Y)(X + Z)
= XX + XZ + YX + YZ
= X + XZ + YX + YZ

(Indempotence law)

= X(1+Z) + YX + YZ

(taking X common)

= X.1 + YX + YZ

(1+Z=1 property of 0 and 1)

= X + YX + YZ

(X.1=X property of 0 and 1)

= (1+Y)X +YZ

(taking X common)

= 1.X + YZ

(1+Y=1 property of 0 and 1)

= X + YZ

(1.X=X property of 0 and 1)

= L.H.S.

Hence proved

The proof through truth table is left as an exercise

Absorption law
o
o

X + XY = X
X (X + Y) = X
Proof
For X + XY = X

X
0
0
1
1

Y
0
1
0
1

X.Y
0
0
0
1

X+XY
0
0
1
1

X+Y
0
1
1
1

X(X+Y)
0
0
1
1

For X (X + Y) = X

X
0
0
1
1

Y
0
1
0
1