Tuesday, 10 September 2024

Number system

 

Number system-

 Introduction -

  • Definition: A number system is a system for expressing numbers; it is a mathematical notation for representing numbers of a given set, using digits or symbols in a consistent manner.
  • Purpose: Different number systems are used in various fields like computing, engineering, mathematics, and everyday life to represent data and perform calculations.

Types of Number Systems

There are several types of number systems, each with a different base or radix, which determines how many unique digits are used in the system.

A . Binary Number System (Base 2)

  • Description: The binary number system is the foundation of all modern computing systems and digital electronics.
  • Digits Used: 0, 1
  • Base: 2
  • Applications: Used in computer science and digital electronics because it represents the two states (on and off) of electronic switches (transistors).

 

B . Decimal Number System (Base 10)

  • Description: The decimal number system is the most commonly used system, especially in everyday counting and arithmetic.
  • Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
  • Base: 10
  • Applications: Widely used in daily life for counting, financial calculations, and in various engineering applications.

C. Octal Number System (Base 8)

  • Description: The octal number system is less commonly used but can be found in some computing applications.
  • Digits Used: 0, 1, 2, 3, 4, 5, 6, 7
  • Base: 8
  • Applications: Used in computing as a shorthand representation for binary numbers because each octal digit represents three binary digits (bits).

D. Hexadecimal Number System (Base 16)

  • Description: The hexadecimal system is extensively used in computing and digital electronics to simplify binary coding.
  • Digits Used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A (10), B (11), C (12), D (13), E (14), F (15)
  • Base: 16
  • Applications: Used in computer science for memory addresses, color codes in web design (e.g., #FFFFFF for white), and in programming to represent binary data compactly.

 


 

Conversion Between Number Systems

Understanding how to convert numbers between different bases is crucial, especially in computer science and digital electronics.

A. Converting Decimal to Other Bases

  • Decimal to Binary: Repeatedly divide the decimal number by 2 and record the remainder. The binary number is the sequence of remainders read in reverse.
    • Example: Convert 13 to binary:

1.    13 ÷ 2 = 6 remainder 1

2.    6 ÷ 2 = 3 remainder 0

3.    3 ÷ 2 = 1 remainder 1

4.    1 ÷ 2 = 0 remainder 1

      • Binary: 1101
  • Decimal to Octal: Repeatedly divide the decimal number by 8 and record the remainder.
    • Example: Convert 100 to octal:

1.    100 ÷ 8 = 12 remainder 4

2.    12 ÷ 8 = 1 remainder 4

3.    1 ÷ 8 = 0 remainder 1

      • Octal: 144
  • Decimal to Hexadecimal: Repeatedly divide the decimal number by 16 and record the remainder.
    • Example: Convert 255 to hexadecimal:

1.    255 ÷ 16 = 15 remainder 15 (F)

2.    15 ÷ 16 = 0 remainder 15 (F)

      • Hexadecimal: FF

B. Converting from Binary to Other Bases

  • Binary to Decimal: Sum the products of each binary digit with its positional value, a power of 2.
    • Example: Convert 1011 to decimal: 1×23+0×22+1×21+1×20=8+0+2+1=111 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0 = 8 + 0 + 2 + 1 = 111×23+0×22+1×21+1×20=8+0+2+1=11
  • Binary to Octal: Group binary digits in sets of three from right to left and convert each group to its octal equivalent.
    • Example: Convert 110110 to octal:
      • Group: 110 110
      • Octal: 6 (110) 6 (110)
      • Result: 66
  • Binary to Hexadecimal: Group binary digits in sets of four from right to left and convert each group to its hexadecimal equivalent.
    • Example: Convert 10110110 to hexadecimal:
      • Group: 1011 0110
      • Hexadecimal: B (1011) 6 (0110)
      • Result: B6

C. Converting Between Octal and Hexadecimal

  • Octal to Binary: Convert each octal digit to its 3-bit binary equivalent.

Let's convert the octal number 345 to binary.

Ø Break down the octal number into individual digits:

§  3, 4, and 5.

Ø Convert each digit to its 3-bit binary equivalent:

§  3 in binary is 011

§  4 in binary is 100

§  5 in binary is 101

Ø Combine the binary equivalents:

§  345 (octal) → 011 100 101 (binary)

Ø Remove spaces for the final binary representation:

§  011100101

So, the octal number 345 is 011100101 in binary.

 

  • Hexadecimal to Binary: Convert each hexadecimal digit to its 4-bit binary equivalent.

Let's convert the hexadecimal number 2F3 to binary.

Ø Break down the hexadecimal number into individual digits:

§  2, F, and 3.

Ø Convert each digit to its 4-bit binary equivalent:

§  2 in binary is 0010

§  F in binary is 1111 (since F represents 15 in decimal)

§  3 in binary is 0011

Ø Combine the binary equivalents:

§  2F3 (hexadecimal) → 0010 1111 0011 (binary)

Ø Remove spaces for the final binary representation:

§  001011110011

So, the hexadecimal number 2F3 is 001011110011 in binary.

 

  • Octal to Hexadecimal: Convert octal to binary, then group binary digits in sets of four and convert to hexadecimal.

Let's convert the octal number 345 to hexadecimal.

Step 1: Convert octal to binary

  • 3 in binary is 011
  • 4 in binary is 100
  • 5 in binary is 101

So, 345 (octal) = 011 100 101 (binary).

Step 2: Group binary digits in sets of four

  • Binary representation is 011100101.
  • Add leading zeros to make the number of binary digits a multiple of four: 0011 1001 0101.

Step 3: Convert each group of four binary digits to hexadecimal

  • 0011 in binary is 3 in hexadecimal.
  • 1001 in binary is 9 in hexadecimal.
  • 0101 in binary is 5 in hexadecimal.

So, 345 (octal) = 395 (hexadecimal).

 

No comments:

Post a Comment

Control Panel in Windows OS

  Control Panel in Windows OS: The Control Panel in Windows is a centralized hub that provides users with tools and options to configure ...