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.
Often the integers are 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 (or 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 rules of geometry, which define a line without endpoints as infinite line, a line with one endpoint as ray, and a line with two endpoints as 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.
Sometimes it is convenient to scale the numbers on the number line with a logarithmic scale, using scientific notation. For example, the number one inch to the right of 0 might be 1, then the number once inch farther to the right would be 101 (=10), then one inch to the right of that would be 102 (=100), then 1000, then 10,000, etc. This approach is useful, for example, in illustrating a sequence of events in the history of the universe or of evolution, or in comparing distances to various stars.
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 potential values of one real number, commonly called x, and another real number line can be drawn vertically to denote potential values of another real number, commonly called y. Together these lines form what is known as the Cartesian coordinate system, and any point in the Cartesian plane denotes the values 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 number 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.