Unit  4
Numbers Systems and Logic Gates
The Number System represents the value of a number in relation to its basis. A number has a unique representation based on its Base value, and different number systems have different representations of the same number. In microprocessor programming, for example, binary, octal, decimal, and hexadecimal number systems are utilized.
When a number system's base value is 10, it's known as a decimal number system, and it plays a crucial part in the advancement of science and technology. The value of each digit is determined by its position (or weight) in a number in the weighted (or positional) number representation.
This is also known as the base10 number system, which includes ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and so on. Every digit's position has a weight that is a power of ten. Each position in the decimal system has ten times the significance of the preceding position, which implies that the numeric value of a decimal number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products.
The following are some examples of decimal numbers:
(12)10, (345)10, (119)10, (200)10, (313.9)10
The decimal system is a number representation system that employs digits from 0 to 9 to represent a number with base 10. The number is expressed in base10, with 0 or the first nine positive integers denoting each value. The place value of power 10 is assigned to each value in this number system. It signifies that the numeral in the tens place is ten times the digit in the unit place.
More example
(92)10 = 9×101+2×100
(200)10 = 2×102+0x101+0x100
The decimal numbers which have digits present on the right side of the decimal (.) denote each digit with decreasing power of 10. Some examples are:
(30.2)10= 30×101+0x102+2×101
(212.367)10 = 2×102+1×101+2×100+3×101+6×102+7×103
Advantages and Disadvantages
The key advantages of the Decimal Number System are that it is simple to read, use, and alter.
However, there are certain drawbacks, such as squandering space and time. Because digital systems (e.g., computers) and hardware are based on the binary system (either 0 or 1), each bit of a decimal number requires 4 bits of space, whereas a hexadecimal number requires only 4 bits and has more digits than a decimal number, which is an advantage of the Hexadecimal Number System.
Key takeaway
When a number system's base value is 10, it's known as a decimal number system.
This is also known as the base10 number system, which includes ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and so on.
One type of Number Representation approach is the Binary Number System. It's the most common and widely utilized in digital systems. The binary system is used to describe binary quantities that can be represented by any device with only two possible operating states. A switch, for example, has only two states: open and closed.
One of the four types of number systems is a binary number system. Binary numbers are represented by simply two symbols or digits in computer applications, namely 0 (zero) and 1 (one) (one). The base2 numeral system is used to express the binary numbers. A binary number, for example, is (101)2. In this approach, each digit is referred to as a bit.
There are just two symbols or possible digit values in the Binary System, namely 0 and 1. Any device with only two functioning states or conceivable circumstances is represented by this term. The addition of a 0b prefix or a 2 suffix to a binary number indicates it is binary.
Every digit's position has a weight that is a power of two. Each place in the Binary system is worth twice as much as the preceding one, hence the numeric value of a Binary number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the results. As a result, it's also a weighted (or positional) number system.
Binary Number Tables
Number  Binary Number  Number  Binary Number  Number  Binary Number 
1  1  11  1011  21  10101 
2  10  12  1100  22  10110 
3  11  13  1101  23  10111 
4  100  14  1110  24  11000 
5  101  15  1111  25  11001 
6  110  16  10000  26  11010 
7  111  17  10001  27  11011 
8  1000  18  10010  28  11100 
9  1001  19  10011  29  11101 
10  1010  20  10100  30  11110 
Example 1:
The number 90.75 is interpreted as
90.75 = 1x26+0x25+1x24+1x23+0x22+1x21+0x20+1x21+1x22=1011010.11
Example 2:
A decimal number 21 to represent in Binary representation
(21)10 =16+0+4+0+1 = 1x24+0x23+1x22+0x21+1x20 = (10101)2
So, the decimal value 21 is equivalent to 10101 in the Binary Number System.
Key takeaway
The binary system is used to describe binary quantities that can be represented by any device with only two possible operating states.
The base2 numeral system is used to express the binary numbers.
A binary number, for example, is (101)2. In this approach, each digit is referred to as a bit.
One form of Number Representation approach is the Octal Number System, in which the base value is 8. That means there are just eight symbols or digit values available: 0, 1, 2, 3, 4, 5, 6, 7. Any digit's value can be represented using only three bits. The addition of a 0o prefix or an 8 suffix to an octal number indicates it is an octal number.
Every digit's position has a weight that is a power of eight. Each place in the Octal system is 8 times more significant than the preceding position, so that the numeric value of an octal number is calculated by multiplying each digit by the value of the position in which the digit appears, then adding the products. So, it is also a positional (or weighted) number system.
Representation
Each Octal number can be expressed using only three bits, with distich values ranging from 000 (for 0) to 111 (for 7 = 4+2+1). The binary equivalents of Octal numbers are listed below 
Octal Digit Value  Binary Equivalent 
0  000 
1  001 
2  010 
3  011 
4  100 
5  101 
6  110 
7  111 
Example
The number 65.125 can be translated as
65.125 =1x82+0x81+1x80+1x81=101.10
The least significant bit (LSB) is 0 on the right, and the most significant bit is 1 on the left (MSB).
Application
The use of octal numerals isn't as popular as it once was. When the amount of bits in a single word is a multiple of three, however, Octal is employed. It's also a shortcut for representing file permissions on UNIX systems and UTF8 integers, among other things.
Advantages and Disadvantages
The key advantage of adopting Octal numbers over decimal and hexadecimal numbers is that it needs fewer digits. As a result, there are fewer computations and errors. It simply takes three bits to represent any binary digit, and it's simple to convert from octal to binary and vice versa. Input and output are easier to manage with the octal format.
The main problem of the octal number system is that computers cannot understand it directly, necessitating the use of an octal to binary converter.
Key takeaway
One form of Number Representation approach is the Octal Number System, in which the base value is 8. That means there are just eight symbols or digit values available: 0, 1, 2, 3, 4, 5, 6, 7.
The Hexadecimal Number System is a sort of numerical representation in which the base number is 16. This indicates that there are only 16 potential digit values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Where A, B, C, D, E, and F represent the decimal values 10, 11, 12, 13, 14, and 15 in single bits. Any digit's value can be represented using only four bits. The addition of a 0x prefix or a h suffix to a decimal number indicates it is hexadecimal.
Every digit's position has a weight that is a power of 16. The numeric value of a hexadecimal number is found by multiplying each digit by the value of the place in which the digit appears and then adding the products in the Hexadecimal system. As a result, it's also a weighted (or positional) number system.
Hexadecimal number systems can be translated to binary (base2) and octal (base8) number systems, as well as decimal number systems (base10). The notion of the number system is extensively covered in the Class 9 syllabus.
The table below contains a list of 16 hexadecimal digits and their equivalent decimal, octal, and binary representations, which will aid in number system conversion. This list can also be used as a converter or translator.
Representation
The table below shows the comparable values of binary and decimal number systems in hexadecimal number systems.
Decimal Numbers  4bit Binary Number  Hexadecimal Number 
0  0000  0 
1  0001  1 
2  0010  2 
3  0011  3 
4  0100  4 
5  0101  5 
6  0110  6 
7  0111  7 
8  1000  8 
9  1001  9 
10  1010  A 
11  1011  B 
12  1100  C 
13  1101  D 
14  1110  E 
15  1111  F 
Example
The number 2015.0625 is interpreted as
2015.0625=7x162+13x161+15x160+1x161=7DF.10
Here, right most bit 0 is the least significant bit (LSB) and left most bit 7 is the most significant bit (MSB).
Application
In computer programming and microprocessors, the Hexadecimal Number System is widely utilized. Color descriptions on web pages are also useful. Each of the three fundamental colors (red, green, and blue) is represented by two hexadecimal digits, yielding 255 potential values and a total of over 16 million colors. Every byte is described in memory using the hexadecimal number system. For Computer Professionals, hexadecimal numbers are also easier to understand and write than binary or decimal numbers.
Advantages and Disadvantages
Hexadecimal numbers have the advantage of requiring less memory to hold more numbers; for example, it can store 256 numbers in two digits, but decimal numbers can only store 100 numbers in two digits. Computer memory addresses are also represented using this number system. It is simple to convert from hexadecimal to binary and vice versa since it just takes four bits to represent every digit in binary. Input and output are easier to manage in hexadecimal format. In the fields of data science, artificial intelligence, and machine learning, there are numerous benefits.
The main problem of the Hexadecimal number system is that it is difficult for people to read and write it, and it is also difficult to execute operations such as multiplications and divisions using it. The most complex number system for working with computer data is hexadecimal.
Key takeaway
The Hexadecimal Number System is a sort of numerical representation in which the base number is 16.
This indicates that there are only 16 potential digit values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Conversion from decimal to other number system
● Decimal to Binary
To convert a decimal number to a binary counterpart, divide the original number system by 2 until the quotient is 0, at which point no more division is feasible. The residue is counted for the needed number in LSB (least significant bit) to MSB (most significant bit) order (most significant bit). Let's have a look at an example.
Example  Convert 2610 into a binary number.
Given 2610 is a decimal number.
Divide 26 by 2
26/2 = 13 Remainder →0 (MSB)
13/2 = 6 Remainder →1
6/2 = 3 Remainder →0
3/2 = 1 Remainder →1
½ = 0 Remainder →1 (LSB)
Hence, the equivalent binary number is (11010)2
● Decimal to Octal
The decimal number must be divided by 8 until the quotient reaches 0 in this case. Then we count the remainder from LSB to MSB in the same way to get the equivalent octal number.
Example: Convert 6510 into an octal number.
Given 6510 is a decimal number.
Divide by 8
65/8 = 8 Remainder →1 (MSB)
8/8 = 1 Remainder →0
⅛ = 0 Remainder →1 (LSB)
Hence, the equivalent octal number is (101)8
● Decimal to Hexadecimal
To get the comparable hex, divide the given decimal number by 16. We keep dividing the number until we achieve the quotient 0.
Example: Convert 12710 to a hexadecimal number.
Given 12710 is a decimal number.
Divide by 16
127/16 = 7 Remainder →15
7/16 = 0 Remainder → 7
In the hexadecimal number system, alphabet F is considered as 15.
Hence, 12710 is equivalent to 7F16
Conversion from binary to other number system
● Binary to octal
With the help of the table below, you may convert a binary number to an octal number.
Octal Number  Equivalent Binary Number 
0  0 
1  1 
2  10 
3  11 
4  100 
5  101 
6  110 
7  111 
Example  Convert (100010)2 to octal number.
With the help of the table we can write,
100→4
And 010→2
Therefore, (100010)2 = 42
Similarly, we can convert an octal number to a binary number with the help of the table.
● Binary to decimal
Converting from binary to hexadecimal is a simple process. All you have to do now is convert the binary numbers to hexadecimal numbers.
Example: Convert (11011)2 to decimal number.
Given (11011)2 a binary number.
We need to multiply each binary digit with the decreasing power of 2. That is;
1×24+1×23+0x22+1×21+1×20
=16+8+0+2+1
=27
Therefore, (11011)2 = (27)10
● Binary to hexadecimal
Converting from binary to hexadecimal is a simple process. All you have to do now is convert the binary numbers to hexadecimal numbers.
Example: Convert (11100011)2 to hexadecimal.
From the table, we can write, 11100011 as E3.
Therefore, (11100011)2 = (E3)16
Conversion from octal to other number system
● Octal to binary
The octal number table can also be used to convert a number with base 8 to a number with base 2. We can also convert a binary number to an octal number using this table. Let's start with the table.
Octal Number  Equivalent Binary Number 
0  000 
1  001 
2  010 
3  011 
4  100 
5  101 
6  110 
7  111 
Example: Convert 128 into a binary number.
Given, 128 is the octal number.
Now with the help of the table, we can write;
128 = (001 010)2
Since zeros on the left, most of digit 1 does not have any significance. Thus,
128 = (1010)2
● Octal to decimal
To convert an octal number to a decimal number, multiply each of the octal's digits by the reduction power of eight.
Let's look at how to convert an octal number to a decimal number, or how to go from base 8 to base 10.
Example  Let 125 is an octal number denoted by 1258. Find the decimal number.
1258 = 1× 82 + 2 × 81 + 5 × 80
= 1 × 64 + 2 × 8 + 5 × 1 = 64+16+5
=8510
● Octal to hexadecimal
Numbers and alphabets make up hexadecimal numbers. Base 16 is used to represent it. From 0 to 9, the numbers are written as normal, but from 10 to 15, they are written as A, B, C, D, E, and F. Two steps are required to convert an octal number to hexadecimal.
Convert the octal number to a decimal number first.
After that, transform the decimal number to hexadecimal.
Let's look at an example to help us understand. We'll use the same example of converting an octal number to a decimal number, such as;
(55)8 = (45)10
Divide 45 by 16 until you have a remainder less than 16 then convert (45)10 to a hexadecimal value.
Therefore, we can write, (45)10 = (2D)16
Or (55)8 = (2D)16
Conversion from hexadecimal to other number system
● Hexadecimal to binary
The encoding of a hexadecimal number in binary form is shown here. Each hexadecimal number can be represented with only four digits, with each group having a different value ranging from 0000 (for 0) to 1111 (for F= 15 =8 + 4 + 2 + 1).
Hexadecimal  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F 
Binary  0  1  10  11  100  101  110  111  1000  1001  1010  1011  1100  1101  1110  1111 
● Hexadecimal to octal
The representation of a hexadecimal number in octal number form is shown here.
Hexadecimal  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F 
Decimal  0  1  2  3  4  5  6  7  10  11  12  13  14  15  16  17

