Skip to topic
    ← Back to course topics

    Rational numbers — AQA A-Level Computer Science

    A rational number is any value that can be expressed as the ratio of two integers a/b, where the denominator b is not equal to zero. In AQA A-Level Computer Science, understanding rational numbers is essential for evaluating binary representations, fixed-point and floating-point systems, and precision limits.

    Rational numbers explained

    This statement gives the defining property of the set ℚ: its members are exactly the numbers that can be written as fractions, meaning ratios of two integers.

    Read the full explanation

    A fraction a/b has an integer numerator a and a non-zero integer denominator b. The statement is a definition, so it is precise: a number belongs to ℚ if and only if such a representation exists. Examples include 1/2, −7/3 and 4, since 4 = 4/1. A number that cannot be expressed this way is not in ℚ. The square root of 2 is a standard example, because it is irrational. In multiple-choice questions you should be able to recognise whether a given number, expression or description matches this definition. The important words are integers, ratio and fraction, since any number built from these by division with integer parts is rational.

    Your focus

    1. ℚ is the set of numbers that can be written as fractions (ratios of integers).

    Which command word is this?

    Provide a concise, factual answer without lengthy explanation or derivation (e.g. 'State the symbol used to denote the set of rational numbers').

    Rational numbers exam tips

    Topic Overview

    Rational numbers (denoted by the set symbol Q) form a core component of the AQA A-Level Computer Science theory on number systems. They include all values that can be represented as an exact quotient of two integers, encompassing integers, terminating decimals, and recurring decimals.

    Understanding rational numbers is fundamental when examining how computers process non-integer data. It links theoretical set theory directly to practical machine architecture, explaining why certain fractions cause precision errors and recurring patterns when converted into binary formats.

    Key Concepts
    • →Set Notation: Rational numbers are represented by Q, defined mathematically as {a/b : a, b in Z, b != 0}.
    • →Decimal Equivalence: Every rational number converts to either a terminating decimal (e.g. 1/4 = 0.25) or a repeating recurring decimal (e.g. 1/3 = 0.333...).
    • →Base Dependence: A rational number that terminates in base 10 may recur infinitely in base 2 if its denominator is not a power of two.
    • →Set Hierarchy: Natural numbers (N) are a subset of Integers (Z), which are a subset of Rational numbers (Q), which are a subset of Real numbers (R).
    Marking Points
    • States that ℚ consists of numbers expressible as a/b with a and b integers and b ≠ 0.
    • Recognises that ℚ is defined by the existence of an integer fraction representation, not by how the number looks as a decimal.
    • Gives a valid member such as −7/3 or 4 and explains why it qualifies.
    • Identifies a non-member such as √2 and states that it cannot be written as a ratio of integers.
    Examiner Tips
    • 💡When an option describes ℚ, check that it refers to ratios of integers, not simply to any real numbers or decimals.
    • 💡Convert a decimal to a fraction to test rationality; a terminating decimal such as 0.25 gives 1/4.
    • 💡Eliminate options containing irrational examples such as √2 or π when identifying members of ℚ.
    • 💡Memorise standard set symbols: N for Natural, Z for Integers, Q for Rational, and R for Real. Use them explicitly in multi-part classification questions.
    • 💡When explaining why a rational number cannot be represented exactly in binary, always mention that the denominator cannot be expressed purely as powers of two (2^-n).
    Common Mistakes
    • Assumes a number is rational only if it is written as a fraction on the page; correct by checking whether an equivalent integer ratio exists, for example 0.5 = 1/2.
    • Accepts a decimal such as π as rational because it has many digits; correct by recognising that π is irrational as it has no integer ratio representation.
    • Overlooks the non-zero condition on the denominator; correct by requiring b ≠ 0 in every fraction.
    • Believing 0.1 and 0.2 are exact in binary: Students assume that because these are simple terminating fractions in decimal, they store precisely in binary, whereas they recur infinitely.
    • Assuming all square roots are irrational: While sqrt(2) and sqrt(3) are irrational, expressions like sqrt(4) or sqrt(9/16) simplify to 2 and 3/4, which are rational.
    • Confusing recurring decimals with irrational numbers: Students frequently classify numbers like 0.666... as irrational, even though any recurring decimal can be written as an integer fraction (e.g. 2/3).
    Revision Plan
    1. 1Day 1: Review definitions and set notation for N, Z, Q, and R, practicing standard classification drills.
    2. 2Day 2: Practise converting base-10 rational fractions into binary fixed-point format to observe terminating versus recurring behaviour.
    3. 3Day 3: Work through past paper questions focused on round-off errors and precision limitations in floating-point systems.
    4. 4Day 4: Complete timed active recall questions on definitions, constraints (such as b != 0), and set hierarchy.
    Exam Question Types
    • 📋Classification tables: Identifying which number sets (N, Z, Q, R) apply to a given list of numeric values.
    • 📋Short definition questions: Stating the formal mathematical definition and criteria for set Q.
    • 📋Reasoning questions: Explaining why a specific rational decimal cannot be stored precisely in binary floating-point representation.
    Command Word Expectations (AQA)
    State

    Provide a concise, factual answer without lengthy explanation or derivation (e.g. 'State the symbol used to denote the set of rational numbers').

    Define

    Give the exact mathematical meaning, including all conditions (e.g. a/b where a and b are integers and b != 0).

    Explain

    Provide reasons and technical causes, such as explaining how base conversion causes recurring bit sequences and round-off error.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Defining rational numbers vaguely as 'decimals' or 'fractions' without specifying integer components and a non-zero denominator.
    ❌ Weak Answer (Loses Marks):A rational number is a number that can be written as a fraction or a decimal.
    Example improved answer:A rational number is any number that can be expressed in the form a/b, where a and b are both integers and b is not equal to zero.
    Examiner Tip: Always state both conditions: the numerator and denominator must be integers, and the denominator cannot be zero. Use the set symbol Q to show precise mathematical understanding.
    Pitfall: Assuming all base-10 terminating decimals can be represented exactly in binary floating-point systems.
    ❌ Weak Answer (Loses Marks):Numbers like 0.2 are rational, so a computer can store them without any rounding errors.
    Example improved answer:Although 0.2 (1/5) is a rational number, its denominator cannot be formed from powers of two. In binary, 0.2 becomes an infinitely recurring fraction (0.00110011...), leading to round-off errors in fixed-point and floating-point representations.
    Examiner Tip: Distinguish between a number being theoretically rational (in Q) and whether it can be represented exactly in finite binary bits.
    Step-by-Step Worked Solutions

    Question: Categorise the following numbers into the most specific number set among Natural (N), Integer (Z), Rational (Q), and Real (R): -14, 0.375, sqrt(5), 19.

    1. 1.Step 1: Identify 19. It is a positive whole counting number, so its most specific set is the Natural numbers (N).
    2. 2.Step 2: Identify -14. It is a whole number with a negative sign, so its most specific set is the Integers (Z).
    3. 3.Step 3: Identify 0.375. It is a terminating decimal equal to 3/8, which is the ratio of two integers (3 and 8), so its most specific set is the Rational numbers (Q).
    4. 4.Step 4: Identify sqrt(5). Its decimal expansion is non-terminating and non-recurring, so it cannot be written as a ratio of integers; therefore, it is an irrational number and belongs to the Real numbers (R).
    Final Answer: 19: Natural (N); -14: Integer (Z); 0.375: Rational (Q); sqrt(5): Real (R).

    Question: Explain why the rational number 3/10 cannot be represented exactly in a standard 8-bit unsigned binary fixed-point system with 4 fractional bits. Calculate the absolute error.

    1. 1.Step 1: Convert 3/10 (0.3 in decimal) to binary fractional values using powers of two: 0.5 (2^-1), 0.25 (2^-2), 0.125 (2^-3), 0.0625 (2^-4).
    2. 2.Step 2: Calculate the closest binary approximation using 4 fractional bits: 0.25 + 0.00 + 0.0625 = 0.3125 (0.0101 in binary), or 0.25 (0.0100 in binary = 0.25).
    3. 3.Step 3: Select the closest representation: 0.0101 binary = 0.3125 decimal.
    4. 4.Step 4: Compute the absolute error: |0.3125 - 0.3000| = 0.0125. The fraction 3/10 has a denominator of 10 (prime factors 2 and 5), which produces an infinitely recurring sequence in base 2.
    Final Answer: 3/10 produces an infinite recurring binary sequence because 10 is not a power of 2. The closest 4-bit fractional approximation is 0.0101 (0.3125), giving an absolute error of 0.0125.
    Active Recall Memory Test
    What mathematical symbol represents the set of rational numbers?
    Key Fact: The symbol Q (standing for 'quotient').
    What are the two conditions for a number a/b to belong to the set of rational numbers?
    Key Fact: 1. Both a and b must be integers (a, b in Z). 2. The denominator b must not equal zero (b != 0).
    Why can the rational number 1/8 be stored exactly in binary, but 1/10 cannot?
    Key Fact: 8 is an exact power of two (2^3), resulting in a terminating binary fraction (0.001), whereas 10 has prime factor 5, causing an infinite recurring binary sequence.
    Frequently Asked Questions
    What is the difference between a rational number and an irrational number?
    A rational number can always be expressed as an exact fraction a/b where a and b are integers and b is non-zero. In decimal form, rational numbers either terminate or repeat periodically. In contrast, irrational numbers cannot be expressed as an integer ratio and have infinite, non-repeating decimal expansions, such as pi or the square root of 2.
    Are all integers also rational numbers?
    Yes, every integer is also a rational number. Any integer n can be written in the form n/1, which satisfies the definition of a rational number because both n and 1 are integers and the denominator is not zero. Therefore, the set of integers Z is a strict subset of the rational numbers Q.
    Why does Python or Java say 0.1 + 0.2 == 0.30000000000000004?
    Both 0.1 (1/10) and 0.2 (1/5) are rational numbers, but their denominators cannot be represented using finite powers of two. When converted to IEEE 754 standard binary floating-point representation, they become infinitely recurring numbers that must be truncated. Adding these rounded representations introduces a minor round-off error, producing 0.30000000000000004 instead of exactly 0.3.
    Can recurring decimals like 0.777... be considered rational?
    Yes, all recurring decimals are rational numbers. For instance, 0.777... can be converted algebraically into the exact integer fraction 7/9. Because it can be represented as a ratio of two integers with a non-zero denominator, it belongs to set Q.