Chapter_5_Numbring System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Chapter 5: numbering

system data &


representation.
Introduction to Numbering Systems
Numbering systems are fundamental to how
computers represent and process data. The
most commonly used systems are:
• Binary (Base-2)
• Octal (Base-8)
• Decimal (Base-10)
• Hexadecimal (Base-16)
Each system serves a unique purpose in data
representation, enabling efficient computation
and data manipulation.
What is Data Representation?
Data representation refers to the method by
which computers encode, store, and process
various types of data, such as text, numbers,
images, and multimedia. All data in a computer is
ultimately represented in binary format (using 0s
and 1s), which forms the foundation of digital
systems.
Why Do Computers Use Binary?
Binary (Base-2) is the core numbering system
for digital systems because it aligns with the
fundamental principles of electronic circuits,
which rely on two distinct states: ON and OFF.
These states are easily represented using the
digits 0 and 1, making binary the most efficient
way to encode and process data.
Why Binary?

• Simplicity: Binary uses just two states (0 and 1),


which map directly to electrical signals (on/off,
high/low voltage) in computer circuits.
• Reliability: The binary system is more robust to
noise and distortion in electrical signals, ensuring
accurate data transmission and processing.
• Example:
The binary number 101 is equal to 5 in decimal
(1 × 2² + 0 × 2¹ + 1 × 2⁰).
Octal Numbering system
Octal is a base-8 numbering system that uses digits
from 0 to 7. Each octal digit corresponds to exactly
three binary digits (bits), which makes it a
convenient shorthand for representing binary data.
• Digits: 0, 1, 2, 3, 4, 5, 6, 7.
• Conversion: Each octal digit represents three
binary digits (bits).
• Usage: Historically used in computing to simplify
binary representation (especially in early
computing systems), but is less commonly used
today compared to hexadecimal.
Decimal Numbering System

Decimal is the base-10 system, which uses digits from 0 to 9.


It is the standard system for daily human calculations and is
the most familiar to us.
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
• Usage: Primarily used in everyday life for counting,
arithmetic, and measuring.
• Commonly used in user interfaces and systems where
human interaction is required (e.g., calculators, money).
• Example:
• Decimal 25 is simply 25 (no conversion needed).
Hexadecimal (Base-16)

• Hexadecimal is a base-16 system that uses 16 digits: 0-


9 and A-F (where A = 10, B = 11, ..., F = 15).
Hexadecimal is widely used in computing, especially for
compactly representing large binary values.
• Key Points:
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
• Usage: Common in programming, memory addressing,
and representing colors in web design (RGB values).
• Relation to Binary: Each hexadecimal digit corresponds
to exactly 4 binary digits (bits), making it easier to
represent large binary numbers.
What is a Bit?

A bit (short for binary digit) is the smallest unit of data in


computing. It can represent one of two possible states: 0
or 1. In digital systems, these two states correspond to
OFF and ON, or low and high electrical voltages, in
electronic circuits:
• Bit = Binary Digit: A single unit of information (0 or 1).
• Used in: All digital data, from text to images, is
ultimately composed of bits.
• Computing: Computers process, store, and transmit
information in bits, often in large groups.
• Example: A bit might represent a simple decision: Yes
(1) or No (0).
What is a Byte?

A byte is a group of 8 bits and is the fundamental unit of data


storage in computers. Since one byte consists of 8 bits, it can
represent 256 different values (2⁸). Bytes are used to encode
more complex data, such as characters, numbers, or memory
addresses.
• Byte = 8 Bits: A byte consists of 8 binary digits (bits).
• Representation: A byte can represent one character in text
(e.g., 'A', '1', or '@').
• Memory: Computers organize data in bytes for storage and
processing (e.g., 1 KB = 1024 bytes).
• Example:
• The letter 'A' in the ASCII encoding is represented by the
byte 01000001.
Introduction to Binary Calculations
• Binary calculations are essential in computing because
digital systems, such as computers and processors, use
the binary system (Base-2) to represent and
manipulate data. Binary numbers consist of only two
digits: 0 and 1.
• Addition
• Subtraction
• Multiplication
• Division
• These operations are performed using binary digits
(bits), just like decimal calculations, but with the
difference that only two digits are involved.
Binary Addition

• Binary addition follows similar rules to


