Jump to content

Number systems

From Wikibooks, open books for an open world

PAPER 2 - ⇑ Fundamentals of data representation ⇑

Number systems Number bases →


Mathematics is fundamental to the study of computer science. It is important that the maths used is clearly defined and unambiguous. This begins with the definitions of the numbers that are used as a part of the mathematics.

These definitions are described using sets whereby separate objects, in this case the numbers themselves, are collected together to form a new descriptive object. The set of odd numbers from 0 to 10 could be described as:

O = {1, 3, 5, 7, 9}

O is the name of the set and the numbers are the objects that form that set.

Natural numbers

[edit | edit source]

Maths is based on counting objects. Children learn from an early age that different numbers of objects can be described using different names, for example five oranges or ten bananas.

The set of Natural numbers ℕ contains all positive integers (whole numbers), as well as the number 0, and can be described as:

ℕ = {0, 1, 2, 3, ...}

Note that there are an infinite amount of numbers so it is impossible to define the set entirely. It is perfectly acceptable to define the first few values in this case.

Integer numbers

[edit | edit source]

To extend this we can include negative values. Integers are whole numbers that can be either positive or negative:

ℤ = {..., -3, -2, -1 , 0, 1, 2, 3, ...}

By extension, they include the Natural numbers defined earlier.

Rational numbers

[edit | edit source]

Numbers can also be expressed as fractions. This includes integers and numbers that have fractional parts. For example, the integer 5 can also be expressed as the fraction 5/1 (which is a rational number) in the same way as the value 1.5 would be expressed as the fraction 3/2. We can describe a limited part of the set of Rational numbers as follows:

ℚ = {..., -1/3, -1/2, -1/1 , 0, 1/1, 1/2, 1/3, ...}

As per the previous sets there are an infinite number of Rational values.

Irrational numbers

[edit | edit source]

Some numbers cannot be expressed as a fraction. When Rational numbers are expressed as decimal values they will have a definite number of values after the decimal place. 1/4 is a Rational number and this would be expressed as the decimal value 0.25. Numbers with a recurring decimal part are also rational. 1/3 would be expressed as the decimal 0.3 ̇.

These numbers are not described as a set as they are special cases. Common Irrational numbers used regularly are described using separate symbols:

π (Pi)
√2
e (Euler's number)
φ (Golden ratio)

Real numbers

[edit | edit source]

All the sets of numbers described above are considered as the set of Real numbers ℝ. On a number line a Real value would be any value that is on that line.

Ordinal numbers

[edit | edit source]

Within a set of ordered values, Ordinal numbers indicate the positions of the values. So in the set S = {"alpha", "beta", "gamma"} the object "alpha" is the 1st, "beta" the 2nd and so on.

Counting and measuring

[edit | edit source]

The applications of these sets of numbers can be seen in the real-world. Natural numbers are used for counting objects that can be seen, for example, the number of apples on a table:

Similarly Real numbers are used as measurements due to the ability to quantify these values to contain fractional parts.

Exercise: Identify all the possible number systems for the following values

34

Answer:

Natural, Integer, Real

π

Answer:

Irrational, Real

9/1

Answer:

Rational, Natural, Integer, Real

1/9

Answer:

Rational, Real

3rd

Answer:

Ordinal