Number Systems, Computer Logic, and Boolean Algebra

1. Review of Fundamentals of the Number System

In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically 0 (zero) and 1 (one).

Base 10 counting system:
We happened to use the current counting system, because we happened to have ten fingers.
If dinosaurs had ruled the earth, they would be happy to use a 8-based counting system..



What does 157 mean? 157 = 1 x 100 + 5 x 10 + 7 x 1 = 1 x 10^2 + 5 x 10^1 + 7 x 10^0

Imagine a specie that only has two fingers. how can they count? A computer is such kind of two-finger specie. 0 and 1 Each place is the exponential of 2.

Base 10: 157: 157 = 1 x 10^2 + 5 x 10^1 + 7 x 10^0

Base 2: 1011 = 1 x 2^3 + 0 x 2^2 + 1 x 2^1 + 1 x 2^0

1 bit is a single bit of information, a 1 or 0. Only two possible values.
1 byte is 8 bits, an 8 bit word
256 possible values from 0-255 base 10 or 00000000 to 11111111 base 2
10100110 is a single byte





Base 10 to Binary



Binary mathematics



Hexadecimal (base 16):
Binary code is too long in representation. Hex is much shorter. Converting a binary number to a Hex number is relatively easy. Every 4 bit can convert to a Hex.
Problem: we are short of numbers A-10 B-11 C-12 D-13 E-14 F-15

Lookup table:



Example:



2. Computer Logic

This is nothing but stories about 1's and 0's.

1: a very good basketball player that can definetly win the game.
0: a really really bad basketball player that helps the rivals win the game.

So the logic becomes very simple:

0 AND 1: both 0 and 1 are on the court play the game, definetly you will lose the game. The result is 0.
0 AND 0: two bad players totally help the other team win. The result is still 0.
1 AND 0: no difference to the 1st one.
1 AND 1: you will win! Result = 1.

0 OR 1: you can choose which one to play the game. Definetly pick up the good one to win. Result = 1.
0 OR 0: two bad choices, result = 0.
1 OR 0: no difference to the 1st one.
1 OR 1: two good choices, result = 1.

We use 'x' or nothing to represent the AND logic.
We use '+' to represent the OR logic.

So you can complete the following logic expressions:
0x0 =
0x1 =
1x0 =
1x1 =

0+0 =
0+1 =
1+0 =
1+1 =

Solutions:
0x0 = 0
0x1 = 0
1x0 = 0
1x1 = 1

0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 1


3. Boolean Algebra


Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the binary numbers i.e. 0 and 1. It is also called as Binary Algebra or logical Algebra. Boolean algebra was invented by George Boole in 1854. Rule in Boolean Algebra Following are the important rules used in Boolean algebra.

Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW. Complement of a variable is represented by an overbar (-). Thus, complement of variable B is represented as B Bar. Thus if B = 0 then B Bar = 1 and B = 1 then B Bar = 0. ORing of the variables is represented by a plus (+) sign between them. For example ORing of A, B, C is represented as A + B + C.
Logical ANDing of the two or more variable is represented by writing a dot or a 'x' between them such as AxBxC. Sometime the cross may be omitted like ABC.

Boolean Laws:

Commutative Law
Commutative law states that changing the sequence of the variables does not have any effect on the output of a logic circuit.
A+B=B+A
AxB=BxA

Associative law
This law states that the order in which the logic operations are performed is irrelevant as their effect is the same.
(A + B) + C = A + (B + C)
(AxB)xC = Ax(BxC)

Distributive law
Distributive law states the following condition.
Ax(B + C) = AxB + AxC
A + (BxC) = (A + B)x(A + C)

A useful look-up table:





Tasks:
(Show the calculation process for the credit. Complete these problems on papers)

1. Convert the following binary numbers to decimal numbers: (1) 1011 (2) 1000 (3) 1111 (4) 1011001 
2. Convert the following decimal numbers to binary numbers: (1) 10 (2) 8 (3) 16 (4) 52
3. Convert the following hexadecimal (Hex) numbers to binary number: (1) FEDC   (2) 10AB
4. Conver the following binary numbers to hex numbers: (1) 10101010  (2) 11011
5. Hand calculate (1) 110111 + 111111  (2) 1111 - 1010  (3) 10101 x 111  (4) 100010 / 101

6. Complete the following logic expressions:

AxA=               Ax0=              Ax1=                   AxA’=                   A+A=
A+0=               A+1=              A+A’=

7. Complete the following logic expressions:
A x A x A x A =
A x 1 x 0 x B =
((A + A) x A) + A =
A + 1 + A + B + 0 =
(A x A) + (A + A) =
1 + 1 =
A’ + A + A’ =
(A’ + A) x A =
A’ x (A + A x B) 0 x 0 =
1 + 0 =