Skip to content
MathsGenie logo
Quick links
Open app

Course home

  1. A Level
  2. Computer Science OCR
  3. Revision guides

Mathematical skills

What you'll learn

  • How number bases represent data, including binary, hexadecimal, signed numbers and floating point.
  • How to carry out binary arithmetic and show your working clearly.
  • How Boolean algebra describes logic circuits and conditions.
  • How Big-O notation compares the efficiency of algorithms.

OCR H446 expects at least 10% mathematical skills. The maths itself may feel familiar, but you apply it in Level 3 Computer Science contexts: processors, data storage, logic circuits, algorithms and programming.

Number representation and bases

A computer stores data using bits, where a bit is a binary digit: 0 or 1. A number base tells you how many different digit symbols are used before place values move left.

Definition

Base / radix

A base or radix is the number of digit values available in a number system. Denary is base 10, binary is base 2, and hexadecimal is base 16.

Binary place values are powers of 2. In an 8-bit unsigned integer, the place values are:

128, 64, 32, 16, 8, 4, 2, 1

Hexadecimal is often used because one hex digit maps neatly to four binary bits: 1111₂ is F₁₆.

Number representation reference: binary place values, hexadecimal grouping, signed layouts and floating point fields

Example

Converting hexadecimal to binary and denary

Convert 4F₁₆ into binary and denary.

  1. Split the hexadecimal number into digits: 4 and F. The digit F means 15 in denary.

  2. Convert each hex digit into four binary bits: 4₁₆ = 0100₂ and F₁₆ = 1111₂, so 4F₁₆ = 0100 1111₂.

  3. Use hex place values to convert to denary: 4×161+15×160=64+15=794 \times 16^1 + 15 \times 16^0 = 64 + 15 = 794×161+15×160=64+15=79, so 4F₁₆ = 0100 1111₂ = 79₁₀.

Common Mistake

Missing base labels

Always label bases when it matters. The string 1010 could mean 1010₁₀, 1010₂, or even 1010₁₆. In OCR answers, base subscripts remove ambiguity.

Binary arithmetic

Binary addition uses the same column method as denary, but each column can only hold 0 or 1.

The key carry rules are:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 1 = 10₂, so write 0 and carry 1
  • 1 + 1 + carry 1 = 11₂, so write 1 and carry 1

For subtraction, a common technique is to add the two’s complement of the number being subtracted.

Example

Binary addition and subtraction

Work out 01011010₂ + 00110111₂, then work out 01011010₂ - 00110111₂.

  1. Add the two numbers column by column, carrying whenever the total reaches 2 or 3.

    carries:   111110
               01011010
             + 00110111
               --------
               10010001
    

    So 01011010₂ + 00110111₂ = 10010001₂.

  2. For subtraction, find the two’s complement of 00110111₂: invert the bits to get 11001000₂, then add 1 to get 11001001₂.

  3. Add this to the first number and discard the final carry-out because we are working in 8 bits.

               01011010
             + 11001001
               --------
             1 00100011
    

    Therefore 01011010₂ - 00110111₂ = 00100011₂, which is 35₁₀.

Signed numbers

An unsigned integer represents only zero and positive values. A signed integer can represent positive and negative values.

Two common signed representations are sign-and-magnitude and two’s complement.

Key Idea

Sign bit versus weighted bit

In sign-and-magnitude, the leftmost bit is only a sign marker. In two’s complement, the leftmost bit has a negative place value, such as -128 in an 8-bit number.

Example

Representing -13 in 8 bits

Represent -13 using sign-and-magnitude and two’s complement.

  1. Write positive 13 in binary: 13₁₀ = 00001101₂. For sign-and-magnitude, use sign bit 1 for negative and seven magnitude bits 0001101, giving 10001101₂.

  2. For two’s complement, start with +13 as 00001101₂, invert the bits to get 11110010₂, then add 1 to get 11110011₂.

  3. Check the two’s complement value using place values: -128 + 64 + 32 + 16 + 2 + 1 = -13, so 11110011₂ is correct.

