Unit 1: Introduction [6 Hours]
Digital systems represent, process, store, and communicate information using discrete values, most commonly binary 0 and 1. This unit begins with analog and digital signals, then develops the ideas behind digital systems and the Integrated Circuit (IC). It also covers number systems, digital codes such as Binary-Coded Decimal (BCD), Gray and Excess-3, character representation, binary arithmetic, complements, and signed-number representation. Together, these ideas form the basic language used to represent data inside digital electronic and computing systems.
Tested Topics
- Gray code and conversion — 3x (2024, April 2023, October 2023)
- Number-system conversion — 3x (2024, April 2023, October 2023)
- BCD code and arithmetic — 2x (2024, 2024)
- Digital system fundamentals — 2x (April 2023, October 2023)
- Binary data combinations — 1x (April 2023)
- Digital IC characteristics — 1x (Model Q)
- Two's-complement arithmetic — 1x (October 2023)
1.1 Digital Versus Analog Signals
Definition
An analog signal is a signal whose value can change continuously over a range, whereas a digital signal represents information using a limited set of discrete levels, commonly logic 0 and logic 1.
An analog signal can take many values between its minimum and maximum. A digital signal works with separate, recognizable levels. For example, the continuously changing voltage produced by a microphone is analog, while the sequence of binary values stored in a computer is digital.
Detailed Explanation
A signal is a physical quantity that carries information. Voltage, current, light intensity, pressure, sound level, and radio-wave amplitude can all be used as signals.
The key difference between analog and digital representation is how possible values are treated.
- Analog: information varies continuously with time or amplitude.
- Digital: information is represented using distinct states or ranges.

Analog Signal
An analog signal may take any value within its allowed range. If a temperature sensor produces 0 to 5 volts, its output might be 1.72 V, 1.721 V, 1.7214 V, or another value permitted by the physical system.
Natural physical quantities are commonly analog before they are measured and digitally encoded. Examples include:
- sound pressure produced by speech,
- room temperature,
- light intensity,
- speed of a moving vehicle,
- air pressure,
- the voltage generated by many sensors.
Digital Signal
A digital signal uses a finite number of recognizable levels. In binary digital electronics, two logical states are used:
- logic 0, commonly called LOW,
- logic 1, commonly called HIGH.
Logic 0 and logic 1 do not necessarily mean exactly 0 V and exactly one particular higher voltage. A real digital circuit normally recognizes a range of voltages as LOW and another range as HIGH. This allows the circuit to tolerate a certain amount of electrical noise.
Comparison of Analog and Digital Signals
| Basis | Analog Signal | Digital Signal |
|---|---|---|
| Values | Continuous values | Discrete values |
| Typical representation | Smoothly varying waveform | Distinct logic levels or pulses |
| Noise effect | Noise directly changes the signal value | Small disturbances can often be rejected while the signal remains within valid logic ranges |
| Storage | Requires analog recording or representation | Can be conveniently stored as binary data |
| Processing | Performed using analog circuits | Performed using digital logic circuits |
| Copying | Successive copies may accumulate distortion | Binary information can be regenerated from valid logic states |
| Examples | Microphone voltage, analog thermometer output | Computer data, digital clock data, binary communication |
Why Digital Representation Is Widely Used
Digital systems are attractive because information can be represented by a small number of clearly separated states. A receiving circuit does not need to reproduce the exact transmitted voltage. It mainly needs to decide which logical state the voltage represents.
This leads to several practical benefits:
- Noise tolerance: moderate disturbances may not change the interpreted logic value.
- Reliable storage: data can be stored as bit patterns.
- Programmable processing: the same hardware can execute many operations under software control.
- Easy duplication: valid binary states can be regenerated rather than continuously copied with accumulated analog error.
- Integration: very large numbers of digital components can be manufactured together on semiconductor chips.
Let's Clarify
A traditional mercury thermometer gives a useful analogy for analog information. The mercury level may stop at any position along the scale. A digital thermometer instead reports a selected numerical value such as 27.4°C. The physical temperature still changes continuously, but the digital system represents the measurement using discrete numerical data.
Common Mistake
A digital signal is not defined merely as a square-shaped waveform. The defining idea is discrete information states. Real digital signals have finite rise and fall times and may not look like perfect mathematical rectangles.
Summary
- Analog signals can take continuously varying values.
- Digital signals represent information using discrete states, commonly binary 0 and 1.
- Digital logic usually interprets voltage ranges as LOW and HIGH rather than requiring exact voltage values.
- Digital representation supports reliable storage, regeneration, processing, and integration.
- Many real-world quantities begin as analog signals and are later represented digitally.
Test Yourself
- Differentiate between analog and digital signals.
- Why can a binary digital signal tolerate moderate electrical noise?
Hints:
- Analog uses continuous values; digital uses discrete states. Compare value range, noise behavior, storage, and processing.
- Digital circuits recognize ranges as logic 0 and logic 1, so small voltage disturbances may still remain inside the correct valid range.
1.2 Digital Integrated Circuits
Definition
A digital integrated circuit is a semiconductor circuit in which many digital electronic components, such as transistors and logic gates, are fabricated together on a single small chip.
Instead of building every logic gate from separate physical components, an IC places many connected electronic elements inside one semiconductor package. Modern digital devices can therefore perform complex operations using compact, reliable chips.
Detailed Explanation
An integrated circuit combines active and passive electronic elements on a common semiconductor substrate. Digital ICs are specifically designed to operate with discrete logical states.
Examples of functions implemented by digital ICs include:
- logic gates,
- adders,
- counters,
- registers,
- memory circuits,
- processors,
- digital controllers.
Advantages of Digital Integrated Circuits
- Small physical size: many components occupy a tiny chip area.
- Low weight: a chip replaces large assemblies of discrete components.
- High reliability: fewer external connections reduce failure points.
- High operating speed: very short internal connections reduce signal travel time and unwanted electrical effects.
- Low cost per function: semiconductor fabrication produces large numbers of identical circuits.
- Low power requirement: many modern digital IC technologies operate with small power per logic operation.
- Easy system construction: standardized ICs can be connected to build larger digital systems.
- High functional density: complex processing and memory functions can fit inside a compact package.
Major Characteristics of Digital ICs
The behavior of a digital IC is described using several electrical and timing characteristics.
| Characteristic | Meaning |
|---|---|
| Logic levels | Voltage ranges recognized as logical LOW and logical HIGH. |
| Fan-in | Number of inputs that a logic gate is designed to accept. |
| Fan-out | Number of standard logic inputs that one output can reliably drive. |
| Propagation delay | Time required for a change at an input to produce the corresponding change at the output. |
| Power dissipation | Electrical power consumed and converted mainly into heat during operation. |
| Noise margin | Amount of unwanted voltage disturbance that can be tolerated without changing the interpreted logic state. |
| Supply voltage | Operating voltage required to power the IC. |
| Speed-power product | A combined measure involving propagation delay and power dissipation, traditionally used when comparing logic technologies. |
Propagation Delay
No real logic gate responds instantaneously. If an input changes from 0 to 1, the output changes a short time later. This interval is the propagation delay.
Smaller propagation delay → faster switching → potentially higher digital-system operating speed.
Fan-Out
One logic output may need to drive several following gates. If it drives too many, the voltage or current may leave the guaranteed operating conditions. Fan-out therefore indicates the permitted loading of a digital output.
Noise Margin
Suppose a receiving gate recognizes a range of input voltages as logical HIGH. If unwanted electrical interference slightly changes the voltage but the value remains inside the valid HIGH range, the logical state remains correct. The available tolerance is related to the noise margin.
Levels of Integration
The level of integration describes how much digital circuitry is integrated on one chip. As semiconductor technology improved, the number of gates or transistors that could be manufactured on a single IC increased dramatically.