decimal addition but uses only 0 and 1. The
key rule is that when two 1's are added, the
result is 0, and a carry-over of 1 is generated.
• Binary Addition Rules:
❖0 + 0 = 0
❖0 + 1 = 1
❖1 + 0 = 1
❖1 + 1 = 10 (Carry 1)
Binary Addition
1011
+1101
_____
11000
❖we added two binary numbers (1011 and
1101) to get the result 11000.
Subtracting Binary
Binary Subtraction
Binary subtraction also works like decimal
subtraction. The only difference is that when
subtracting 1 - 0, the result is 1, and when 0 - 1, we
borrow from the next higher bit.
Binary Subtraction Rules:
• 0-0=0
• 1-0=1
• 1-1=0
• 0 - 1 = 1 (borrow 1)
Subtracting Binary
1101
1011
________
010
subtracting binary numbers results in 010.
Decimal System (Base-10)
• Decimal is the Base-10 system, using digits 0-
9.
• Example: 345 = (3×10²) + (4×10¹) + (5×10⁰).
• Why it matters: Humans naturally use decimal
for counting.
Binary to Decimal Conversion

To convert a binary number to decimal, we use the


positional value system. Each digit (bit) in the binary
number represents a power of 2, starting from the right
(least significant bit).
Conversion Process:
1. Write the binary number.
2. Assign each bit a power of 2, starting from 2⁰ on the
right.
3. Multiply each bit by its corresponding power of 2.
4. Add the results.
• Example: Convert 1011 (binary) to decimal
Binary to Decimal Conversion

So, 1011 in binary equals 11 in decimal.


Decimal to Binary Conversion
• Problem: Convert Decimal 27 to Binary.
• Solution: Repeated division by 2:
• 27 ÷ 2 = 13 R1, 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷
2 = 1 R1, 1 ÷ 2 = 0 R1.
• Answer: Binary = 11011.
Octal conversion
• Example:
• Octal 17 = 1 × 8¹ + 7 × 8⁰ = 15 (decimal).
• In binary, 17 (octal) = 111111 (binary).
Octal 17 in octal = 001 in binary7 in octal = 111
in binary Combine the binary values:17 (octal) =
001 111 (binary)→ 11111 (binary)
Binary to Octal Conversion
• Problem: Convert Binary '101110' to Octal.
• Solution: Group in sets of 3 bits: 101 110 →
Octal 56.
Octal to Binary Conversion
• Problem: Convert Octal '17' to Binary.
• Solution: Expand each octal digit: 1 → 001, 7
→ 111 → Binary 001111.
Hexadecimal System (Base-16)
• Hexadecimal uses digits 0-9 and letters A-F
(for 10-15).
• Example: Binary '110011' → Hexadecimal '33'
(group in sets of 4 bits).
• Use case: Memory addresses and HTML
colors.
Hexadecimal to Binary Conversion
• Problem: Convert Hexadecimal '2F' to Binary.
• Solution: Expand each digit: 2 → 0010, F →
1111 → Binary 00101111.
Binary to Hexadecimal Conversion
• Problem: Convert Binary '11101101' to
Hexadecimal.
• Solution: Group in sets of 4 bits: 1110 1101 →
Hexadecimal ED.
ASCII and Unicode
• ASCII: A character encoding standard using 7
bits to represent 128 characters.
• Example: 'A' = 65, 'a' = 97.
• Unicode: Extends ASCII to support characters
from all languages and symbols.
• Example: Emoji = U+1F60A.
Applications of ASCII and Unicode
• ASCII is used for basic text representation and
is lightweight.
• Unicode enables multilingual applications and
supports symbols, emojis, and complex
scripts.
• Example: Unicode is essential for web and
mobile applications.
Numbering Systems in Data
Representation
• Text: ASCII and Unicode use binary to encode
characters.
• Images: Pixels represented as binary RGB
values.
• Audio: Sampled and stored as binary data at
specific bit depths and rates.
• Video: Frames encoded as binary using
compression techniques.
Conclusion
• Key Points:
• 1. Numbering systems enable efficient data
encoding, processing, and storage.
• 2. Binary is the backbone of computing.
• 3. Understanding conversions is essential for
programming and data analysis.
• Takeaway: Mastering these concepts is vital
for anyone in technology or computing.
References
1. Muqaal youtube ah.
https://youtu.be/lYMCKNaGDQM?si=JQlgrYO
FB3sbE1E5
2. https://youtu.be/VLflTjd3lWA?si=A2V79hVo
OeD_U03C
NB: Link-ga 2aad waxaad daawan karta playlist
23 muuqaal ka kooban oo ku saabsan
numbering system.

You might also like