How to Find the Length of a Line Segment
A line segment is the straight path between two points — it has a definite start, a definite end, and a measurable length. Finding that length is one of the most common tasks in coordinate geometry, and once you see the pattern, it becomes second nature.
Horizontal and Vertical Segments
The easiest cases are segments that run straight across or straight up and down.
Horizontal segment: both endpoints share the same y-coordinate. The length is just the difference in x-values.
Segment from \((1, 4)\) to \((7, 4)\): length = \(7 - 1 = 6\)
Vertical segment: both endpoints share the same x-coordinate. The length is the difference in y-values.
Segment from \((3, 2)\) to \((3, 9)\): length = \(9 - 2 = 7\)
In both cases, just subtract — and take the absolute value if you're not sure which is larger, since length is always positive.
Diagonal Segments
When a segment runs at an angle, counting grid squares won't cut it. Instead, we use the relationship between the segment and a right triangle.
Here's the key insight: any diagonal segment is the hypotenuse of a right triangle. Draw a horizontal line from one endpoint and a vertical line from the other, and they'll meet at a corner. The two legs of that triangle have lengths you can calculate directly — the horizontal leg is the change in x, and the vertical leg is the change in y. Then the Pythagorean theorem gives you the hypotenuse, which is the segment's length.
The Distance Formula
That reasoning leads directly to the distance formula. For a segment with endpoints \((x_1, y_1)\) and \((x_2, y_2)\):
$$\text{length} = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
This is the same as the distance formula — because the length of a line segment is the distance between its two endpoints. The formula works regardless of the orientation of the segment, and it doesn't matter which point you label 1 or 2, since both differences get squared.
Worked Examples
Example 1: Horizontal segment
Find the length of the segment from \((-3, 5)\) to \((4, 5)\).
The y-coordinates are the same, so this is horizontal. Length = \(|4 - (-3)| = |7| = 7\).
Example 2: Diagonal segment
Find the length of the segment from \((-2, 8)\) to \((-7, -5)\).
The change in x: \(-2 - (-7) = 5\)
The change in y: \(8 - (-5) = 13\)
$$\text{length} = \sqrt{5^2 + 13^2} = \sqrt{25 + 169} = \sqrt{194} \approx 13.93$$
Example 3: Segment with negative coordinates
Find the length of the segment from \((3, -1)\) to \((-4, 6)\).
$$\text{length} = \sqrt{(-4-3)^2 + (6-(-1))^2} = \sqrt{(-7)^2 + 7^2} = \sqrt{49 + 49} = \sqrt{98} \approx 9.90$$
Notice that squaring takes care of the negative sign — you never need to worry about which direction you subtract.
Example 4: Finding a missing coordinate
One endpoint of a segment is at \((2, 3)\). The other endpoint has x-coordinate 6, and the segment has length 5. What is the y-coordinate of the second endpoint?
Set up the distance formula and solve:
$$5 = \sqrt{(6-2)^2 + (y-3)^2}$$ $$25 = 16 + (y-3)^2$$ $$9 = (y-3)^2$$ $$y - 3 = \pm 3$$ $$y = 6 \text{ or } y = 0$$
There are two possible endpoints: \((6, 6)\) and \((6, 0)\).
Practice Problems
Find the length of the segment from \((0, 0)\) to \((5, 12)\).
Show answer\(\text{length} = \sqrt{5^2 + 12^2} = \sqrt{25 + 144} = \sqrt{169} = 13\)
Find the length of the segment from \((-1, -3)\) to \((5, 5)\).
Show answer\(\text{length} = \sqrt{(5-(-1))^2 + (5-(-3))^2} = \sqrt{6^2 + 8^2} = \sqrt{36 + 64} = \sqrt{100} = 10\)
A segment has endpoints at \((4, 4)\) and \((4, -3)\). How long is it?
Show answerSame x-coordinate, so this is vertical: length = \(|4 - (-3)| = 7\).
Find the length of the segment from \((1, 2)\) to \((7, 10)\). Leave your answer in simplified radical form.
Show answer\(\text{length} = \sqrt{(7-1)^2 + (10-2)^2} = \sqrt{36 + 64} = \sqrt{100} = 10\)
A segment runs from \((0, 0)\) to \((x, 4)\) and has a length of \(\sqrt{29}\). What is \(x\)?
Show answer\(\sqrt{29} = \sqrt{x^2 + 16}\), so \(29 = x^2 + 16\), giving \(x^2 = 13\) and \(x = \pm\sqrt{13}\).