The exact numerical boundaries used for integration levels vary between textbooks and historical technology generations. The following classification gives the common progression.
| Level | General Scale | Typical Functions |
|---|---|---|
| Small-Scale Integration (SSI) | A small number of logic gates, traditionally fewer than about 10 gates | Basic gates, flip-flops |
| Medium-Scale Integration (MSI) | Tens to roughly hundreds of gates | Adders, counters, multiplexers, decoders |
| Large-Scale Integration (LSI) | Hundreds to many thousands of gates | Early memory devices and complex functional blocks |
| Very-Large-Scale Integration (VLSI) | Very large numbers of gates and transistors | Modern processors, memory chips, controllers |
| Ultra-Large-Scale Integration (ULSI) | Extremely high transistor density, commonly millions or more | Highly complex processors and system-scale chips |
Why Increasing Integration Matters
More integration places more functions inside one chip. This reduces the number of separate packages and external wiring required for a complete system.
Higher integration → shorter internal connections → smaller size and often higher speed → lower cost per function → greater system complexity in a compact device.
Let's Clarify
Consider building a calculator from separate logic gates. With low integration, many individual chips and connecting wires are required. At higher integration levels, the arithmetic, control, storage, and interface functions can be combined into a much smaller number of chips. The calculation performed may be the same, but the physical implementation becomes dramatically more compact.
Common Mistake
Fan-in and fan-out describe different directions. Fan-in concerns how many inputs belong to a gate. Fan-out concerns how many following logic inputs one output can drive reliably.
Summary
- A digital IC integrates many digital electronic components on one semiconductor chip.
- Important advantages include compact size, high reliability, high speed, low cost per function, and high functional density.
- Major characteristics include logic levels, fan-in, fan-out, propagation delay, power dissipation, and noise margin.
- Integration levels progress from SSI and MSI through LSI, VLSI, and ULSI.
- Higher integration allows increasingly complex digital systems to occupy fewer physical components.
Test Yourself
- Explain propagation delay, fan-out, and noise margin in a digital IC.
- Differentiate SSI, MSI, LSI, VLSI, and ULSI.
- List out the major characteristics of IC. (Model Q)
Hints:
- Propagation delay is input-to-output response time; fan-out is the number of standard inputs one output can drive; noise margin is the tolerated voltage disturbance.
- They represent progressively increasing levels of circuit integration, from a few logic gates to very large and extremely dense transistor systems.
- Include logic levels, fan-in, fan-out, propagation delay, power dissipation, noise margin, supply voltage, and speed-related characteristics.
1.3 Digital Systems and Their Applications
Definition
A digital system is an electronic system that represents and processes information using discrete values, usually binary digits 0 and 1.
A digital system receives information in coded form, processes it using digital logic, may store it, and produces an output. Computers, calculators, digital clocks, communication equipment, and embedded controllers are examples.
Detailed Explanation
Digital systems operate on bits. A bit, short for binary digit, can have one of two values: 0 or 1. Groups of bits can represent numbers, letters, instructions, images, sound samples, addresses, or control signals.
Basic Functional Flow of a Digital System
A general digital system can be understood using this sequence:
Input → digital representation → processing → storage when required → output
- Input: information enters from switches, keyboards, sensors, communication links, or stored data.
- Representation: information is expressed using binary patterns or another digital code.
- Processing: logic circuits perform arithmetic, comparison, selection, decision-making, and control operations.
- Storage: data or instructions may be retained in registers, memory, or other digital storage.
- Output: the result is sent to a display, actuator, communication interface, file, or another digital system.
Combinational and Sequential Behavior
Digital circuits can broadly exhibit two forms of behavior:
- Combinational logic: the output depends on the current input values.
- Sequential logic: the output depends on current inputs and previously stored state.
An adder is an example of combinational logic. A counter is an example of sequential logic because it remembers its previous count.
Applications of Digital Systems
| Application Area | Digital-System Role | Examples |
|---|---|---|
| Computing | Performs arithmetic, logic, control, storage, and program execution | Desktop computers, laptops, servers |
| Communication | Encodes, processes, transmits, receives, and corrects digital information | Mobile networks, routers, digital broadcasting |
| Consumer electronics | Controls functions and processes digital media | Televisions, cameras, game systems |
| Industrial control | Monitors machines and performs automatic control decisions | Factory automation and process controllers |
| Transportation | Controls subsystems and processes sensor information | Vehicle control systems and digital dashboards |
| Medical systems | Processes measurements and controls diagnostic equipment | Patient monitors and imaging equipment |
| Banking and commerce | Stores and processes transaction information | Automated payment and account-processing systems |
| Scientific instrumentation | Acquires, analyzes, and records measured data | Digital measurement and laboratory systems |
Why Binary Is Used
Binary representation works well with electronic circuits because two separated operating regions are easier to distinguish reliably than many closely spaced voltage levels.
Two stable logical states → binary representation → logic operations → complex computation from combinations of simple decisions.
Let's Clarify
A digital attendance system may receive a student identifier as input, compare it with stored records, update the attendance state, and show confirmation. The user sees names and dates, but internally those characters, numbers, comparisons, and stored records are all represented by binary patterns.
Summary
- A digital system processes information represented by discrete states, usually binary 0 and 1.
- Its general flow is input → representation → processing → optional storage → output.
- Bits can represent numbers, characters, instructions, multimedia data, and control information.
- Digital systems are used in computing, communication, industry, medicine, transportation, commerce, and instrumentation.
- Binary operation is practical because two distinct electronic states can be recognized reliably.
Test Yourself
- Describe the basic functional flow of a digital system.
- What is digital system? (April, 2023)
- Define Digital System. (October, 2023)
Hints:
- Input → digital representation → processing → storage if required → output.
- An electronic system that represents and processes information using discrete values, normally binary 0 and 1.
- Define it in terms of discrete binary information and mention processing, storage, and output functions.
1.4 Digital Codes and Conversions
Definition
A digital code is an agreed pattern of binary digits used to represent numbers, characters, symbols, or other information inside a digital system.
The same bit pattern has no universal meaning by itself. A system needs a rule that explains what each pattern represents. One code may interpret a pattern as a decimal digit, another as a character, and another as a position or state.
Detailed Explanation
Binary circuits naturally work with 0s and 1s, but users work with decimal numbers, alphabetic characters, punctuation, and many other kinds of information. A code provides the mapping between meaningful information and binary patterns.