Common Mistake

Treating two’s complement like sign-and-magnitude

In two’s complement, do not read the first bit as “negative sign, then magnitude”. The first bit is a negative place value.

Floating-point representation

A floating-point number stores a real number using a mantissa and an exponent.

  • The mantissa stores the significant digits.
  • The exponent stores how far the binary point moves.
  • Normalisation means shifting the mantissa into a standard form to maximise precision.

For OCR-style binary floating point, the mantissa is usually treated as signed two’s complement. A normalised positive mantissa begins 0.1, while a normalised negative mantissa begins 1.0.

Example

Normalising a floating-point number

Represent 6.5₁₀ as a normalised binary floating-point value using an 8-bit mantissa and 4-bit exponent.

  1. Convert 6.5₁₀ into binary: 6₁₀ is 110₂ and 0.5₁₀ is 0.1₂, so 6.5₁₀ = 110.1₂.

  2. Move the binary point left until the positive mantissa starts 0.1: 110.12=0.11012×23110.1_2 = 0.1101_2 \times 2^3110.12​=0.11012​×23.

  3. Store the mantissa as 0.1101000, giving 01101000, and store the exponent +3 as 0011. So the floating-point form is mantissa 01101000 and exponent 0011.

Tip

Range and precision

More exponent bits increase the range of values. More mantissa bits increase precision because more significant bits can be stored.

Boolean algebra

Boolean algebra is the mathematics of true and false values. In Computer Science, it describes logic gates, search conditions, validation rules and program decisions.

Definition

Boolean operators

OCR uses ∧ for AND, ∨ for OR, ¬ for NOT, ⊻ for XOR, and ≡ for logical equivalence. You may also see A.B for AND, A+B for OR, Ā for NOT A, and ⊕ for XOR.

Useful laws include:

  • Commutation: A∧B≡B∧AA ∧ B ≡ B ∧ AA∧B≡B∧A
  • Association: (A∧B)∧C≡A∧(B∧C)(A ∧ B) ∧ C ≡ A ∧ (B ∧ C)(A∧B)∧C≡A∧(B∧C)
  • Distribution: A∧(B∨C)≡(A∧B)∨(A∧C)A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C)A∧(B∨C)≡(A∧B)∨(A∧C)
  • Double negation: ¬¬A≡A¬¬A ≡ A¬¬A≡A
  • De Morgan’s Laws: ¬(A∧B)≡¬A∨¬B¬(A ∧ B) ≡ ¬A ∨ ¬B¬(A∧B)≡¬A∨¬B and ¬(A∨B)≡¬A∧¬B¬(A ∨ B) ≡ ¬A ∧ ¬B¬(A∨B)≡¬A∧¬B
Example

Simplifying a Boolean expression

Simplify ¬(A∧B)∧A¬(A ∧ B) ∧ A¬(A∧B)∧A.

  1. Apply De Morgan’s Law to the bracket: ¬(A∧B)∧A≡(¬A∨¬B)∧A¬(A ∧ B) ∧ A ≡ (¬A ∨ ¬B) ∧ A¬(A∧B)∧A≡(¬A∨¬B)∧A.

  2. Distribute ∧ over ∨: (¬A∨¬B)∧A≡(A∧¬A)∨(A∧¬B)(¬A ∨ ¬B) ∧ A ≡ (A ∧ ¬A) ∨ (A ∧ ¬B)(¬A∨¬B)∧A≡(A∧¬A)∨(A∧¬B).

  3. Use the fact that A∧¬AA ∧ ¬AA∧¬A is always false, so it disappears: the simplified expression is A∧¬BA ∧ ¬BA∧¬B.

A Karnaugh map is a grid used to simplify Boolean expressions by grouping adjacent 1s. Adjacent cells differ by only one variable, so variables that change within a group can be removed.

Three-variable Karnaugh map grouping minterms 1, 3, 5 and 7 to simplify F to C

