You are on page 1of 48

# Boolean Algebra and Logic Gates

Amina Asghar

## Binary (Boolean) Logic

y Deals with binary variables and binary logic functions y Has two discrete values
y 0 False, Open y 1 True, Close

## y Three basic logical operations

y AND (.); OR (+); NOT ()

## Logic Gates and Truth Table

Boolean Algebra
y Branch of Algebra used for describing and designing two

valued state variables y Introduced by George Boole in 19th centaury y Shannon used it to design switching circuits (1938)

## Boolean Algebra Postulates

y An algebraic structure defined by a set of elements, B,

together with two binary operators + and . that satisfy the]following postulates: y Postulate 1:
y Closure with respect to both + y Closure with respect to both .

y Postulate 2:
y An identity element with respect to +, designated by 0 ( x+0

## = 0+x = x) y An identity element with respect to . designated by 1 ( x.1= 1.x = x)

y Postulate 3:
y Commutative with respect to + ( x+y = y+x) y Commutative with respect to . ( x.y = y.x)

y Postulate 4:
y . is distributive over + ( x.(y+z) = (x.y)+(y.z) ) y + is distributive over . ( x+(y.z) = (x+y).(y+z) )

y Postulate 5:
y For each element a of B, there exist an element a such that y a + a = 1 y a. a = 0

y Postulate 6:
y There exists at least two elements a, b in B, such that a b

## Boolean Algebra - Theorems

Theorems help us out in manipulating Boolean expression They must be proven from other postulates or already proven theorems

## Duality Principle of Boolean Algebra

y Duality Principle says that every algebraic expression

deducible from the postulates of Boolean algebra remains valid if the operators and identity of elements are interchanged. y In two valued Boolean algebra, the identity elements and elements of set B are same: 1 & 0 y If dual of algebraic expression is required, we simply interchange OR and AND operators.

## Lets prove the following theorems using postulates/ proven theorems

y Theorem 1(a): x+x=x y Theorem 1(b): x.x=x y Theorem 2(a): x+1=1 y Theorem 2(b): x.0=0 y Theorem 3: (x)=x y Theorem 6(a): x+xy=x y Theoem 6(b)= x(x+y)=x by duality

by duality by duality

The theorems of Boolean algebra can also be shown true by means of truth table

## Operator Precedence for Boolean Expression

y Parentheses y NOT y AND y OR

Boolean Functions
y A Boolean function is an expression formed with binary

variables, binary operators OR and AND, unary operator NOT, parentheses and equal sign. y Examples
y F1= xyz y F2= x + yz y F3= xyz + xyz + xy

Same functions

## Implementation of which function requires less gates F3 or F4??

Algebraic Manipulations
y Literal primed or unprimed variable y When Boolean function is implemented with logic gates, each

literal in the function is designated as input to gate and each term is implemented with a gate. y Complex Boolean function --- large number of gates y To get simpler circuits, one must know hoe to manipulate Boolean functions to obtain equal and simpler expression.
y Literal minimization and term minimization y We can do the literal minimization by applying algebraic

manipulations by employing postulates and basic theorems. y Term minimization will be discussed later.

Examples
y Simplify the following y x + xy y x (x+ y) y xyz + xyz + xy y xy + xz + yz y (x+y) (x+z) (y+z) x+y) (x+z) (y+z)

Complement of a Function
y F is a complement of F and is obtained by an interchange of

0s for 1s and 1s for 0s. y Complement of function can be obtained by De Morgans theorem

Example
y Find the complement of the following functions by applying

De Morgans theorem as many times as necessary. y F1= xyz + xyz y F2= x (yz+ yz)

Example
y Find the complement of following functions by taking their

dual and complementing each literal. y F1= xyz + xyz y F2= x (yz+ yz)

## Canonical forms of Expression

y We can write expressions in many ways, but some ways are more useful than

others y A sum of products (SOP) expression contains: y Only OR (sum) operations at the outermost level y Each term that is summed must be a product of literals y The advantage is that any sum of products expression can be implemented using a two-level circuit y literals and their complements at the 0th level y AND gates at the first level y a single OR gate at the second level

Minterms

Maxtems

## Converting between Canonical forms

Sum of Minterms
y We investigated that
y For n variables there are 2n minterms y Any boolean function can be described in terms of sum of

minterms
y The function can be either 1 or 0 for each minterm, and

since there 2n minterms, therefore the possible functions that can be formed with n variables are 22n

## Expressing the Boolean function as sum of minterms

y Expand the expression into sum of minterms
y Each term is inspected to check that it contains all the variables y If the term misses any variable then it is ANDed with an expression such as x+x, where x is the missing variable

Example

## Expressing the function in terms of product of Maxterms

y Each 22n functions of n variables can also be expressed as a

## product of maxterms y To express a function in terms of product of maxterms

y It must first rewritten as OR terms by using distributive law

Example

## Standard forms of Expression

y In standard forms, terms may have one, two or any number

of literals y Sum of products is a Boolean expression containing AND terms of one or more literals each. The sum denotes the ORing of these terms.
y Product of sums is a Boolean expression containing OR

terms of one or more literals each. The product denotes the ANDing of these terms

## Non standard form

y Sometimes expression is neither sum of products or product

law .