Why Digital Codes Are Needed
- Representation: they allow human information to be expressed in binary form.
- Processing: hardware can operate on coded data.
- Storage: coded information can be placed in digital memory.
- Communication: sender and receiver can interpret the same bit patterns consistently.
- Special properties: some codes are designed to reduce transition errors or make particular arithmetic operations easier.
Main Categories in This Unit
| Code or Representation | Main Purpose | Basic Idea |
|---|---|---|
| Pure binary | Represent integer or fractional numerical values | Positional base-2 notation |
| BCD | Represent decimal digits separately | Each decimal digit gets its own 4-bit binary code |
| Excess-3 | Decimal digit coding | Add 3 to each decimal digit and encode the result in 4-bit binary |
| Gray code | Order values with one-bit transitions | Adjacent code words differ in exactly one bit |
| Alphanumeric codes | Represent letters, digits, punctuation, and control symbols | Assign a binary code to each character |
Weighted and Non-Weighted Codes
A weighted code assigns a positional weight to each bit. The represented value can be found by summing the weights corresponding to bits that are 1.
The standard 8421 BCD code is weighted because its four positions have weights 8, 4, 2, and 1.
A non-weighted code does not assign fixed arithmetic positional weights in that manner. Gray code and Excess-3 are normally treated as non-weighted codes.
Code Conversion
Code conversion means changing information from one representation to another while preserving its intended meaning.
Examples:
- decimal digit → BCD,
- BCD → decimal digit,
- binary → Gray code,
- Gray code → binary,
- character → alphanumeric binary code.
Conversion must follow the rules of both the source code and the destination code. A bit-by-bit copy is not generally valid because two coding systems may assign different meanings to the same pattern.
Common Mistake
A number system and a digital code are related but not identical ideas. Binary is a positional number system. BCD uses binary patterns to encode individual decimal digits. Therefore the BCD representation of a multi-digit decimal number is usually different from the pure binary representation of the same numerical value.
Summary
- A digital code assigns defined meanings to binary patterns.
- Codes represent numerical data, characters, symbols, states, or other information.
- BCD is a weighted decimal-digit code, while Excess-3 and Gray code are non-weighted codes.
- Code conversion changes representation without changing the intended information.
- The same bits can mean different things under different coding rules.
Test Yourself
- What is a digital code, and why is code conversion required?
- Differentiate a weighted code from a non-weighted code.
- Why is pure binary not the same as BCD?
Hints:
- A digital code maps information to binary patterns; conversion is needed when different systems or operations require different representations.
- A weighted code has defined positional weights; a non-weighted code does not use fixed arithmetic weights for its bit positions.
- Pure binary encodes the complete number as one base-2 value; BCD separately encodes every decimal digit using four bits.
1.5 Decimal, Binary, Octal, and Hexadecimal Number Systems
Definition
A number system is a method of representing numerical values using a set of symbols and a base, also called a radix, that determines the positional weights of those symbols.
Decimal uses ten digit symbols, binary uses two, octal uses eight, and hexadecimal uses sixteen. The position of a digit tells how much that digit contributes to the total value.
Detailed Explanation
Modern digital systems rely heavily on positional number systems. In a positional system, the value of a digit depends on both the digit itself and its position.

General Positional Form
For a base r, a number with integer and fractional positions can be expanded as:
N = dnrn + ... + d1r1 + d0r0 + d-1r-1 + d-2r-2 + ...
Here:
- r = base or radix,
- d = digit at a position,
- positive powers represent integer positions,
- negative powers represent fractional positions.
Decimal Number System
The decimal number system has base 10 and uses the digits:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Example:
(572.4)10
= 5 × 102 + 7 × 101 + 2 × 100 + 4 × 10-1
= 500 + 70 + 2 + 0.4
= 572.4
Binary Number System
The binary number system has base 2 and uses:
0 and 1
Each binary digit is called a bit.
Example:
(101101)2
= 1 × 25 + 0 × 24 + 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20
= 32 + 8 + 4 + 1
= (45)10
Most Significant and Least Significant Bits
In a binary number, the leftmost position with the greatest positional weight is the most significant bit (MSB). The rightmost bit of the integer part has the smallest integer positional weight and is called the least significant bit (LSB).
Binary Data Combinations
If a binary word contains n bits, each bit has two possible states. Therefore the total number of different binary patterns is:
Number of combinations = 2n
For 5 bits:
25 = 32 combinations
The patterns extend from:
00000 through 11111
If interpreted as unsigned binary integers, these 32 combinations represent decimal values from 0 to 31.
Octal Number System
The octal number system has base 8 and uses:
0, 1, 2, 3, 4, 5, 6, 7
Each octal digit corresponds exactly to three binary bits because:
8 = 23
Examples:
| Octal | Binary |
|---|---|
| 0 | 000 |
| 1 | 001 |
| 2 | 010 |
| 3 | 011 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
Hexadecimal Number System
The hexadecimal number system has base 16. It uses:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
The alphabetic digits have these decimal values:
| Hexadecimal Digit | Decimal Value | Binary Equivalent |
|---|---|---|
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Each hexadecimal digit corresponds to four binary bits because:
16 = 24
Comparison of the Four Number Systems
| Number System | Base | Allowed Digits | Binary Relationship |
|---|---|---|---|
| Decimal | 10 | 0 to 9 | No fixed whole-bit grouping |
| Binary | 2 | 0, 1 | Native digital representation |
| Octal | 8 | 0 to 7 | 1 octal digit = 3 binary bits |
| Hexadecimal | 16 | 0 to 9, A to F | 1 hexadecimal digit = 4 binary bits |
Common Mistake
A digit that is valid in one base may be invalid in another. For example, 8 cannot appear inside an octal number, and 2 cannot appear inside a binary number.
Summary
- Decimal, binary, octal, and hexadecimal use bases 10, 2, 8, and 16 respectively.
- Positional value is determined by digit × baseposition.
- One octal digit maps to three binary bits; one hexadecimal digit maps to four binary bits.
- An n-bit binary word has 2n possible bit combinations.
- Hexadecimal uses A through F to represent decimal values 10 through 15.
Test Yourself
- How many combinations can be represented by an 8-bit binary word?
- Explain why one octal digit corresponds to three binary bits.
- How many different combination can be represented by 5-bit binary data? (April, 2023)
Hints:
- 28 = 256 combinations.
- Three bits provide 23 = 8 patterns, exactly matching the eight octal digits 0 through 7.
- 25 = 32 different combinations.
1.6 Number-System Conversion
Definition
Number-system conversion is the process of expressing the same numerical value in a different base without changing its quantity.
A value such as decimal 45, binary 101101, octal 55, and hexadecimal 2D can all represent the same quantity. Conversion changes the notation, not the value.
Detailed Explanation
Conversions among decimal, binary, octal, and hexadecimal follow different methods depending on the source and destination bases.

