📌 Overview

IT dingen


🎯Learning Objectives

  • ✅ 2025-10-02

� Key Concepts & Definitions

➗ Formulas


✍️ Notes

This lecture introduces Digital Systems. Key topics include:

  • The importance and prevalence of digital systems in modern technology.
  • The fundamental difference between digital and analog systems.
  • Introduction to binary systems, Boolean algebra (AND, OR, NOT), and their role in digital logic.
  • How data (numbers, text) is represented using binary code.
  • Methods for converting between number systems (decimal, binary, hexadecimal).
  • An overview of the course structure, assignments, and grading.

📝 Summary

Add and subtract positive and negative binary numbers


💡 Explanation

Binary addition follows the same principles as decimal addition, but with only two digits: 0 and 1. The core rules are simple:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0, with a carry-over of 1 to the next column.

This “carry-over” is the key concept, just like carrying a 1 in decimal when a sum exceeds 9.

Step-by-Step Example: Adding 5 + 3 (0101 + 0011)

Let’s add the decimal numbers 5 (0101 in binary) and 3 (0011 in binary). We work from right to left.

  ¹ ¹   (Carries)
  0 1 0 1  (Decimal 5)
+ 0 0 1 1  (Decimal 3)
----------
  1 0 0 0  (Decimal 8)
  1. Rightmost column (2⁰): 1 + 1 = 0, carry 1.
  2. Second column (2¹): 0 + 1 + carry 1 = 0, carry 1.
  3. Third column (2²): 1 + 0 + carry 1 = 0, carry 1.
  4. Fourth column (2³): 0 + 0 + carry 1 = 1.

The result is 1000, which is the binary representation of 8.

Representing Negative Numbers: Two’s Complement

Computers use a method called Two’s Complement to represent negative numbers. This system is efficient because it allows subtraction to be performed as addition.

Key Idea: The most significant bit (MSB), the leftmost bit, indicates the sign:

  • 0: Positive number
  • 1: Negative number

Conversion Rules

1. Positive to Negative (e.g., 3 to -3) To get the two’s complement representation of a negative number:

  1. Invert all the bits: Change every 0 to a 1 and every 1 to a 0. This is the “one’s complement”.
  2. Add 1 to the result.

Example: Convert 3 to -3 (using 4 bits)

  • Start with 3: 0011
  • Invert the bits: 1100
  • Add 1: 1100 + 1 = 1101
  • So, -3 in 4-bit two’s complement is 1101.

2. Negative to Positive (e.g., -3 to 3) The process is the same! Example: Convert -3 to 3 (using 4 bits)

  • Start with -3: 1101
  • Invert the bits: 0010
  • Add 1: 0010 + 1 = 0011
  • The result is 0011, which is 3.

Number Base Conversions

Converting numbers between bases is essential.

1. Decimal to Binary (Division Method)

Repeatedly divide the decimal number by 2, recording remainders. Read remainders bottom-up for the binary number.

Example: Convert 334₁₀ to Binary

  • 334 / 2 = 167 R 0 (LSB)
  • 167 / 2 = 83 R 1
  • 1 / 2 = 0 R 1 (MSB)

Result: 101001110₂.

2. Binary to Octal (Grouping by 3 bits)

Group binary digits into sets of three from the right, padding with leading zeros if needed. Convert each 3-bit group to its octal digit.

Example: Convert 101001110₂ to Octal

Binary:101001110Octal:516

Result: 516₈.

3. Binary to Hexadecimal (Grouping by 4 bits)

Group binary digits into sets of four from the right, padding with leading zeros if needed. Convert each 4-bit group to its hexadecimal digit (0-9, A-F).

Example: Convert 101001110₂ to Hexadecimal

Binary:000101001110Hex:14E

Result: 14E₁₆.

Addition with Negative Numbers

With two’s complement, subtraction becomes simple addition. For A - B, you compute A + (-B).

Example: 5 - 3 (which is 5 + (-3)) using 4 bits

  1. Convert the numbers:

    • 5 is 0101
    • -3 is 1101 (as calculated above)
  2. Add them together:

      ¹ ¹ ¹   (Carries)
      0 1 0 1   (Decimal 5)
    + 1 1 0 1   (Decimal -3)
    ----------
    1 0 0 1 0
    
  3. Handle the Overflow: Notice the result has 5 bits, but we are working with a 4-bit system. In two’s complement addition, if there is a carry-out from the most significant bit (the sign bit), we simply discard it.

    The final result is 0010, which is 2 in decimal. Correct!


🖼️ Diagrams & Visuals

Binary Addition Rules

ABSumCarry
0000
0110
1010
1101

Visualizing the Carry Operation

Here is a more complex example: 27 + 14 = 41

\begin{array}{@{}c@{\,}c@{}c@{}c@{}c@{}c@{}c@{}c} & & \overset{1}{0} & \overset{1}{0} & \overset{1}{1} & \overset{1}{1} & \overset{1}{0} & 1 & 1 \\ + & & 0 & 0 & 0 & 1 & 1 & 1 & 0 \\ \hline & & 0 & 1 & 0 & 1 & 0 & 0 & 1 \\ \end{array}
  • Column 1 (LSB):
  • Column 2: , carry
  • Column 3: , carry
  • Column 4: , carry
  • Column 5: , carry
  • Column 6:
  • Column 7 (MSB):


🔗 Resources


❓ Post lecture


📖 Homework

1110 = -6 0100 = 4 1011 =

-6 + ???? = 0 = 1110 + 0010

0001 + 0001 = 0010

{
	"versionAtEmbed": "0.3.4",
	"filepath": "lecture/Y1/Y1-Q1/attachments/Ink/Drawing/2025.9.1 - 16.22pm.drawing",
	"width": 458,
	"aspectRatio": 0.8971596474045054
}
{
	"versionAtEmbed": "0.3.4",
	"filepath": "lecture/Y1/Y1-Q1/attachments/Ink/Drawing/2025.9.1 - 16.36pm.drawing",
	"width": 500,
	"aspectRatio": 1
}