Number Systems and Calculations

SA
StudyAI Editorial
Reviewed by StudyAI tutors
· Published Updated

From the Higher Benchmark Test Revision curriculum

Number Systems and Calculations

TL;DR

You'll learn about different number systems, focusing on how to convert between them and perform basic arithmetic. Understanding these systems is crucial for computer science and digital electronics. Mastering these conversions and calculations will help you tackle more complex problems.

1. The Mental Model

Think of number systems as different languages for counting. Just like "cat" and "gato" both refer to the same animal, "10" in decimal and "1010" in binary both represent the same quantity. You need to know how to translate between these languages.

2. The Core Material

You'll mainly deal with four number systems:
* Decimal (Base-10): The system we use daily, with digits 0-9. Each position is a power of 10.
* Binary (Base-2): Uses only 0s and 1s. Each position is a power of 2. This is what computers understand.
* Octal (Base-8): Uses digits 0-7. Each position is a power of 8. Less common now.
* Hexadecimal (Base-16): Uses digits 0-9 and letters A-F (A=10, B=11, ..., F=15). Each position is a power of 16. Used for memory addresses and color codes.

Converting Between Bases

A young baseball player in uniform sprints towards base on a sunny day.
Photo by Pixabay on Pexels

The key to conversion is understanding place values.

Decimal to Other Bases

To convert a decimal number to another base (binary, octal, hex), you repeatedly divide the decimal number by the target base and record the remainders. Read the remainders from bottom to top.

Other Bases to Decimal

To convert a number from another base to decimal, multiply each digit by its place value (which is a power of the base) and sum the results.

Binary, Octal, Hexadecimal Interconversion

These three are special because their bases are powers of 2 (2^1, 2^3, 2^4). This means you can convert directly between them by grouping bits.
* Binary to Octal: Group binary digits into sets of three from the right, then convert each group to its octal equivalent.
* Octal to Binary: Convert each octal digit to its 3-bit binary equivalent.
* Binary to Hexadecimal: Group binary digits into sets of four from the right, then convert each group to its hexadecimal equivalent.
* Hexadecimal to Binary: Convert each hexadecimal digit to its 4-bit binary equivalent.

graph TD
    A["Decimal (Base 10)"] -->|Divide by base, collect remainders| B["Binary (Base 2)"]
    A -->|Divide by base, collect remainders| C["Octal (Base 8)"]
    A -->|Divide by base, collect remainders| D["Hexadecimal (Base 16)"]

    B -->|Sum (digit * 2^pos)| A
    C -->|Sum (digit * 8^pos)| A
    D -->|Sum (digit * 16^pos)| A

    B -->|Group by 3 bits| C
    C -->|Expand to 3 bits| B
    B -->|Group by 4 bits| D
    D -->|Expand to 4 bits| B

Basic Arithmetic Operations

Mathematical study scene with open book, graph paper, and pen for learning and homework.
Photo by Lum3n on Pexels

You'll need to perform addition, subtraction, multiplication, and division within non-decimal systems, particularly binary. The principles are the same as decimal arithmetic, but you use the rules of the specific base.

Binary Addition

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0 (carry 1)
  • 1 + 1 + 1 = 1 (carry 1)

Binary Subtraction

Often done using two's complement for positive numbers to avoid borrowing.
1. Find the one's complement (flip all bits).
2. Add 1 to the one's complement to get the two's complement.
3. Add the two's complement of the subtrahend to the minuend.
4. Discard any final carry bit.

3. Worked Example

Let's convert the decimal number 25 to binary, then add it to binary 1011 (decimal 11), and finally convert the result to hexadecimal.

Step 1: Decimal 25 to Binary
* 25 / 2 = 12 remainder 1
* 12 / 2 = 6 remainder 0
* 6 / 2 = 3 remainder 0
* 3 / 2 = 1 remainder 1
* 1 / 2 = 0 remainder 1
Reading remainders bottom-up: 25 (decimal) = 11001 (binary)

Step 2: Binary Addition (11001 + 1011)
Pad the shorter number with leading zeros so they have the same length: 11001 + 01011

  11001
+ 01011
-------
  • 1 + 1 = 0 (carry 1)
  • 0 + 1 + (carry 1) = 0 (carry 1)
  • 0 + 0 + (carry 1) = 1
  • 1 + 1 = 0 (carry 1)
  • 1 + 0 + (carry 1) = 0 (carry 1)
    Result: 100100 (binary)

Step 3: Binary to Hexadecimal (100100)
Group the binary digits into sets of four from the right. Pad with leading zeros if necessary.
0010 0100
Convert each group:
* 0010 = 2 (decimal) = 2 (hex)
* 0100 = 4 (decimal) = 4 (hex)
Result: 24 (hexadecimal)

Let's check our addition: 25 + 11 = 36 (decimal).
Converting 100100 (binary) to decimal:
(1 * 2^5) + (0 * 2^4) + (0 * 2^3) + (1 * 2^2) + (0 * 2^1) + (0 * 2^0)
= 32 + 0 + 0 + 4 + 0 + 0 = 36 (decimal). Correct!
Converting 24 (hexadecimal) to decimal:
(2 * 16^1) + (4 * 16^0) = 32 + 4 = 36 (decimal). Correct!

4. Key Takeaways

  • Each number system uses a different base, which determines the available digits and place values.
  • Decimal to other bases involves repeated division and collecting remainders from bottom-up.
  • Other bases to decimal involves summing each digit multiplied by its base-power place value.
  • Binary, octal, and hexadecimal conversions can be done directly by grouping bits (3 for octal, 4 for hex).
  • Binary arithmetic follows similar rules to decimal, with carries and borrows specific to base-2.
  • Two's complement is a common method for performing binary subtraction.
  • Always be mindful of the base you're working in when performing calculations or conversions.

Common Mistakes to Avoid

Notebook labeled 'Mistake' next to a red delete eraser on a dark background.
Photo by KATRIN BOLOVTSOVA on Pexels

  • Forgetting to read remainders from bottom-up when converting from decimal.
  • Mixing up the number of bits to group for octal (3 bits) vs. hexadecimal (4 bits).
  • Incorrectly calculating powers of the base during conversion to decimal.
  • Not handling carries or borrows correctly in non-decimal arithmetic.
  • Ignoring leading zeros when grouping bits for interconversion, which can change the value.

5. Now Try It

Convert the decimal number 190 to binary. Then convert that binary number to hexadecimal. Finally, add the hexadecimal number 1A to your result. What is the final answer in hexadecimal?

Success looks like: You should end up with a 3-digit hexadecimal number.

Frequently asked about Number Systems and Calculations

You'll learn about different number systems, focusing on how to convert between them and perform basic arithmetic. Understanding these systems is crucial for computer science and digital electronics. Read the full notes above for the details.

Number Systems and Calculations is a core topic in Higher Benchmark Test Revision. Most exam papers test it via a mix of definitions, worked examples, and applied problems. The notes above cover the high-yield sub-topics, common pitfalls, and the kind of questions examiners typically set.

Yes. Every note in the StudyAI Campus Hub is free to read. Create a free account if you want to clone the full plan, generate your own notes from your textbook, or get AI-powered practice quizzes and flashcards.

More from Higher Benchmark Test Revision


Get the full Higher Benchmark Test Revision curriculum

Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.

Create Free Account