Binary to Decimal
Multiply each binary digit by its positional power of 2 and add the results.
Example:
(110101.101)2
= 1×25 + 1×24 + 0×23 + 1×22 + 0×21 + 1×20 + 1×2-1 + 0×2-2 + 1×2-3
= 32 + 16 + 4 + 1 + 0.5 + 0.125
= (53.625)10
Octal to Decimal
Use positional powers of 8.
(725.4)8
= 7×82 + 2×81 + 5×80 + 4×8-1
= 448 + 16 + 5 + 0.5
= (469.5)10
Hexadecimal to Decimal
Use positional powers of 16 and replace A through F by decimal values 10 through 15.
Example:
(2A3B.2A)16
= 2×163 + 10×162 + 3×161 + 11×160 + 2×16-1 + 10×16-2
= 8192 + 2560 + 48 + 11 + 0.125 + 0.0390625
= (10811.1640625)10
Decimal Integer to Binary, Octal, or Hexadecimal
For the integer part, repeatedly divide by the destination base and record the remainders.
The remainders are read from bottom to top.
Example: convert (45)10 to binary.
| Division | Quotient | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upward:
(45)10 = (101101)2
Decimal Fraction to Another Base
For a fractional part, repeatedly multiply by the destination base. At each step, record the integer part of the result. Read the recorded integer digits from top to bottom.
Example: convert (0.625)10 to binary.
| Multiplication | Integer Part | Remaining Fraction |
|---|---|---|
| 0.625 × 2 = 1.25 | 1 | 0.25 |
| 0.25 × 2 = 0.5 | 0 | 0.5 |
| 0.5 × 2 = 1.0 | 1 | 0 |
Therefore:
(0.625)10 = (0.101)2
Binary to Octal
Because one octal digit corresponds to three binary bits:
- Start at the binary point.
- Group integer bits in sets of three moving left.
- Group fractional bits in sets of three moving right.
- Add zeros at the outside edges if a group is incomplete.
- Replace each group by the equivalent octal digit.
Example:
(101011.1101)2
Group:
101 011 . 110 100
Convert:
101 = 5, 011 = 3, 110 = 6, 100 = 4
Therefore:
(101011.1101)2 = (53.64)8
Binary to Hexadecimal
Group binary digits in sets of four around the binary point.
Using the same number:
(101011.1101)2
Pad and group:
0010 1011 . 1101
0010 = 2, 1011 = B, 1101 = D
Therefore:
(101011.1101)2 = (2B.D)16
Octal to Binary
Replace each octal digit with its 3-bit binary equivalent.
Example:
(572)8
5 → 101
7 → 111
2 → 010
Therefore:
(572)8 = (101111010)2
Hexadecimal to Binary
Replace each hexadecimal digit with its 4-bit binary equivalent.
Example:
(2A3B.2A)16
2 → 0010
A → 1010
3 → 0011
B → 1011
2 → 0010
A → 1010
Therefore:
(2A3B.2A)16 = (0010101000111011.00101010)2
Leading zeros in the integer part may be omitted:
(10101000111011.00101010)2
Hexadecimal to Octal Through Binary
For bases 16 and 8, binary provides an efficient intermediate form.
For (2A3B.2A)16:
Hexadecimal:
2 A 3 B . 2 A
Binary:
0010 1010 0011 1011 . 0010 1010
Regroup into three bits:
000 010 101 000 111 011 . 001 010 100
Octal digits:
0 2 5 0 7 3 . 1 2 4
Drop the unnecessary leading zero:
(2A3B.2A)16 = (25073.124)8
Worked Conversion: (2A31)16
Decimal:
2×163 + 10×162 + 3×16 + 1
= 8192 + 2560 + 48 + 1
= (10801)10
Binary:
2 A 3 1 → 0010 1010 0011 0001
Therefore:
(2A31)16 = (10101000110001)2
Octal:
Binary regrouping:
000 010 101 000 110 001
= (25061)8
Let's Clarify
The direction of reading is different for the two decimal-conversion procedures. Repeated division handles the integer part and produces remainders from least significant to most significant, so the remainders are read upward. Repeated multiplication handles the fractional part and directly produces digits from most significant fractional position onward, so those digits are read downward.
Common Mistake
When grouping binary digits for octal or hexadecimal, zeros may be added only at the outer ends: to the left of the integer part or to the right of the fractional part. Inserting zeros near the binary point would change the numerical value.
Summary
- To convert any positional number to decimal, expand it using powers of its base.
- Decimal integers convert by repeated division; decimal fractions convert by repeated multiplication.
- Binary and octal convert directly using groups of three bits.
- Binary and hexadecimal convert directly using groups of four bits.
- Octal and hexadecimal can be converted efficiently through an intermediate binary representation.
Test Yourself
- Convert (110101.101)2 into decimal.
- Convert (101011.1101)₂ to Octal and Hexadecimal form. (2024)
- Convert 2A3B.2A₁₆ into binary, octal and decimal. (April, 2023)
- Convert (2A31)₁₆ into decimal, binary and octal form. (October, 2023)
Hints:
- Use powers of 2. Result: (53.625)10.
- Group by three for octal and four for hexadecimal. Results: (53.64)8 and (2B.D)16.
- Binary: 10101000111011.00101010; octal: 25073.124; decimal: 10811.1640625.
- Decimal: 10801; binary: 10101000110001; octal: 25061.
1.7 Binary-Coded Decimal Code and Arithmetic
Definition
Binary-Coded Decimal represents each decimal digit separately by its 4-bit binary equivalent. The most common form is the 8421 BCD code.
BCD does not convert the whole decimal number into one binary value. Instead, every decimal digit keeps its identity and receives four binary bits.
Detailed Explanation
The four BCD positions have weights:
8, 4, 2, 1
Therefore decimal digits 0 through 9 are represented as follows:
| Decimal Digit | 8421 BCD |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
The six remaining 4-bit patterns, from 1010 through 1111, are not valid decimal digits in standard 8421 BCD.
Decimal to BCD
Convert each decimal digit independently.
Example:
(279)10
2 → 0010
7 → 0111
9 → 1001
Therefore:
(279)10 = 0010 0111 1001 in BCD
BCD to Decimal
Split the BCD value into groups of four bits and convert each valid group into its corresponding decimal digit.
Example:
0101 1000 0011
0101 → 5
1000 → 8
0011 → 3
Therefore the decimal value is:
583
BCD Versus Pure Binary
Consider decimal 25.
BCD:
2 → 0010
5 → 0101
So:
25 = 0010 0101 in BCD
Pure binary:
25 = 110012
The two bit patterns are different because they use different representation rules.
BCD Addition
BCD addition begins with ordinary binary addition of corresponding 4-bit decimal-digit groups. A correction is required whenever a digit result is not a valid BCD digit.
BCD Correction Rule
After adding a 4-bit decimal digit, add 0110 if either condition occurs:
- the 4-bit result is greater than 1001, or
- the addition produces a carry out of the 4-bit group.
Why 0110? Four bits can represent sixteen patterns, but BCD uses only ten of them for decimal digits. Adding 6 corrects a binary result in the invalid region and produces the proper decimal carry relationship.
Worked Example: 279 + 799 Using BCD
First encode both numbers:
279 = 0010 0111 1001
799 = 0111 1001 1001
Work from the rightmost decimal digit.
Step 1: Ones column
9 + 9:
1001 + 1001 = 10010
A carry occurs, so apply BCD correction:
10010 + 00110 = 11000
Keep the lower four bits 1000, representing 8, and carry 1 to the tens digit.
Step 2: Tens column
7 + 9 + carry 1:
0111 + 1001 + 0001 = 10001
Correct:
10001 + 00110 = 10111
Keep 0111, representing 7, and carry 1.
Step 3: Hundreds column
2 + 7 + carry 1:
0010 + 0111 + 0001 = 1010
1010 is greater than valid BCD 1001, so add 0110:
1010 + 0110 = 10000
Keep 0000 and carry 1 to a new thousands digit.
Final BCD result:
0001 0000 0111 1000
Decode:
0001 → 1
0000 → 0
0111 → 7
1000 → 8
Therefore:
(279)10 + (799)10 = (1078)10
Let's Clarify
BCD arithmetic keeps decimal digit boundaries visible. That is why a result such as binary 1010 cannot be accepted as one BCD digit. Decimal has no single digit with value 10. The result must become decimal 10, meaning digit 0 with a carry of 1 to the next decimal position.
Common Mistake
Do not treat the complete BCD bit string as one ordinary binary number. In BCD, every group of four bits represents one decimal digit independently.
Summary
- 8421 BCD represents each decimal digit separately using four bits.
- Valid BCD digit patterns range from 0000 through 1001.
- The patterns 1010 through 1111 are invalid as individual BCD decimal digits.
- BCD addition begins with binary addition of each 4-bit digit group.
- If a digit result exceeds 1001 or generates a carry, add 0110 as a correction.
Test Yourself
- Convert decimal 593 into 8421 BCD.
- What is BCD code? (2024)
- Find the value of (279)₁₀ + (799)₁₀ by converting it to BCD data. (2024)
Hints:
- 5 → 0101, 9 → 1001, 3 → 0011, giving 0101 1001 0011.
- BCD represents each decimal digit separately by a 4-bit binary code, commonly with 8421 positional weights.
- Encode as 0010 0111 1001 and 0111 1001 1001; apply correction 0110 where required. Final BCD = 0001 0000 0111 1000 = 1078.
1.8 Excess-3 Code
Definition
Excess-3 code is a 4-bit decimal digit code obtained by adding 3 to each decimal digit and then writing the result as a 4-bit binary number.
To encode a decimal digit in Excess-3, increase that digit by three first. For example, decimal 5 becomes 8, and binary 1000 is therefore the Excess-3 code for decimal 5.
Detailed Explanation
Excess-3 is a non-weighted code. Its bit positions are not interpreted as ordinary 8-4-2-1 weights for directly recovering the original decimal digit.
Excess-3 Code Table
| Decimal Digit | Add 3 | Excess-3 Code |
|---|---|---|
| 0 | 3 | 0011 |
| 1 | 4 | 0100 |
| 2 | 5 | 0101 |
| 3 | 6 | 0110 |
| 4 | 7 | 0111 |
| 5 | 8 | 1000 |
| 6 | 9 | 1001 |
| 7 | 10 | 1010 |
| 8 | 11 | 1011 |
| 9 | 12 | 1100 |
Decimal to Excess-3
Example: encode decimal 59.
Digit 5:
5 + 3 = 8 → 1000
Digit 9:
9 + 3 = 12 → 1100
Therefore:
59 = 1000 1100 in Excess-3
Excess-3 to Decimal
Reverse the process:
- Split the code into 4-bit groups.
- Convert each group to its ordinary binary value.
- Subtract 3 from each value.
Example:
0111 1011
0111 = 7 → 7 − 3 = 4
1011 = 11 → 11 − 3 = 8
Therefore:
0111 1011 represents decimal 48
Self-Complementing Property
Excess-3 is a self-complementing decimal code. Complementing all four bits of an Excess-3 digit produces the Excess-3 representation of that digit's 9's complement.
Example:
Decimal 2 → Excess-3 = 0101
Bit complement → 1010
1010 is Excess-3 for decimal 7.
Since 7 is the 9's complement of 2:
9 − 2 = 7
BCD and Excess-3 Comparison
| Feature | 8421 BCD | Excess-3 |
|---|---|---|
| Type | Weighted | Non-weighted |
| Encoding method | Direct 4-bit binary value of decimal digit | Add 3, then encode in binary |
| Code for decimal 0 | 0000 | 0011 |
| Self-complementing | No | Yes |
| Code for decimal 9 | 1001 | 1100 |
Summary
- Excess-3 encodes each decimal digit after adding 3.
- It is a non-weighted 4-bit decimal code.
- Decoding requires converting the group to binary value and subtracting 3.
- Its valid decimal digit codes range from 0011 through 1100.
- Excess-3 is self-complementing with respect to decimal 9's complements.
Test Yourself
- Convert decimal 72 into Excess-3 code.
- Decode the Excess-3 number 1001 0100.
- Why is Excess-3 called a self-complementing code?
Hints:
- 7 + 3 = 10 → 1010; 2 + 3 = 5 → 0101. Result: 1010 0101.
- 1001 = 9, subtract 3 → 6; 0100 = 4, subtract 3 → 1. Decimal 61.
- Bitwise complement of an Excess-3 digit produces the Excess-3 code for its 9's-complement decimal digit.
1.9 Gray Code and Conversion
Definition
Gray code is a binary coding system in which any two consecutive code words differ in only one bit position.
When a Gray-coded value changes to its next adjacent value, only one bit changes. This reduces ambiguity in systems where several ordinary binary bits might otherwise change almost simultaneously.
Detailed Explanation
Gray code is a non-weighted and unit-distance code. Unit-distance means adjacent values differ by a Hamming distance of one, which here means one bit changes.

