0% found this document useful (0 votes)
6 views

Unit 2

This document provides an in-depth overview of number systems used in computing, including binary, octal, and hexadecimal systems, along with their conversions and representations. It covers Binary Coded Decimal (BCD), complements, and binary arithmetic operations such as addition and subtraction using 2's complement. Understanding these concepts is essential for working with digital circuits and programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Unit 2

This document provides an in-depth overview of number systems used in computing, including binary, octal, and hexadecimal systems, along with their conversions and representations. It covers Binary Coded Decimal (BCD), complements, and binary arithmetic operations such as addition and subtraction using 2's complement. Understanding these concepts is essential for working with digital circuits and programming.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Unit 2

Number Systems: Binary, Octal and Hexadecimal number systems, Binary Coded Decimals

(BCD), Binary Coded Octals (BCO), Binary Coded Hexadecimals (BCH), 1's complement, 2's

complement, conversion from one number system to another, binary arithmetic (addition,

subtraction), binary subtraction using 2’s complement.

# **Number Systems in Computing**

A **number system** is a way of representing numbers using a consistent set of symbols and
rules. In computing, different number systems are used to represent and process data
efficiently. The most common number systems are **binary, octal, and hexadecimal**, which
are extensively used in digital electronics and computer science.

This section provides a **university-level** in-depth explanation of number systems,


conversions, complements, and binary arithmetic.

---

## **1. Types of Number Systems**

| Number System | Base | Digits Used | Example |

|--------------|------|------------|---------|

| Decimal | 10 | 0-9 | 25, 384, 99 |

| Binary | 2 | 0, 1 | 1011, 1101 |

| Octal | 8 | 0-7 | 47, 175 |

| Hexadecimal | 16 | 0-9, A-F | 3F, 7A |

Each number system has a **base**, which determines the number of unique digits used.
---

## **2. Binary Number System (Base 2)**

- **Uses only two digits: 0 and 1.**

- The **least significant bit (LSB)** is the rightmost bit, and the **most significant bit (MSB)**
is the leftmost bit.

- **Widely used in digital electronics and computing** since computers use electrical signals
(ON = 1, OFF = 0).

### **2.1 Representation of Decimal in Binary**

Each binary digit represents a power of **2**:

For example, the decimal number **13** is represented in binary as:

\[

13_{10} = 1 \times 2^3 + 1 \times 2^2 + 0 \times 2^1 + 1 \times 2^0 = 1101_2

\]

---

## **3. Octal Number System (Base 8)**

- Uses **eight digits (0-7)**.

- Convenient in computing because **three binary digits** form one octal digit.

### **3.1 Conversion from Binary to Octal**

- Group the binary digits into **groups of three** (from right to left).
- Convert each group to its octal equivalent.

Example: Convert **101101_2** to octal.

**Step 1:** Group the binary digits: **101 101**

**Step 2:** Convert each group:

- **101₂ = 5₈**

- **101₂ = 5₈**

Thus, **101101₂ = 55₈**.

---

## **4. Hexadecimal Number System (Base 16)**

- Uses **16 digits: 0-9 and A-F** (A = 10, B = 11, ..., F = 15).

- Convenient because **four binary digits** represent one hexadecimal digit.

### **4.1 Conversion from Binary to Hexadecimal**

- Group the binary digits into **groups of four** from right to left.

- Convert each group to its hexadecimal equivalent.

Example: Convert **11011101₂** to hexadecimal.

**Step 1:** Group the binary digits: **1101 1101**

**Step 2:** Convert each group:

- **1101₂ = D₁₆**
- **1101₂ = D₁₆**

Thus, **11011101₂ = DD₁₆**.

---

## **5. Binary Coded Decimal (BCD), Binary Coded Octal (BCO), and Binary Coded
Hexadecimal (BCH)**

### **5.1 Binary Coded Decimal (BCD)**

- A method of representing **each decimal digit separately** in **4-bit binary**.

- Example:

- **27₁₀** in BCD:

- **2 = 0010₂**

- **7 = 0111₂**

- So, **27₁₀ = 0010 0111 (BCD)**.

### **5.2 Binary Coded Octal (BCO)**

- Each **octal digit** is represented as a **3-bit binary number**.

- Example:

- **75₈** in binary:

- **7 = 111₂**

- **5 = 101₂**

- So, **75₈ = 111101 (BCO)**.

### **5.3 Binary Coded Hexadecimal (BCH)**


- Each **hexadecimal digit** is represented using **4-bit binary**.

- Example:

- **A3₁₆** in binary:

- **A = 1010₂**

- **3 = 0011₂**

- So, **A3₁₆ = 1010 0011 (BCH)**.

---

## **6. Complements (1’s and 2’s Complement)**

Complements are used in digital circuits for **subtraction and error detection**.

### **6.1 1’s Complement**

- **Invert all bits (0 → 1, 1 → 0).**

Example:

- **101100₂** → **010011₂** (1’s Complement).

### **6.2 2’s Complement**

- **Find 1’s complement and add 1 to the result.**

Example:

- **101100₂** → 1’s complement = **010011₂**

- **010011₂ + 1 = 010100₂** (2’s Complement).


2’s complement is widely used for **binary subtraction**.

---

## **7. Conversion Between Number Systems**

### **7.1 Decimal to Binary (Division Method)**

Divide the decimal number by **2**, recording the remainder each time.

Example: Convert **19₁₀** to binary.

\[

19 ÷ 2 = 9 \text{ remainder } 1

9 ÷ 2 = 4 \text{ remainder } 1

4 ÷ 2 = 2 \text{ remainder } 0

2 ÷ 2 = 1 \text{ remainder } 0

1 ÷ 2 = 0 \text{ remainder } 1

\]

Reading from bottom to top: **19₁₀ = 10011₂**.

---

## **8. Binary Arithmetic**

### **8.1 Binary Addition**

Follows the same rules as decimal addition, with a **carry-over at 2 (10₂)**.


| Binary Addition | Result |

|----------------|--------|

|0+0 |0 |

|0+1 |1 |

|1+0 |1 |

|1+1 | 10 (carry 1) |

Example:

\[

1011_2 + 1101_2 =

\]

```

1011

+ 1101

---------

11000

```

Answer: **11000₂**.

### **8.2 Binary Subtraction Using 2’s Complement**

1. Take the **2’s complement** of the subtrahend.

2. Add it to the minuend.

3. Ignore the final carry (if any).

Example: **Subtract 9₁₀ (1001₂) from 13₁₀ (1101₂)**


**Step 1:** Find **2’s complement** of **1001₂**

- 1’s complement: **0110₂**

- Add 1: **0111₂**

**Step 2:** Add to 1101₂

```

1101

+ 0111

---------

10100 (Ignore carry)

```

Answer: **0100₂ (4₁₀)**.

---

## **Conclusion**

Number systems are fundamental to digital computing. The **binary system** forms the core
of computer operations, while **octal and hexadecimal** simplify binary representation.
Understanding **complements and binary arithmetic** is crucial for working with digital
circuits, microprocessors, and low-level programming.

Would you like further elaboration on any section?

You might also like