Uni-Sine
MathematicsGeometry

Line segment

A line segment is the part of a line between two points, called its endpoints. Unlike a line, which goes on forever in both directions, a line segment has a beginning and an end, so you can measure its length. A segment with endpoints A and B is written AB with a bar over the top, or simply called segment AB.

What is a line segment?

Take a straight line and mark two points on it. The piece between those points, including the points themselves, is a line segment. The edge of a ruler, a side of a triangle and a pencil stroke from one dot to another are all line segments.

−2−101234123ABM
Segment AB stops at its endpoints. M is halfway along

Here segment AB runs from A(−2, 0) to B(4, 3). Unlike a line, it is not drawn past its endpoints. The point M halfway along is its midpoint. Its length and midpoint are worked out in the examples below.

Line segment vs line vs ray

ABPQRSlineraysegment
A line goes on in both directions, a ray in one, and a segment stops at both ends
FigureEndpointsLengthNotationPicture in words
LineNoneGoes on foreverAB with a two-headed arrow on topArrows at both ends
RayOneGoes on foreverAB with a one-headed arrow on topA dot at one end, an arrow at the other
Line segmentTwoCan be measuredAB with a bar on topA dot at each end

A ray is like a beam of light from a flashlight: it starts at one point and keeps going. A line segment is like a piece of string pulled tight between two pins. In the US, students learn to draw points, lines, line segments and rays in grade 4, and in high school geometry they use exact definitions of each.

How to name a line segment

  • Use its two endpoints: segment AB, written as AB with a bar over the letters.
  • The order doesn't matter for a segment: AB and BA are the same segment.
  • Write the length without the bar: AB = 6 means the segment AB is 6 units long.

Length of a line segment

On a number line

The length of a segment on a number line is the distance between its endpoints: subtract and take the absolute value.

\text{length} = |b - a|

A segment from −3 to 5 has length |5 − (−3)| = 8.

On a coordinate plane: the distance formula

For endpoints (x₁, y₁) and (x₂, y₂), the length is:

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

This is the Pythagorean theorem in disguise. The horizontal change and the vertical change are the two legs of a right triangle, and the segment is its hypotenuse. Using the Pythagorean theorem to find the distance between two points is part of grade 8 math under the Common Core standards.

Example 1: the segment AB above

Find the length of the segment from A(−2, 0) to B(4, 3).

d = \sqrt{(4 - (-2))^2 + (3 - 0)^2} = \sqrt{36 + 9} = \sqrt{45} = 3\sqrt{5} \approx 6.71

The segment is about 6.71 units long.

Example 2: a whole-number answer

Find the length of the segment from (1, 2) to (7, 10).

d = \sqrt{6^2 + 8^2} = \sqrt{100} = 10

The segment is 10 units long. The Midpoint and Distance Calculator finds the length, midpoint and slope of any segment with the working shown.

Midpoint of a line segment

The midpoint is the point exactly halfway between the endpoints, so it splits the segment into two equal parts. Average the x-coordinates and average the y-coordinates:

M = \left(\frac{x_1 + x_2}{2},\ \frac{y_1 + y_2}{2}\right)

Example 3: find the midpoint

For A(−2, 0) and B(4, 3), the midpoint is ((−2 + 4) ÷ 2, (0 + 3) ÷ 2) = (1, 1.5), the point M in the first figure. On a number line, the midpoint of the segment from −3 to 5 is (−3 + 5) ÷ 2 = 1.

Example 4: find a missing endpoint

M(3, −1) is the midpoint of segment AB, and A is (−1, 4). Find B.

The midpoint is the average, so each coordinate of B is twice the midpoint's coordinate minus A's:

B = (2 \times 3 - (-1),\ 2 \times (-1) - 4) = (7,\ -6)

Check: the average of −1 and 7 is 3, and the average of 4 and −6 is −1. So B is (7, −6).

Segment addition postulate

2x + 34x − 1ABC
AB + BC = AC

If point B lies on segment AC, between A and C, then the two smaller segments add up to the whole: AB + BC = AC. Geometry courses call this the segment addition postulate, and it turns many segment problems into equations.

Example 5: solve for x

B is between A and C. AB = 2x + 3, BC = 4x − 1 and AC = 26. Find AB and BC.

(2x + 3) + (4x - 1) = 26
6x + 2 = 26,\ \ x = 4

So AB = 2(4) + 3 = 11 and BC = 4(4) − 1 = 15. Check: 11 + 15 = 26.

Congruent segments and bisectors

  • Congruent segments have the same length. In diagrams they are marked with matching tick marks.
  • A segment bisector is a point, line, ray or segment that passes through the midpoint, cutting the segment into two congruent halves.
  • A perpendicular bisector crosses the segment at its midpoint at a right angle. Every point on it is the same distance from both endpoints.

With just a compass and straightedge, you can copy a segment and bisect a segment, two of the constructions in high school geometry.

Check your understanding.

practice
Pick an answer, then check it.
Which of these has exactly two endpoints?

Line segments in shapes

Every polygon is made of line segments. A triangle has 3 sides, which are segments, and a square has 4. Diagonals are segments too: a segment joining two corners that are not next to each other. The edges of 3D shapes such as cubes are line segments as well: a cube has 12.

Here is a neat counting fact. With n points on a line, every pair of points makes a segment, so there are n(n − 1) ÷ 2 segments. Five points on a line make 5 × 4 ÷ 2 = 10 segments.

Common mistakes

  • Drawing arrows on a segment. Arrows mean the figure keeps going. A segment has a dot at each end instead.
  • Mixing up the notation. A bar on top names the segment. No bar means its length. An arrow means a ray or a line.
  • Forgetting to square in the distance formula, or adding the differences instead of their squares.
  • Subtracting in the midpoint formula. The midpoint adds the coordinates and halves them. The distance formula subtracts them.
  • Losing a negative sign. 4 − (−2) is 6, not 2. Put negatives in parentheses before you square.
  • Thinking AB and BA are different segments. They are the same. Order only matters for rays.

Practice with a short timed paper

Lengths, midpoints and the distance formula come up in geometry, algebra and the SAT. The daily Geometry, Algebra 2 & SAT Math and Pre-Algebra & Algebra 1 papers are short timed practice tests of 8 questions, with a new one every day.

Common questions

What is a line segment?
The part of a line between two endpoints. It has a definite length, unlike a line, which goes on forever.
What is the difference between a line, a ray and a line segment?
A line has no endpoints and goes on forever both ways. A ray has one endpoint and goes on forever one way. A line segment has two endpoints and a fixed length.
What is the symbol for a line segment?
A bar drawn over the two endpoint letters, like AB with a line over it.
How do you find the length of a line segment?
On a number line, subtract the endpoints and take the absolute value. On a graph, use the distance formula d = √((x₂ − x₁)² + (y₂ − y₁)²).
How do you find the midpoint of a line segment?
Average the coordinates of the endpoints: ((x₁ + x₂)/2, (y₁ + y₂)/2).
Is the side of a triangle a line segment?
Yes. Every side of a polygon is a line segment, with the corners as its endpoints.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Midpoint and Distance Calculator

    Find the midpoint, distance and gradient between two points

    Open the tool
  • Test it

    Geometry, Algebra 2 & SAT Math

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
  • Test it

    Pre-Algebra & Algebra 1

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · GeometryMidpoint calculator: find the midpoint of two pointsFind the midpoint of a line segment from two points, with exact fractions, the distance and gradient, a coordinate plot and worked examples.