Why Gray Code Is Useful
Consider the ordinary binary transition from decimal 7 to decimal 8:
7 = 0111
8 = 1000
All four bits change. In a real electromechanical or asynchronous sensing system, the bits may not physically change at exactly the same instant. A receiver could briefly observe an unintended intermediate combination.
With Gray code, adjacent positions differ by one bit, which reduces this type of transition ambiguity.
Gray code is therefore useful in applications such as:
- rotary and position encoders,
- position sensing,
- ordering used in Karnaugh maps,
- systems where transition ambiguity should be minimized.
4-Bit Binary and Gray Sequence
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 0000 | 0000 |
| 1 | 0001 | 0001 |
| 2 | 0010 | 0011 |
| 3 | 0011 | 0010 |
| 4 | 0100 | 0110 |
| 5 | 0101 | 0111 |
| 6 | 0110 | 0101 |
| 7 | 0111 | 0100 |
| 8 | 1000 | 1100 |
| 9 | 1001 | 1101 |
| 10 | 1010 | 1111 |
| 11 | 1011 | 1110 |
| 12 | 1100 | 1010 |
| 13 | 1101 | 1011 |
| 14 | 1110 | 1001 |
| 15 | 1111 | 1000 |
Binary to Gray Conversion
The conversion uses the Exclusive-OR (XOR) operation. XOR gives 1 when its two input bits are different and 0 when they are the same.
| A | B | A XOR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
For binary-to-Gray conversion:
- Copy the binary MSB directly as the Gray MSB.
- For every following Gray bit, XOR the current binary bit with the binary bit immediately to its left.
Symbolically:
GMSB = BMSB
Next Gray bit = previous binary bit XOR current binary bit
Worked Example: Binary 1010 to Gray
Binary:
1 0 1 0
First Gray bit:
1
Second:
1 XOR 0 = 1
Third:
0 XOR 1 = 1
Fourth:
1 XOR 0 = 1
Therefore:
(1010)2 = (1111)Gray
Gray to Binary Conversion
For Gray-to-binary conversion:
- Copy the Gray MSB directly as the binary MSB.
- For each following bit, XOR the previous binary result bit with the current Gray bit.
Symbolically:
BMSB = GMSB
Next binary bit = previous binary bit XOR current Gray bit
Worked Example: Gray 1011 to Binary
Gray:
1 0 1 1
First binary bit:
1
Second:
1 XOR 0 = 1
Third:
1 XOR 1 = 0
Fourth:
0 XOR 1 = 1
Therefore:
(1011)Gray = (1101)2
Let's Clarify
Imagine a rotating shaft whose position is detected by several sensors. With ordinary binary, moving between adjacent positions may require several sensor bits to change. If one sensor reacts slightly earlier than another, a temporary wrong value may appear. Gray coding arranges adjacent positions so only one sensor bit must change, reducing this ambiguity.
Common Mistake
The XOR direction differs between the two conversions. Binary-to-Gray compares adjacent original binary bits. Gray-to-binary uses the previously calculated binary bit together with the current Gray bit.
Summary
- Gray code is a non-weighted unit-distance code.
- Adjacent Gray code words differ in exactly one bit.
- Binary-to-Gray copies the MSB, then XORs adjacent binary bits.
- Gray-to-binary copies the MSB, then XORs the previous binary result with the current Gray bit.
- Gray code is useful where multiple-bit transitions could create ambiguous intermediate readings.
Test Yourself
- Convert binary 1101 into Gray code.
- Convert Gray code 1110 into binary.
- Convert (1010)₂ to gray code. (2024)
- What is gray code? (April, 2023)
- Convert gray code: 1011 to binary. (October, 2023)
Hints:
- Copy 1; then XOR adjacent binary bits: 1⊕1=0, 1⊕0=1, 0⊕1=1. Result 1011.
- Copy 1; then cumulative XOR: 1⊕1=0, 0⊕1=1, 1⊕0=1. Result 1011.
- 1, 1⊕0, 0⊕1, 1⊕0 → 1111.
- A non-weighted unit-distance code in which consecutive code words differ in exactly one bit.
- Copy first bit, then use previous binary bit XOR current Gray bit. Result: 1101.
1.10 Alphanumeric Codes: American Standard Code for Information Interchange and Extended Binary Coded Decimal Interchange Code
Definition
An alphanumeric code assigns binary patterns to letters, decimal digits, punctuation marks, control characters, and other symbols so that textual information can be stored, processed, and transmitted digitally.
Computers do not store the visible shape of a letter such as A as the letter itself. A character-encoding system assigns a numerical code to A, B, 0, 1, punctuation marks, and control symbols, and that numerical code is stored in binary form.
Detailed Explanation
Two historically important alphanumeric codes are the American Standard Code for Information Interchange (ASCII) and the Extended Binary Coded Decimal Interchange Code (EBCDIC).
American Standard Code for Information Interchange
Standard ASCII is a 7-bit character code. Seven bits provide:
27 = 128 possible codes
These codes represent:
- uppercase letters,
- lowercase letters,
- decimal digits,
- punctuation marks,
- special symbols,
- control characters.
Selected ASCII Values
| Character | Decimal Code | 7-Bit Binary |
|---|---|---|
| Space | 32 | 0100000 |
| 0 | 48 | 0110000 |
| 1 | 49 | 0110001 |
| A | 65 | 1000001 |
| B | 66 | 1000010 |
| a | 97 | 1100001 |
| b | 98 | 1100010 |
A useful observation is that ASCII digits are characters. The character '5' is encoded as a character code and is not automatically the same bit representation used for the numerical binary value 5.
Extended ASCII Terminology
The phrase extended ASCII is commonly used for various 8-bit character sets whose first 128 positions correspond to ASCII. It does not refer to one single universal extension. Different historical systems used different assignments for the upper 128 values.
Extended Binary Coded Decimal Interchange Code
EBCDIC is an 8-bit character encoding historically associated mainly with International Business Machines (IBM) mainframe and midrange systems.
Eight bits provide:
28 = 256 possible code patterns
EBCDIC supports letters, numbers, punctuation, and control characters, but its numerical assignments differ from ASCII.
ASCII and EBCDIC Comparison
| Feature | ASCII | EBCDIC |
|---|---|---|
| Full form | American Standard Code for Information Interchange | Extended Binary Coded Decimal Interchange Code |
| Basic code length | 7 bits | 8 bits |
| Possible basic patterns | 128 | 256 |
| Historical use | General computers and communication systems | Mainly IBM mainframe-oriented environments |
| Character assignments | Uses ASCII ordering | Uses a different coding arrangement |
Why Character Codes Matter
For text to move correctly between storage, applications, and communication systems, the sender and receiver must agree on the meaning assigned to each numerical code.
Character → numerical code → binary storage or transmission → numerical code interpreted → character displayed
Common Mistake
The character '9' and the numerical value 9 are different concepts. The character '9' has a character code used for text. The numerical quantity 9 may be stored in ordinary binary, BCD, or another numerical representation depending on the system.
Summary
- Alphanumeric codes map characters and control symbols to binary values.
- Standard ASCII is a 7-bit code with 128 possible values.
- EBCDIC is an 8-bit character encoding historically associated with IBM systems.
- ASCII and EBCDIC assign different numerical patterns to characters.
- Character coding allows textual information to be stored, processed, and transmitted digitally.
Test Yourself
- What is an alphanumeric code?
- Compare ASCII and EBCDIC.
- Why is the ASCII character '5' not identical to the binary numerical value 5?
Hints:
- A binary coding scheme that assigns numerical patterns to letters, digits, punctuation, symbols, and control characters.
- ASCII is basically 7-bit with 128 codes; EBCDIC is 8-bit with 256 patterns and historically associated with IBM mainframe systems.
- '5' is textual data and has a character-code value; numerical 5 represents the mathematical quantity five.
1.11 Binary Addition and Subtraction
Definition
Binary arithmetic applies arithmetic operations directly to numbers represented with binary digits 0 and 1. Binary addition and subtraction follow positional rules similar to decimal arithmetic but use base 2.
The method is familiar from decimal arithmetic: work column by column from right to left, carry when a column becomes too large, and borrow when the upper digit is too small. The difference is that each position has only two possible digits.
Detailed Explanation