Key Idea

Karnaugh map grouping

Groups must be rectangles of size 1, 2, 4, 8 and so on. Edges can wrap around, so the left and right sides of a K-map can be adjacent.

Comparing algorithm complexity

Algorithmic complexity measures how resource use changes as input size grows. The input size is usually called nnn.

Definition

Big-O notation

Big-O notation describes the growth rate of an algorithm, usually for time or space. It ignores constants and smaller terms so you can compare scalability.

Common classes are:

  • O(1)O(1)O(1) — constant time
  • O(log⁡n)O(\log n)O(logn) — logarithmic time
  • O(n)O(n)O(n) — linear time
  • O(nk)O(n^k)O(nk) — polynomial time, such as O(n2)O(n^2)O(n2)
  • O(2n)O(2^n)O(2n) — exponential time

Graph comparing Big-O growth rates: constant, logarithmic, linear, polynomial and exponential

Example

Comparing two algorithms

Compare the growth rate of these two core loops.

  1. Algorithm A has one loop from 0 to n - 1, so its key statement runs n times. Its time complexity is linear: O(n)O(n)O(n).

    total = 0
    for i = 0 to n - 1
        total = total + data[i]
    next i
    
  2. Algorithm B has one loop nested inside another. The inner statement runs n times for each of n outer iterations, giving n×n=n2n \times n = n^2n×n=n2 key operations. Its time complexity is polynomial: O(n2)O(n^2)O(n2).

    matches = 0
    for i = 0 to n - 1
        for j = 0 to n - 1
            if data[i] == data[j] then
                matches = matches + 1
            endif
        next j
    next i
    
  3. For large inputs, O(n)O(n)O(n) scales better than O(n2)O(n^2)O(n2) because doubling n roughly doubles Algorithm A’s work but roughly quadruples Algorithm B’s work.

Common Mistake

Assumptions matter

Binary search is O(log⁡n)O(\log n)O(logn) only when the data is sorted and the algorithm can access the middle item efficiently.

Exam technique

In the exam

  1. Label number bases clearly, show place values, and show carries in binary arithmetic rather than jumping straight to an answer.
  2. For Boolean simplification, name the law you are applying, especially De Morgan’s Laws and distribution.
  3. For Big-O, explain growth in terms of input size n; ignore constants, but do not ignore nested loops.
Self review

Check yourself

  • Can you convert 9A₁₆ into binary and denary, showing place values?
  • Can you simplify a Boolean expression using De Morgan’s Laws?
  • Can you explain why a nested loop is often O(n2)O(n^2)O(n2) rather than O(n)O(n)O(n)?
PreviousNext

How was this guide?

Teach Genie

Review Mathematical skills by teaching Genie

Teach it back in your own words, spot gaps, and remember it better.

Start teaching
Genie and Baby Genie

Lesson

Recap your knowledge with an interactive lesson

8 minute activity

Start lesson

8-bit binary place values with 01001111 mapped to denary 79, hexadecimal 4F, and a comparison of sign-and-magnitude with two's complement layouts

A bit is a binary digit, so it can only be 0 or 1. A base, or radix, tells you how many digit symbols are available before place value moves left.

In an 8-bit unsigned binary number, the columns represent powers of 2: 128,64,32,16,8,4,2,1128, 64, 32, 16, 8, 4, 2, 1128,64,32,16,8,4,2,1. Hexadecimal is base 16, and each hex digit matches exactly four binary bits, so it is a compact way to write byte-sized values.

Always label bases when meaning could be ambiguous. For example, (1010)2(1010)_2(1010)2​, (1010)10(1010)_{10}(1010)10​ and (1010)16(1010)_{16}(1010)16​ are different values.

Flashcards

Remember key concepts with flashcards

23 flashcards

Practice flashcards

What is a number base (radix)?

Mathematical skills Revision Guide

  1. A Level
  2. /Computer Science
  3. /Mathematical skills

Revision guides