The length of a line segment between two points is calculated with the **distance formula**:

This formula only works for linear (straight line) functions. If you have a **curved function**, use the arc length formula instead.

## Length of a Line Segment: Example

**Example question:** What is the length of the line segment for f(x) = 5x + 2 on the interval [0,1]?

Step 1: (Optional) **Draw a Graph of the function**. This step can help you see where the points you need for the formula are (x_{1}, x_{2}, y_{1}, y_{2}). I used Desmos.com to create this graph:

A quick look at the line segment between these two points and I’m going to guess that the length should be around 5. That gives me a way to check that my final answer is reasonable.

Step 2: Plug your two (x, y) coordinates into the distance formula.

If you’re having trouble deciding which point goes where, the following graph has the x and y points labeled.

Step 3: **Simplify and solve**:

- (1 – 0)
^{2}= 1 - (7 – 2)
^{2}= 25 - 1 + 25 = 26
- √(26) ≈ 5.1

So my guess at 5 was fairly close.

## Length of a Line Segment & Pythagorean Theorem

You might notice that the distance formula is really an application of the Pythagorean theorem. And in fact, you *could* get to the same answer by using the Pythagorean formula a^{2} + b^{2} = c^{2}.

The following image shows that the hypotenuse of the triangle lies on the line segment you’re trying to find the length of:

You may be wondering why we use the distance formula to find the length of a line segment instead of the more simple Pythagorean formula. The answer is that while a, b, and c work perfectly well in geometry, it doesn’t translate well to the Euclidean plane of x’s and y’s, especially once you get to variations on the distance formula for curves. You can’t fit a triangle to a curve, but you can fit a series of small lines. This process of fitting small lines to approximate a curve uses integration, and (along with derivatives) it’s one of the two fundamental areas of calculus.

**CITE THIS AS:**

**Stephanie Glen**. "Length of a Line Segment" From

**CalculusHowTo.com**: Calculus for the rest of us! https://www.calculushowto.com/length-of-a-line-segment/

**Need help with a homework or test question? **With Chegg Study, you can get step-by-step solutions to your questions from an expert in the field. Your first 30 minutes with a Chegg tutor is free!