Binary Addition Rules
| Operation | Sum Bit | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 | 1 | 0 |
| 1 + 0 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 | 1 | 1 |
Worked Binary Addition
Add:
10112 + 11012
1011
+ 1101
-------
11000Check in decimal:
10112 = 1110
11012 = 1310
11 + 13 = 24
110002 = 2410
Step-by-Step Addition
- Rightmost column: 1 + 1 = 10, write 0 and carry 1.
- Next column: 1 + 0 + carry 1 = 10, write 0 and carry 1.
- Next column: 0 + 1 + carry 1 = 10, write 0 and carry 1.
- Next column: 1 + 1 + carry 1 = 11, write 1 and carry 1.
- Place the final carry at the left, producing 11000.
Binary Subtraction Rules
| Operation | Difference | Borrow |
|---|---|---|
| 0 − 0 | 0 | 0 |
| 1 − 0 | 1 | 0 |
| 1 − 1 | 0 | 0 |
| 0 − 1 | 1 | 1 from the next higher position |
When 1 is borrowed from the next binary position, its value in the current position is binary 10, which equals decimal 2.
Worked Binary Subtraction
Subtract:
110102 − 010112
11010
- 01011
-------
01111Decimal check:
110102 = 2610
010112 = 1110
26 − 11 = 15
011112 = 1510
Carry Versus Borrow
- Carry: moves a value into the next higher position during addition.
- Borrow: takes one unit from the next higher position during subtraction.
Because each higher binary position has twice the weight of the position to its right, borrowing one unit supplies binary 10 at the current position.
Fixed-Width Unsigned Addition
When an unsigned result requires more bits than the fixed storage width provides, the extra carry indicates that the exact result cannot fit in that unsigned width.
For example, four unsigned bits can represent 0 through 15:
1111 + 0001 = 1 0000
The mathematical result is 16, which requires five bits.
Let's Clarify
Binary carrying is the base-2 version of decimal carrying. In decimal, 9 + 1 produces 10, so the current digit becomes 0 and 1 moves left. In binary, 1 + 1 already reaches the base, producing binary 10. The current bit becomes 0 and a carry of 1 moves left.
Summary
- Binary arithmetic uses the digits 0 and 1 with base-2 positional rules.
- 1 + 1 produces sum 0 and carry 1.
- 1 + 1 + 1 produces sum 1 and carry 1.
- For 0 − 1, borrow one binary unit from the next higher position, giving binary 10 in the current position.
- Fixed-width unsigned arithmetic must have enough bits to contain the final result.
Test Yourself
- Add 1011012 and 0110112.
- Subtract 001112 from 101002.
- Why does borrowing one binary unit give 102 in the next lower position?
Hints:
- 45 + 27 = 72, so the binary result is 10010002.
- 20 − 7 = 13, so the result is 011012.
- Each position has twice the weight of the position to its right; one unit of the higher position therefore equals two units, written 102, in the lower position.
1.12 1's Complement and 2's Complement
Definition
The 1's complement of a binary number is formed by changing every 0 to 1 and every 1 to 0. The 2's complement is formed by taking the 1's complement and adding 1.
Complements provide a convenient way to represent negative binary values and perform subtraction using addition hardware. The 2's-complement system is especially useful because it has only one representation for zero.
Detailed Explanation
Finding 1's Complement
Take the binary value:
00101101
Invert every bit:
0 → 1
0 → 1
1 → 0
0 → 1
1 → 0
1 → 0
0 → 1
1 → 0
Therefore:
1's complement of 00101101 = 11010010
Finding 2's Complement
Begin with:
00101101
1's complement:
11010010
Add 1:
11010010
+ 00000001
-----------
11010011Therefore:
2's complement of 00101101 = 11010011
Alternative Way to Form 2's Complement
A useful bit method is:
- Starting from the right, copy bits through and including the first 1.
- Invert every remaining bit to the left.
Example:
00101100
From the right, copy 100. Invert all bits to the left:
11010100
This gives the same result as invert-all-bits-and-add-1.
1's-Complement Subtraction
To calculate A − B using 1's complement:
- Write both values using the same fixed number of bits.
- Find the 1's complement of B.
- Add it to A.
- If a carry leaves the most significant position, add that carry back to the least significant position. This is called end-around carry.
- If no end-around carry is produced, the result is negative and is in 1's-complement form.
Example: 9 − 5 Using 1's Complement
Using 4 bits:
9 = 1001
5 = 0101
1's complement of 5:
1010
Add:
1001
+ 1010
------
1 0011Take the end-around carry 1 and add it to 0011:
0011
0001
----
01000100 = 4, so:
9 − 5 = 4
2's-Complement Subtraction
To calculate A − B:
- Use the same number of bits for A and B.
- Find the 2's complement of B.
- Add it to A.
- If a carry leaves the most significant position, discard that carry.
- Interpret the remaining fixed-width result.
Example: 13 − 5 Using 2's Complement
Using 5 bits:
13 = 01101
5 = 00101
1's complement of 00101:
11010
Add 1:
11011
Add to 13:
01101
+ 11011
-------
1 01000Discard the carry:
01000 = 8
Therefore:
13 − 5 = 8
Representing Negative Values with 2's Complement
To represent −20 using 8 bits:
+20:
00010100
Invert:
11101011
Add 1:
11101100
Therefore:
−20 = 11101100 in 8-bit 2's complement
Worked Example: (−20)10 + (+30)10
Use 8-bit 2's-complement representation.
+30:
00011110
−20:
+20 = 00010100
1's complement = 11101011
Add 1 = 11101100
Add:
11101100
+ 00011110
-----------
1 00001010Discard the carry outside the 8-bit width:
00001010
This is positive decimal 10.
Therefore:
(−20)10 + (+30)10 = (+10)10
Why 2's Complement Is Preferred
- One zero representation: there is no separate positive zero and negative zero.
- Addition hardware handles subtraction: subtraction can be implemented by adding the 2's complement.
- Natural fixed-width wraparound: the final carry can be discarded.
- Asymmetric useful range: one additional negative value is representable compared with sign-magnitude and 1's complement.
Comparison of 1's and 2's Complement
| Feature | 1's Complement | 2's Complement |
|---|---|---|
| Formation | Invert every bit | Invert every bit and add 1 |
| Zero forms | Two | One |
| Subtraction carry | Uses end-around carry | Final carry is discarded |
| n-bit negative range | −(2n−1 − 1) | −2n−1 |
| Modern signed-integer use | Rare | Widely used |
Let's Clarify
The key idea is to replace subtraction with addition. Instead of building a completely separate arithmetic process for A − B, a digital system can form the complement representation of B and feed it into an adder. This is one reason complement systems are so closely connected to computer arithmetic.
Common Mistake
The fixed bit width must remain constant throughout complement arithmetic. If a problem uses 8 bits, every positive value, negative value, complement, carry decision, and final interpretation must be handled as an 8-bit quantity.
Summary
- 1's complement is formed by inverting every bit.
- 2's complement equals the 1's complement plus 1.
- 1's-complement subtraction may require an end-around carry.
- In fixed-width 2's-complement addition, a carry beyond the most significant bit is discarded.
- 2's complement provides one zero representation and is widely used for signed binary integers.
Test Yourself
- Find the 1's and 2's complements of 00110110.
- Compute 18 − 7 using a 6-bit 2's-complement method.
- Compute (-20)₁₀ + (+30)₁₀, using 2's complement method. (October, 2023)
Hints:
- 1's complement = 11001001; 2's complement = 11001010.
- 18 = 010010; 7 = 000111; 2's complement of 7 = 111001. Add and discard carry to obtain 001011 = 11.
- 8-bit −20 = 11101100; +30 = 00011110; sum = 1 00001010. Discard carry → 00001010 = +10.
1.13 Signed Number Representation
Definition
Signed number representation is a binary method that allows both positive and negative integers to be encoded using a fixed number of bits.
Unsigned binary uses every bit to represent magnitude, so it cannot directly distinguish positive from negative values. Signed representations reserve or interpret the most significant bit in a way that identifies negative numbers.
Detailed Explanation
Three classical signed-integer representations are:
- sign-magnitude,
- 1's complement,
- 2's complement.

