3. • Boolean Algebra defines a systematic use of
binary number system. In similar way the
algebra defines the use in decimal number
system.
• The peculiar nature of binary system(base2)
having number 0 or 1 in a digit is systematically
defined in Boolean algebra.
• Boolean Algebra defines the Constants ,
variables and functions of binary number
system.
• Logical expressions are defined using operators
and variables and or constants.
3
4. • Features: Boolean algebra does not define any
fractional, complex and negative roots(square,
cube etc.).
• This algebra performs logical operations only.
• Symbols used in boolean are:
• 1)Constants-> 0 & 1. 2) Variable->any
character ( upper case or lower case).
3) = is for equality. 4) (.) dot for
product between two variable. 5)+ for
logical sum(or). 6) – for logical subtraction.
7) ‘ 0r for complement i.e if A->0 then A’ or A
->1.
4
5. • Postulates: Set of boolean expressions
accepted without proof . Rules and theorems
are built based on these postulates. Postulates
are also called AXIOMS. Following are the
postulates (Axioms):
• 1) 0.0=0 2)0.1=0 3)1.0=0
4)1.1=1 5)0+0=0 6)0+1=1
7)1+0=1 8)1+1=1 9)0’=1
10)1’=0.
• LAWS:
• 1) complement law: if a=0 then a’=1 and if a=1
then a’=0 and a’’=a.
5
6. • AND laws: 1) a.0=0 2) a.1=1 3) a . a=a
4) a . a’=0
• OR laws: 1) a+0=a 2) a+1=1 3) a+a=a
4) a+a’=1
• Commutative laws: 1) a+b=b+a or a+b+c=c+b+a
or =b+c+a 2) a.b=b.a or a.b.c=c.b.a=b.c.a
• Associative laws: 1) (a+b)+c=a+(b+c)=(a+c)+b
or a+(b+c+d)=(a+b)+(c+d)=(a+b+c)+d
2)(a.b).c=a.(b.c) or a.(b.c.d)=(a.b).(c.d)=(a.b.c).d
• Distributive laws: 1) a(b+c)=a.b+a.c or
a.b.c(d+e)=a.b.c.d+a.b.c.e or
a.b(c.d+e.f)=a.b.c.d+a.b.e.f 6
7. • 2) a+(b.c)=(a+b)(a+c). This equality is not
straight forward , so let us prove it:
• R.H.S=(a+b)(a+c) = a.a+a.c+b.a+b.c
=a+ac+ba+bc =a(1+c)+ba+bc = a+ba+bc
=a(1+b)+bc = a+bc = L.H.S ,so (a+b)(a+c) = a+bc.
• 3) a+a’b=a+b. let us prove it: L.H.S = a+a’b can
be written as (a+a’)(a+b)[as above] =
a.a+a.b+a’.a+a’.b = aa+ab+a’b (a’.a=0) =
a+b(a+a’) =a+b.1=a+b=R.H.S, so a+a’b=a+b.
• Idempotence law : 1)a.a=a 2) a+a=a 3)a’’=a.
• Complement or negate law: 1) a.a’=0 2) a+a’=1
• Identity law: 1) a.1=a 2)a+1=1 3)a.0=0 4)a+0=a
7
10. • 1) Let us assume that a+b is x and a’.b’ is y then
x+y=(a+b) +a’b’
• = ((a+b)+a’) (a+b)+b’) (since a+bc=(a+b)(a+c))
• = (a+a’+b)(a+b+b’) = (1+b)(1+a) = 1.1=1 .
• This proves that x+y = 1, but x= a+b and Y = a’b’
so a+b + a’b’ =1.
• we also know that x+x’ =1 or (a+b)+(a+b)’ = 1
let us compare this equation with (a+b)+a’b’=1
so by analogy (a+b)’ should be = a’b’.
• Hence (a+b)’ = a’b’.
10
12. • 11100 carry
• 0110 factor
• 1100 number
• 10010 result----0001 0010
• Why add 0110(6) :
• As we have seen to convert a hex number into
bcd we need to add 0110 if the number is
>9,following is the reason:
• 1)a number >9 must require two digits ,say
D(14) requires two digits 1 & 4 in decimal i.e. a
carry and 4.
12
13. • 2)4 bits represent a hex digit where a carry is
generated only when number is 16 or
>16.While in decimal a carry is generated when
number is 10 or >10.
• 3)So any number >10 must generate a carry in
bcd.
• 4)hence any number in the digit which is 10 or
>10 will generate carry when it is converted at
16 or >16.
• 5) 10 will generate carry if it is added by 6.
10+6= 16 which is 10 in hex. Hence the number
gets converted to bcd when we add 6 to it.
13
14. • BCD add(sum):
• Single digit : 6+9 = 0110+1001=1111 , but this is
not BCD ,the result is >9 so to convert it into
BCD now add 0110 into the result as
1111+0110=0001 0101.
• Multi digit: 1) add the multi digit numbers in
similar way as binary numbers or hex numbers.
• 2)check each 4 bit bcd digit in result.
• 3) add 0110 to every digit which is >9 and
propagate the carry as we have done during
addition. If any carry occurs while adding digit
then also add 0110 to resultant digit. 14
15. • If a=184 and b=897 , do BCD addition.
• 001100001000 carry
• 000110000100 a
• 100010010111 b
• 101000011011 check each digit of result
• Digit a is >9, digit b is <9 but a carry occurred
while adding these digits and digit c is >9 so we
add 0110 0110 and 0110 in result as
• 101000011011 R
• 011001100110 factor
• 1000010000001 final result which is (1081)₁₀
15
a
b
c
16. • BCD subtraction: BCd subtraction can be done
using simple subtraction or 1’s complement or
2’s complement method. We will use 2’s
complement method here.
• a= 86 and b=97 do a-b. 2’s complement of b :
• Write b in BCD form : 10010111 , 2’s
complement : 01101001=b’. So a-b=a+b’.
• 00000000 carry
• 10000110 a
• 01101001 b’
• 11101111 no carry so –ve result. 2’s
complement is 00010001 check each digit . 16
17. • If digit is <9 then sub. 0000 to this digit , if digit
is >9 then add 0110 to that digit and propagate
carry. So 0000 is added in both digits to get
00010001=-(11)₁₀.
• If a=32 b=09 , a-b? b=00001001 so
b’=11110111.
• 111101100 carry
• 00110010 a
• 11110111 b’
• 100101001 carry so result is +ve. Ignore carry.
• digit ano carry and a is <10 so sub 0110.
17
a
b
18. • So 1001-0110=0011. digit b had carry so sub
0000. 0010-0000=0010. final result is
00100011=(23).
• a=04, b=32. b= 00110010 and b’=11001110.
• 00011000 carry
• 00000100 a
• 11001110 b’
• 11010010 no carry. Result –ve. 2’s
complement of result 00101110.There is
auxiliary carry from first digit so sub. 0110from
first digit i.e. 1110-0110=1000.final result
00101000.-(28). 18
19. • 2421 code: Also called self complementing
code.
• Look at the table below:
• From 5 onwards one will find that 5 is
complement of 4, 6 is complement of 3 and so
on. This type of code is known as self
complementing code. Similarly 84(-2)(-1) i.e.
19
Deci
mal
2421
0 0000
1 0001
2 0010
3 0011
4 0100
Deci
mal
2421
5 1011
6 1100
7 1101
8 1110
9 1111
20. • 84-2-1, this code is also self complementing
code. Note that sum of weight of each digit is
always 9 here.
• Practice question: prove that self
complementing code will have sum of weights
=9.
• Non weighted codes: excess-3 code:
• each number which is represented in this code
has value by adding 0011 to its binary
equivalent. Say 0000 is 0000+0011=0011 in
excess-3 coded number.
20
21. • Table below shows the number in excess-3:
• This is also self complementing code.
• It is also a sequential code similar to
decimal,bcd,hex,octal, etc.
• Application of this code is earlier calculators
which were calculating numbers in BCD.If we
use bcd number written in excess-3 code then
21
DEC BCD EX-3
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
DEC BCD EX-3
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100
22. • We need not have to worry about adding or
subtracting of 0110(6) in/from the resultant
each digit. This code generates the carry
/borrow properly during addition/subtraction.
• A decimal number 396 will be 6C9 in excess-3
and will be written as 011011001001.each digit
of BCD has added number 3 .
• A number 6C9 or 6 12 9 is converted in decimal
by subtracting each digit by 3. so 6 is 3, c is 9
and 9 is 6. so number is 396.
22
23. • a= 011010001001, b=100010101100 are ex-3
no. do a+b
• 0001 0001 0000 carry
• 0110 1000 1001 a
• 1000 1010 1100 b
• 1111 0011 0101 digits in circle have
generated carry while third one has not . So
sub. 0011 from 3rd one and add 011 to other
two as: 1111-0011=1100, 0011+0011=0110
and 0101+0011=1000. so final result
=110001101000 and its BCD eq. 100100110101
23
24. • Excess 3 subtraction:
• Similar to BCD sub. We will see complement
method only. Other methods are also same as
BCD.
• 0011 0011 1011 b(33b) ,b’= 1100 1100 0101
– 1 1001 0000 0000 carry
– 0100 1011 1000 a(4b8)
– 1100 1100 0101 b’ a+b’ is
– 10001 0111 1101 r1
– 0011 0011 0011 cir red for+, cir black for -.
– 0100 1010 1010
– 0100 1010 1010 R(4aa) or(177)₁₀ 24
25. • a=0011 0011 1011, b= 0100 1011 1000 , so b’=1011
0100 1000
• 00110 1111 0000
• 0011 0011 1011 a
• 1011 0100 1000 b’
• 1110 1000 0011 r no carry. –ve no. 2’s complement
0001 0111 1101
• 0011 0011 0011 red cir for sub., black cir for add
• 0100 1010 1010 and BCD equ.0001 0111 0111=-(177)
• Note: remember that 10 is written in BCD as 00010000
so BCD 10 equ. In ex-3 is 0100 0011 and 11 is 0100
0100.
25
26. • Gray code: it is a non weighted code.
• Also called unit distance code or minimum
change code.
• It is non sequential code.
• Required for generating data in continues
stream , where hard ware required to produce
only one change in bits to get next number.
• Also useful in data communication .
• Data written in gray code are quite often used
in LAN networks.
26
27. • Table for Gray coded numbers:
• Convert a binary number into gray :
• 1) MSB of number is MSB of gray number.
• 2)Take ex-or of msb of number and next right
bit of same number.Result is next right bit of
gray number.
27
DEC Binary Gray
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
DEC Binary Gray
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
DEC Binary Gray
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000
28. • 3) continue this process till LSB bit of binary
number is considered.
• 4)The converted number is Gray number.
• Convert 10101110 to gray
• 1 + 0 + 1+ 0 + 1+ 1+ 1+ 0
• 1 1 1 1 1 0 0 1
• Converted gray is 11111001
• Convert 11111001 to binary
• 1 1 1 1 1 0 0 1
• + + + + + + +
• 1 0 1 0 1 1 1 0---binary equivalent
28
29. • Alphanumeric codes:
• Characters A-Z,a-z,0-9 and other special
characters like $,%,@,#,<,> etc have been
represented by unique binary number.
Computer or other electronic devices recognize
these characters by their unique binary coded
number. Such codes are called alphanumeric
codes.
• Most popular alphanumeric code is
ASCII(American standard code for information
exchange)
29
31. • In ASCII code a character is represented in 7 bit
binary number. e.g. alphabet ‘C’ is in computer
as 100 0011 (43)₁₆ . While null character as
000 0000 (00)₁₆.
• Another alphanumeric code is
EBCIDIC(Extended Binary Coded Decimal
Information code). EBCIDIC is 8 bit binary code.
• EBCIDIC can represent 256 characters while
ASCII will only 128 . In English language only 128
characters are available , so ASCII can represent
all characters required for English language .
31
32. • Error codes: Parity bit coded numbers. 8th bit is
upended after the MSB of the number and is
called as parity bit.
• This code can detect 1 bit error in the character.
i.e at transmitting end a parity bit is added into
the character and at receiving end this parity bit
is checked for correctness of the character.
• Two type of parity code: 1) odd parity and
2)even parity .
• What is parity?
• To understand this let us take a character A
which should be transmitted.
32
33. • A will be transmitted as 1000001(41)₁₆ .This is a
7 bit code. 8th bit is to be appended after
MSB.This 8th bit is called parity bit.
• Procedure for appending 8th bit:
• The number is 1000001.Start from LSB(red bit),
add adjacent left bit(green bit). 1+0=1.
• Add next adjacent bit(orange bit) to the result
1+0=1, add next adjacent(blue bit) as
1+0=1,repeat this till reaches to MSB and check
the sum. In this case it is 1+1=0 at MSB.Based
on this result either a 0 or a 1 is added as 8th bit
in the number. This 0 or 1 is parity bit.
33
34. • Odd parity: Since the result of bit addition is 0 ,
a 1 is added as parity bit, making total count as
odd count. If the result is 1 then a 0 bit will be
added keeping the resultant count odd.So the
character A will be transmitted as 11000001.
• The received number at receiving end is
counted(all 8 bits) and total result is checked for
oddness .
• Character C 1000011 will have :
1+1=0+0=0+0=0+0=0+0=0+1=1,so 8th bit is
0.Character c will be transmitted as 01000011.
34
35. • Even parity: A will be transmitted as
1000001(41)₁₆ .This is a 7 bit code. 8th bit is to
be appended as even parity bit. So the number:
• The number is 1000001.Start from LSB(red bit),
add adjacent left bit(green bit). 1+0=1.
• Add next adjacent bit(orange bit) to the result
1+0=1, add next adjacent(blue bit) as
1+0=1,repeat this till reaches to MSB and check
the sum. In this case it is 1+1=0 . Since sum is
even so a 0 is added at 8th bit, making the
number as 01000001. If final sum would have
been 1 then 1 would have added as 8th bit to
make total sum as even. 35
36. 36
• The received number at receiving end is
counted(all 8 bits) and total result is checked
for evenness . If received character is C then it
should have been transmitted as 11000011, so
count is :
• 1+1=0+0=0+0=0+0=0+0=0+1+1=0. since sum is
0 so character received is correct C so 8th bit 1 is
discarded and character taken is 1000011(43) .
37. • Bi-quniary(5043210) code: Look at the table:
• The peculiarity in above bi-quniary code is that
each number in the code has 5 number of 0s
and 2 number 0f 1s. This is maintained in all
digits , if the number is multi digit. At receiving
end, these 0s and 1s are checked and if not
found same no. of 0s and 1s then received one .
37
BCD 5043210
0000 0100001
0001 0100010
0010 0100100
0011 0101000
0100 0110000
BCD 5043210
0101 1000001
0110 1000010
0111 1000100
1000 1001000
1001 1010000
38. • Error correcting codes: Hamming code:
• 4 bit binary number is rewritten as 7 bit number
using following pattern : D₇ D₆ D₅ P₄ D₃P₂ P₁
D₇ D₆ D₅D₃ are the bits of the number and Ps are
even parity bits. e.g. number 1011 is converted
to hamming code as: D₇ D₆ D₅ P₄ D₃P₂ P₁ x x
x 1 0 1 1
• Find P₁ as : add D₇ D₅ D₃----1+1+1=1 odd so add
1 to make 1+1=0 even. So P₁ is =1. find P₂ from
• D₇ D₆ D₃----1+0+1=0 so P₂ =0 and similarly P₄ is
• D₇ D₆ D₅ ----1+0+1=0 so P₄ =0 . No. 1010101 will
be transmitted. 38
39. • Let us take another example. Character G .
ASCII code of G is 1000111, in 8 bit it is
01000111. first digit is 0111. Write it in
hamming D₇ D₆ D₅ P₄ D₃P₂ P₁ as:
• 011 P₄1 P₂ P₁ . Calculate P₁ as sum of D₇ D₅ D₃:
0+1+1=0 so P₁=0. Number is now 011 P₄1 P₂ 0.
Calculate P₂ as sum of D₇ D₆ D₃: 0+1+1=0 so P₂
is 0 and number is 001P₄ 100 and finally P₄ is:
sum of: D₇ D₆ D₅ =0+1+1=0 so P₄ =0. The
number to be transmitted is 0110100.
39