A line continues in two directions, a ray continues in one direction, and a line segment stops at two endpoints. Opposite rays share an endpoint and point in exactly opposite directions along the same line.
Lines, segments, and rays playground
Choose an object, then drag A and B or edit their coordinates. The grid uses the same scale horizontally and vertically. Coordinates run from −9 to 9, with up to two decimal places.
Compare the objects
| Object | Endpoints | Extent |
|---|---|---|
| Line AB | None | Both directions without end |
| Segment AB | Two: A and B | Only between its endpoints |
| Ray AB | One: A | From A through B, and beyond B |
Notation: line \(\overleftrightarrow{AB}\), segment \(\overline{AB}\), and ray \(\overrightarrow{AB}\).
What is a line?
A line is straight and extends indefinitely in both directions. It contains infinitely many points. Two distinct points determine exactly one line; one point alone does not fix a unique line.

You can name a line using two points on it, such as line XY, or a lowercase label such as line a. Naming two points does not mean the line contains only those points.

What is a line segment?
A segment is the part of a line between two endpoints, including the endpoints. Its length is finite and can be measured.


\[AB=\sqrt{(x_B-x_A)^2+(y_B-y_A)^2}\]
For A = (0, 0) and B = (3, 4), the length is \(\sqrt{3^2+4^2}=5\) units. In the playground, non-exact decimal lengths are marked as approximations.
What is a ray?
A ray has one endpoint and continues indefinitely in one direction. In ray AB, A is the endpoint; B is another point that specifies the direction. B is not a second endpoint.


Order matters: \(\overrightarrow{AB}\) and \(\overrightarrow{BA}\) usually describe different rays. The arrowhead in a drawing indicates continuation; it is not the ray's endpoint.
What are opposite rays?
Opposite rays have the same endpoint, lie on the same straight line, and extend in opposite directions. Their union is the whole line, and they form a straight angle of 180°.

In the diagram, rays ZX and ZY start at Z and point in opposite directions. Rays that start at the same point but form a 90° angle are not opposite rays.
Try these checks
- Select segment AB and set A to (0, 0), B to (3, 4). Check its 5-unit length.
- Switch to ray AB. Notice that the drawing continues past B but starts at A.
- Choose opposite rays. Both rays keep the same endpoint even as you change the direction.
If A and B coincide, they cannot specify a unique line or ray direction. The tool rejects that case for lines and rays. A coincident-endpoint segment is allowed as a degenerate segment of length zero.
Practice
Which object has exactly one endpoint? Does a line through A and B stop at B? Do two rays with different endpoints form opposite rays?
Check the answers
A ray. No, a line continues beyond B in both directions. No, opposite rays must share the same endpoint.
Use these ideas in the linear pair lesson, or try the line and ray identification game.