Sign-Magnitude Representation
In sign-magnitude representation:
- the MSB acts as a sign bit,
- 0 indicates positive,
- 1 indicates negative,
- the remaining bits store the magnitude.
Using 8 bits, represent decimal 13.
Magnitude of 13 using 7 magnitude bits:
0001101
Positive:
+13 = 00001101
Negative:
−13 = 10001101
Two Zeros in Sign-Magnitude
Sign-magnitude has:
+0 = 00000000
−0 = 10000000
This duplicate zero representation is one disadvantage of the method.
1's-Complement Representation
A positive value is stored as ordinary binary with a leading sign bit 0. A negative value is obtained by complementing every bit of the positive representation.
Using 8 bits:
+13 = 00001101
Invert all bits:
−13 = 11110010
1's complement also has two representations for zero:
+0 = 00000000
−0 = 11111111
2's-Complement Representation
A positive value is represented normally. To represent the corresponding negative value:
- write the positive value using the fixed bit width,
- invert every bit,
- add 1.
For 8-bit −13:
+13:
00001101
Invert:
11110010
Add 1:
11110011
Therefore:
−13 = 11110011 in 8-bit 2's complement
One Zero in 2's Complement
2's complement has only:
00000000 = 0
There is no separate negative-zero bit pattern.
Range of n-Bit Signed Representations
Sign-Magnitude
One bit is used for the sign and n−1 bits represent magnitude.
Range = −(2n−1 − 1) to +(2n−1 − 1)
For 8 bits:
−127 to +127
1's Complement
The range is also:
−(2n−1 − 1) to +(2n−1 − 1)
For 8 bits:
−127 to +127
2's Complement
The range is:
−2n−1 to +(2n−1 − 1)
For 8 bits:
−128 to +127
Comparison of Signed Representations
| Feature | Sign-Magnitude | 1's Complement | 2's Complement |
|---|---|---|---|
| Negative formation | Set sign bit to 1 | Invert all bits | Invert all bits and add 1 |
| Positive representation | Ordinary binary with sign 0 | Ordinary binary with sign 0 | Ordinary binary with sign 0 |
| Number of zeros | Two | Two | One |
| n-bit range | −(2n−1−1) to +(2n−1−1) | −(2n−1−1) to +(2n−1−1) | −2n−1 to +(2n−1−1) |
| Arithmetic convenience | Requires sign handling | Requires end-around carry in subtraction | Works naturally with fixed-width binary addition |
Decoding a Negative 2's-Complement Number
Suppose an 8-bit value is:
11110110
The MSB is 1, so under signed 2's-complement interpretation it is negative.
Find its magnitude:
Invert:
00001001
Add 1:
00001010
00001010 = 10.
Therefore:
11110110 represents −10 in 8-bit 2's complement.
Unsigned Versus Signed Interpretation
The bit pattern itself does not state whether it is signed or unsigned. Its interpretation depends on the representation selected by the system.
For example:
11111111
- as an 8-bit unsigned number → 255,
- as an 8-bit 2's-complement number → −1.
The bits are identical. The interpretation rule changes the meaning.
Let's Clarify
A bit pattern works like a written symbol whose meaning depends on context. The sequence 11111111 is not inherently 255 or −1. If the system treats it as unsigned binary, it is 255. If the same eight bits are interpreted using 2's-complement signed rules, the value is −1.
Common Mistake
Seeing an MSB of 1 does not automatically make every binary number negative. The MSB acts as a sign indicator only when the data is explicitly being interpreted under a signed representation such as sign-magnitude, 1's complement, or 2's complement.
Summary
- Signed binary representation allows fixed-width bit patterns to encode positive and negative integers.
- Sign-magnitude stores a separate sign bit and an unsigned magnitude.
- 1's complement forms negative values by inverting every positive-value bit.
- 2's complement forms negative values by inversion followed by adding 1.
- 2's complement has one zero and an n-bit range from −2n−1 to 2n−1−1.
- The same bit pattern can have different values under signed and unsigned interpretations.
Test Yourself
- Represent +18 and −18 in 8-bit sign-magnitude, 1's complement, and 2's complement.
- What is the range of an 8-bit 2's-complement integer?
- Interpret 11110101 as an 8-bit 2's-complement value.
Hints:
- +18 = 00010010 in all three. Sign-magnitude −18 = 10010010; 1's complement = 11101101; 2's complement = 11101110.
- −27 to 27−1 = −128 to +127.
- Invert → 00001010; add 1 → 00001011 = 11. Therefore the original value is −11.
Exam Questions
- List out the major characteristics of IC. (Model Q)
- What is BCD code? (2024)
- Convert (1010)₂ to gray code. (2024)
- Convert (101011.1101)₂ to Octal and Hexadecimal form. (2024)
- Find the value of (279)₁₀ + (799)₁₀ by converting it to BCD data. (2024)
- What is digital system? (April, 2023)
- How many different combination can be represented by 5-bit binary data? (April, 2023)
- Convert 2A3B.2A₁₆ into binary, octal and decimal. (April, 2023)
- What is gray code? (April, 2023)
- Define Digital System. (October, 2023)
- Convert gray code: 1011 to binary. (October, 2023)
- Convert (2A31)₁₆ into decimal, binary and octal form. (October, 2023)
- Compute (-20)₁₀ + (+30)₁₀, using 2's complement method. (October, 2023)
Whole Chapter Summary
Digital Versus Analog Signals
Analog signals vary continuously, while digital signals represent information using discrete states. Binary digital systems normally use logic 0 and logic 1, represented by valid electrical ranges rather than ideal mathematical points.
Digital Integrated Circuits
Digital ICs combine many electronic components on one semiconductor chip. Their behavior is described by characteristics such as propagation delay, fan-in, fan-out, power dissipation, and noise margin, while integration levels progress from SSI toward VLSI and ULSI.
Digital Systems and Applications
A digital system receives, represents, processes, stores, and outputs discrete information. Digital systems form the basis of computers, communication devices, industrial control, consumer electronics, instrumentation, transportation, and many other technologies.
Digital Codes and Conversions
Digital codes assign meanings to binary patterns. Different codes are designed for numerical digits, characters, or special transition properties, so conversion rules are required whenever information changes representation.
Decimal, Binary, Octal, and Hexadecimal
These positional systems use bases 10, 2, 8, and 16. Binary is fundamental to digital hardware, while octal and hexadecimal provide compact representations because their digits map directly to groups of three and four binary bits.
Number-System Conversion
Base-to-decimal conversion uses positional expansion. Decimal integers use repeated division, fractions use repeated multiplication, and direct binary grouping provides efficient conversion to and from octal and hexadecimal.
Binary-Coded Decimal
BCD stores each decimal digit in a separate 4-bit 8421 group. In BCD addition, results above 1001 or groups producing a carry require addition of 0110 to obtain a valid decimal-digit representation.
Excess-3
Excess-3 encodes each decimal digit after adding 3. It is non-weighted and self-complementing, so bitwise complementation produces the code for the decimal digit's 9's complement.
Gray Code
Gray code arranges consecutive values so only one bit changes at a time. Binary-to-Gray uses XOR between adjacent binary bits, while Gray-to-binary uses cumulative XOR based on the preceding binary result.
Alphanumeric Codes
Alphanumeric encodings allow letters, digits, punctuation, and control symbols to be stored as binary values. ASCII is fundamentally 7-bit, while EBCDIC is an 8-bit character code historically used in IBM-oriented systems.
Binary Addition and Subtraction
Binary arithmetic applies base-2 carry and borrow rules. Since 1 + 1 equals binary 10, addition creates a carry quickly, while subtraction from 0 requires borrowing binary 10 from the next higher position.
1's and 2's Complements
1's complement inverts every bit, while 2's complement additionally adds 1. Complement arithmetic converts subtraction into addition, and 2's complement provides a single zero representation suitable for fixed-width signed arithmetic.
Signed Number Representation
Sign-magnitude, 1's complement, and 2's complement provide different methods for encoding negative integers. 2's complement gives one zero and an n-bit range from −2n−1 to 2n−1−1.
Key Formulas and Points Sheet
| Formula or Rule | Meaning |
|---|---|
| N = Σ diri | General positional number-system expansion using base r. |
| Number of n-bit patterns = 2n | Each of n bits has two possible values. |
| Unsigned n-bit range = 0 to 2n−1 | Range when all bit patterns represent non-negative values. |
| 1 octal digit = 3 binary bits | Because 8 = 23. |
| 1 hexadecimal digit = 4 binary bits | Because 16 = 24. |
| BCD correction = add 0110 | Apply when a BCD digit sum exceeds 1001 or creates a carry. |
| Excess-3 code = binary(decimal digit + 3) | Rule for encoding one decimal digit in Excess-3. |
| Binary → Gray: first Gray bit = first binary bit | Copy the MSB directly. |
| Remaining Gray bit = adjacent binary bits XOR | Use previous binary bit XOR current binary bit. |
| Gray → binary: first binary bit = first Gray bit | Copy the MSB directly. |
| Remaining binary bit = previous binary result XOR current Gray bit | Cumulative rule for decoding Gray code. |
| 1's complement = invert every bit | 0 becomes 1 and 1 becomes 0. |
| 2's complement = 1's complement + 1 | Standard method for forming a negative 2's-complement value. |
| Sign-magnitude range = −(2n−1−1) to +(2n−1−1) | One sign bit and n−1 magnitude bits; two representations of zero. |
| 1's-complement range = −(2n−1−1) to +(2n−1−1) | Two representations of zero. |
| 2's-complement range = −2n−1 to +(2n−1−1) | One zero and one additional negative value. |
| Standard ASCII patterns = 27 = 128 | Standard ASCII uses seven bits. |
| EBCDIC patterns = 28 = 256 | EBCDIC uses eight-bit code values. |
Last-Minute Revision Sheet
| Concept | Trigger Phrase | Recall Cue |
|---|---|---|
| Analog signal | Continuous values | Any value inside a range |
| Digital signal | Discrete states | Usually logic 0 and 1 |
| Digital IC | Many circuits on one chip | Compact + reliable + fast |
| Fan-in | Inputs of a gate | How many inputs enter |
| Fan-out | Output loading | How many inputs one output drives |
| Propagation delay | Response time | Input change → output change |
| Integration levels | Increasing circuit density | SSI → MSI → LSI → VLSI → ULSI |
| Digital system | Discrete data processing | Input → process/store → output |
| Binary | Base 2 | 0, 1 |
| Octal | Base 8 | 3 binary bits per digit |
| Hexadecimal | Base 16 | 4 binary bits per digit |
| n binary bits | Possible combinations | 2n |
| Base → decimal | Place values | Digit × baseposition |
| Decimal integer → base | Repeated division | Remainders read upward |
| Decimal fraction → base | Repeated multiplication | Integer parts read downward |
| BCD | Each decimal digit separately | 4-bit 8421 groups |
| BCD correction | Invalid digit or carry | Add 0110 |
| Excess-3 | Digit + 3 | Non-weighted, self-complementing |
| Gray code | One-bit transition | Adjacent values differ by one bit |
| Binary → Gray | Adjacent XOR | Copy MSB, then Bprevious XOR Bcurrent |
| Gray → binary | Cumulative XOR | Previous binary result XOR current Gray bit |
| ASCII | 7-bit character code | 128 standard codes |
| EBCDIC | 8-bit character code | Historically IBM-oriented |
| Binary addition | 1 + 1 | 10: write 0, carry 1 |
| Binary subtraction | 0 − 1 | Borrow → current value becomes 102 |
| 1's complement | Invert | 0 ↔ 1 |
| 2's complement | Invert + 1 | Standard signed arithmetic form |
| Sign-magnitude | Separate sign bit | MSB sign + remaining magnitude |
| 2's-complement range | Asymmetric signed range | −2n−1 to 2n−1−1 |
| Negative 2's complement | Decode magnitude | Invert + 1, then attach negative sign |


