Number Systems

Learning Objectives

  • Learn about number systems.
  • Understand digits and bases of different number systems.
  • Represent values in decimal, binary, octal, and hexadecimal number systems.
  • Convert between decimal and binary.
  • Convert from decimal to octal and hexadecimal number systems.

Introduction to Number Systems

  • Computers operate using the binary system (0s and 1s).
  • Number systems are used to represent different quantities.
  • Computers translate inputs (letters, words, graphics, videos) into binary numbers.
  • Various number systems exist, including octal and hexadecimal, which use combinations of digits to represent quantities.

Need for Number Systems

  • Humans use numbers like 1, 2, 3, etc., for counting.
  • Computers understand machine language (0s and 1s).
  • Inputs given to the computer are converted into machine language.

Value of Digits in a Number

The value of each digit depends on:

  • The face value of the digit (e.g., 1, 2, 5, 6).
  • The place value of the digit (units, tens, hundreds, thousands, etc.).
  • The base value of the number system.

Types of Number Systems

  • Decimal Number System
  • Binary Number System
  • Octal Number System
  • Hexadecimal Number System

Decimal Number System

  • Consists of ten digits (0 to 9).
  • Base 10.
  • Numbers are used individually or in groups (e.g., 25, 8, 256, 295).
  • The subscript 10 indicates a decimal number [e.g., (35)<em>10(35)<em>{10}, (897)</em>10(897)</em>{10}, (3215)10(3215)_{10}].
  • Example: 1256 can be explained as:
    • 1×1031 \times 10^3 (Thousands) = 1000
    • 2×1022 \times 10^2 (Hundreds) = 200
    • 5×1015 \times 10^1 (Tens) = 50
    • 6×1006 \times 10^0 (Units) = 6
    • Total: 1000 + 200 + 50 + 6 = 1256

Binary Number System

  • Also called base 2 number system.
  • Uses only two digits: 0 and 1.
  • 0 represents the OFF state, and 1 represents the ON state of a signal.
  • The subscript 2 indicates a binary number [e.g., (1010)<em>2(1010)<em>2, (1111)</em>2(1111)</em>2, (101101)2(101101)_2].

Octal Number System

  • Consists of 8 digits (0 to 7).
  • Base 8.
  • The subscript 8 indicates an octal number [e.g., (45)<em>8(45)<em>8, (675)</em>8(675)</em>8, (321)8(321)_8].

Hexadecimal Number System

  • Consists of 16 digits (0 - 15), represented by 0-9 and A-F (where A=10, B=11, C=12, D=13, E=14, F=15).
  • Base 16.
  • The subscript 16 indicates a hexadecimal number [e.g., (7A)<em>16(7A)<em>{16}, (76F)</em>16(76F)</em>{16}, (34E)16(34E)_{16}].
  • One hexa digit is sometimes referred to as a nibble.

Representing Values in Different Number Systems

  • A decimal value can be represented in binary, octal, and hexadecimal systems.

Conversion of Decimal Number into Binary Number

Steps:

  1. Divide the number by 2.
  2. Write down the remainder and divide the quotient again by 2.
  3. Repeat step 2 until the quotient is zero.
  • Example 1: Convert 125 into binary form.
    • 125 ÷ 2 = 62, Remainder 1
    • 62 ÷ 2 = 31, Remainder 0
    • 31 ÷ 2 = 15, Remainder 1
    • 15 ÷ 2 = 7, Remainder 1
    • 7 ÷ 2 = 3, Remainder 1
    • 3 ÷ 2 = 1, Remainder 1
    • 1 ÷ 2 = 0, Remainder 1
    • So, (125)<em>10=(1111101)</em>2(125)<em>{10} = (1111101)</em>2
  • Example 2: Convert 76 into binary form.
    • 76 ÷ 2 = 38, Remainder 0
    • 38 ÷ 2 = 19, Remainder 0
    • 19 ÷ 2 = 9, Remainder 1
    • 9 ÷ 2 = 4, Remainder 1
    • 4 ÷ 2 = 2, Remainder 0
    • 2 ÷ 2 = 1, Remainder 0
    • 1 ÷ 2 = 0, Remainder 1
    • So, (76)<em>10=(1001100)</em>2(76)<em>{10} = (1001100)</em>2

Conversion of Binary Number into Decimal Number

Steps:

  1. Multiply each binary digit with multiples of 2, starting from the right.
  2. Increase the power of 2 one by one.
  3. Sum up all the products to get the decimal form.
  • Example 1: Convert (100100)2(100100)_2 into decimal form.
    • (0×20)+(0×21)+(1×22)+(0×23)+(0×24)+(1×25)(0 \times 2^0) + (0 \times 2^1) + (1 \times 2^2) + (0 \times 2^3) + (0 \times 2^4) + (1 \times 2^5)
    • =0+0+4+0+0+32= 0 + 0 + 4 + 0 + 0 + 32
    • =36= 36
    • Thus, (100100)<em>2=(36)</em>10(100100)<em>2 = (36)</em>{10}
  • Example 2: Convert (1001)2(1001)_2 into decimal form.
    • (1×20)+(0×21)+(0×22)+(1×23)(1 \times 2^0) + (0 \times 2^1) + (0 \times 2^2) + (1 \times 2^3)
    • =1+0+0+8= 1 + 0 + 0 + 8
    • =9= 9
    • Thus (1001)<em>2=(9)</em>10(1001)<em>2 = (9)</em>{10}

Conversion of a Decimal Number into Octal Number

Steps:

  1. Divide the number by 8.
  2. Write down the remainder and divide the quotient again by 8.
  3. Repeat step 2 until the quotient is less than 8.
  • Example 1: Convert 65 to octal number system.
    • 65 ÷ 8 = 8, Remainder 1
    • 8 ÷ 8 = 1, Remainder 0
    • So, (65)<em>10=(101)</em>8(65)<em>{10} = (101)</em>8
  • Example 2: Convert 145 into octal number system.
    • 145 ÷ 8 = 18, Remainder 1
    • 18 ÷ 8 = 2, Remainder 2
    • So, (145)<em>10=(221)</em>8(145)<em>{10} = (221)</em>8

Conversion of a Decimal Number to Hexadecimal Number

Steps:

  1. Divide the number by 16.
  2. Write down the remainder and divide the quotient again by 16.
  3. Repeat step 2 until the quotient is less than 16.
  • Example 1: Convert 34 into hexadecimal number.
    • 34 ÷ 16 = 2, Remainder 2
    • So, (34)<em>10=(22)</em>16(34)<em>{10} = (22)</em>{16}
  • Example 2: Convert 135 into hexadecimal number.
    • 135 ÷ 16 = 8, Remainder 7
    • So, (135)<em>10=(87)</em>16(135)<em>{10} = (87)</em>{16}

Summary

  • A number system is a way to represent different quantities.
  • The decimal number system consists of ten digits (0 to 9) with base 10.
  • The base of the binary number system is 2.
  • The octal number system consists of 8 digits (0-7) with base 8.
  • The hexadecimal number system consists of 16 digits (0-9, A-F) with base 16.

Remembered Perception

  • Aryabhatta gave the concept of 0 .