● Hexadecimal to decimal
The representation of a hexadecimal number in decimal form is shown here.
Hexadecimal  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F 
Decimal  0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15

Logic gates are the fundamental components of any digital system. It's an electrical circuit with only one output and one or more inputs. A specific logic governs the relationship between the input and the output. AND gate, OR gate, NOT gate, and so on are examples of logic gates.
AND Gate
The AND gate is an electrical circuit that only outputs a high value (1) if all of its inputs are also high. The AND operation, i.e., A.B., is represented by a dot (.). It's worth noting that this dot is sometimes deleted, as in AB.
Logic diagram
Fig 1: AND gate
Truth table
OR Gate
If one or more of its inputs are high, the OR gate produces a high output (1). The OR operation is represented by a plus (+).
Logic diagram
Fig 2: OR gate
Truth table
Not Gate
The NOT gate is a type of electrical circuit that outputs an inverted version of the input. An inverter is another name for it. The inverted output is known as NOT A if the input variable is A. As shown at the outputs, this is also displayed as A', or A with a bar over the top. The diagrams below demonstrate two different ways to arrange the NAND logic gate to form a NOT gate. In the same way, it may be done with NOR logic gates.
Logic diagram
Fig 3: NOT gate
Truth table
Key takeaway
The AND gate is an electrical circuit that only outputs a high value (1) if all of its inputs are also high.
If one or more of its inputs are high, the OR gate produces a high output (1). The OR operation is represented by a plus (+).
The NOT gate is a type of electrical circuit that outputs an inverted version of the input. An inverter is another name for it.
The NAND and NOR gates are called universal functions since with either one the AND and OR functions and NOT can be generated.
NAND Gates
This is a NOTAND gate, which is a combination of an AND gate and a NOT gate. If any of the inputs is low, the outputs of all NAND gates are high. An AND gate with a little circle on the output is the symbol. Inversion is represented by the little circle.
Logic diagram
Fig 4: NAND gate
Truth table
NOR Gates
This is a NOTOR gate, which is a combination of an OR gate and a NOT gate. If any of the inputs is high, the outputs of all NOR gates are low.
An OR gate with a little circle on the output is the symbol. Inversion is represented by the little circle.
Logic diagram
Fig 5: NOR gate
Truth table
Key takeaway
NAND is a NOTAND gate, which is a combination of an AND gate and a NOT gate.
NOR is a NOTOR gate, which is a combination of an OR gate and a NOT gate.
References:
 Nishit Mathur, Fundamentals of Computer, Aph publishing corporation (2010)
 Misty E. Vermaat, Microsoft word 2013 1st Edition (2013).
 Satish Jain, M. Geeta, MS Office 2010 Training Guide, BPB publication (2010)
 Joan Preppernau, Microsoft PowerPoint 2016 step by step, Microsoft press (2015)
 Douglas E Corner, The Internet Book 4th Edition, prentice –Hall (2009)
 Https://www.tutorialspoint.com/computer_logical_organization/number_system_conversion.htm
 Https://byjus.com/maths/decimalnumbersystem/