In basic mathematics, a number line is a picture of a graduated straight line that serves as abstraction for real numbers, denoted by . Every point of a number line is assumed to correspond to a real number, and every real number to a point.
The integers are often shown as specially-marked points evenly spaced on the line. Although this image only shows the integers from −9 to 9, the line includes all real numbers, continuing forever in each direction, and also numbers not marked that are between the integers. It is often used as an aid in teaching simple addition and subtraction, especially involving negative numbers.
In advanced mathematics, the expressions real number line, or real line are typically used to indicate the above-mentioned concept that every point on a straight line corresponds to a single real number, and vice versa.
A number line is usually represented as being horizontal, but in a Cartesian coordinate plane the vertical axis (y-axis) is also a number line. According to one convention, positive numbers always lie on the right side of zero, negative numbers always lie on the left side of zero, and arrowheads on both ends of the line are meant to suggest that the line continues indefinitely in the positive and negative directions. Another convention uses only one arrowhead which indicates the direction in which numbers grow. The line continues indefinitely in the positive and negative directions according to the rules of geometry which define a line without endpoints as an infinite line, a line with one endpoint as a ray, and a line with two endpoints as a line segment.
If a particular number is farther to the right on the number line than is another number, then the first number is greater than the second (equivalently, the second is less than the first). The distance between them is the magnitude of their difference—that is, it measures the first number minus the second one, or equivalently the absolute value of the second number minus the first one. Taking this difference is the process of subtraction.
Thus, for example, the length of a line segment between 0 and some other number represents the magnitude of the latter number.
Two numbers can be added by "picking up" the length from 0 to one of the numbers, and putting it down again with the end that was 0 placed on top of the other number.
Two numbers can be multiplied as in this example: To multiply 5 × 3, note that this is the same as 5 + 5 + 5, so pick up the length from 0 to 5 and place it to the right of 5, and then pick up that length again and place it to the right of the previous result. This gives a result that is 3 combined lengths of 5 each; since the process ends at 15, we find that 5 × 3 = 15.
Division can be performed as in the following example: To divide 6 by 2—that is, to find out how many times 2 goes into 6—note that the length from 0 to 2 lies at the beginning of the length from 0 to 6; pick up the former length and put it down again to the right of its original position, with the end formerly at 0 now placed at 2, and then move the length to the right of its latest position again. This puts the right end of the length 2 at the right end of the length from 0 to 6. Since three lengths of 2 filled the length 6, 2 goes into 6 three times (that is, 6 ÷ 2 = 3).
The section of the number line between two numbers is called an interval. If the section includes both numbers it is said to be a closed interval, while if it excludes both numbers it is called an open interval. If it includes one of the numbers but not the other one, it is called a half-open interval.
All the points extending forever in one direction from a particular point are together known as a ray. If the ray includes the particular point, it is a closed ray; otherwise it is an open ray.
On the number line, the distance between two points is the unit length if and only if the difference of the represented numbers equals 1. Other choices are possible.
One of the most common choices is the logarithmic scale, which is a representation of the positive numbers on a line, such that the distance of two points is the unit length, if the ratio of the represented numbers has a fixed value, typically 10. In such a logarithmic scale, the origin represents 1; one inch to the right, one has 10, one inch to the right of 10 one has , then , then , etc. Similarly, one inch to the left of 1, one has , then , etc.
This approach is useful, when one wants to represent, on the same figure, values with very different order of magnitude. For example, one requires a logarithmic scale for representing simultaneously the size of the different bodies that exist in the Universe, typically, a photon, an electron, an atom, a molecule, a human, the Earth, the Solar System, a galaxy, and the visible Universe.
Logarithmic scales are used in slide rules for multiplying or dividing numbers by adding or subtracting lengths on logarithmic scales.
A line drawn through the origin at right angles to the real number line can be used to represent the imaginary numbers. This line, called imaginary line, extends the number line to a complex number plane, with points representing complex numbers.
Alternatively, one real number line can be drawn horizontally to denote possible values of one real number, commonly called x, and another real number line can be drawn vertically to denote possible values of another real number, commonly called y. Together these lines form what is known as a Cartesian coordinate system, and any point in the plane represents the value of a pair of real numbers. Further, the Cartesian coordinate system can itself be extended by visualizing a third number line "coming out of the screen (or page)", measuring a third variable called z. Positive numbers are closer to the viewer's eyes than the screen is, while negative numbers are "behind the screen"; larger numbers are farther from the screen. Then any point in the three-dimensional space that we live in represents the values of a trio of real numbers.