Checking three points with matched nonvertical slopes
Three points lie on one nonvertical line when the slopes of their adjacent segments match. This guide compares the two slopes and confirms the line with a regression on all three points.
What matching slopes mean
The slope between two points is the change in y divided by the change in x. If the slope from the first point to the second equals the slope from the second to the third, then the three points lie on a single straight line, because the line through the first two points has the same direction as the line through the last two and they share the middle point. The test is simple and needs only two divisions. It requires that the horizontal coordinates differ for each pair, since a slope divides by the change in x and cannot be formed when that change is zero.
The three-point example
The points are (0, 1), (2, 5) and (4, 9). The Slope Calculator gives the first segment a rise of 4 over a run of 2, a slope of 2. The second segment rises 4 over a run of 2, again a slope of 2. The two adjacent slopes match, so the points are collinear. The common slope and the first point give the line y equals 2x plus 1: at x equal to 0 the line gives 1, at 2 it gives 5 and at 4 it gives 9. Each of the three points satisfies the equation, which confirms the result from a second direction.
Confirming with a regression
The Linear Regression Calculator fits the least squares line to the whole list. Enter x values 0, 2, 4 and y values 1, 5, 9. The mean of x is 2 and the mean of y is 5. The slope formula divides the sum of products of deviations by the sum of squared x deviations: the numerator is (−2)(−4) plus 0 plus (2)(4), which is 16, and the denominator is 4 plus 0 plus 4, which is 8. The slope is 2. The intercept is the mean of y minus slope times the mean of x, which is 5 minus 4, or 1. The regression returns exactly the line found from the segments.
When the slopes do not match
Change the last point to (4, 10). The first segment still has a slope of 2, but the second rises 5 over a run of 2, a slope of 2.5. The points are not collinear. The regression line through all three points now has slope 2.25 and intercept about 0.833333, and it does not pass through any of the three points exactly. The difference between the two segment slopes, 0.5, is a direct measure of the bend at the middle point. A regression on collinear data returns the same line as the segments, and on non-collinear data it returns a compromise. Here x has mean 2 and y has mean 16/3, and the least squares line passes through that mean point, which is 5.3333 above the axis at x equal to 2, whereas the original line would have been at 5.
Exact versus measured data
The integer points in the example are exactly collinear, so the slopes agree exactly. Measured data rarely behaves like this. Suppose a survey gives points (0, 0), (3, 6.1) and (6, 11.9). The first slope is 6.1 divided by 3, about 2.0333, and the second is 5.8 divided by 3, about 1.9333. They differ by 0.1, and whether that counts as a straight line depends on the measurement error you can tolerate. Rounding displayed slopes can make two values appear equal when they are not, so decide on a tolerance, such as a maximum allowed difference in slope, before comparing.
The vertical case
The test needs distinct x values within each pair. Points such as (3, 1), (3, 4) and (3, 9) lie on a vertical line, and every pair has a zero change in x. A slope cannot be formed from a zero run, so the slope comparison does not apply and the points need another check, such as confirming that all x coordinates are equal. The regression also fails for such data because the denominator of its slope formula is zero. Vertical lines are collinear in the geometric sense, and the slope method is simply the wrong tool for them.
Why the middle point matters
The test compares the slope on each side of the middle point, so the middle point acts as a hinge. If it sits on the line through the other two, both slopes are equal. If it is above that line, the second slope is larger than the first, and the path bends upward. If it is below, the path bends downward. In the changed example with the last point at (4, 10), the second slope is larger than the first, and the sequence bends up. The size of the bend is the difference of slopes, 0.5. Reading the sign of that difference tells you which way the data curves, which is useful before choosing a model. A positive difference points to growth that is speeding up, and a negative one points to growth that is slowing down.
Using the same idea elsewhere
Collinearity checks come up in several practical settings. Surveyors test whether three stakes lie on one line. Spreadsheet users check whether a data series is perfectly linear before fitting a more complicated model. Programmers use the same idea to detect degenerate triangles, since three collinear points have zero area. The slope comparison is the easiest version when the numbers are small and the coordinates are exact. For measured or large coordinates, comparing a cross product against a tolerance is more stable, but the slope check remains a clear way to understand the geometry.
Reading the regression as a control
The regression is a second method that should agree with the first. When both methods give slope 2 and intercept 1, an error in one calculation is unlikely to have been repeated in the other. The regression also scales to any number of points, while the pairwise slope check needs one comparison per adjacent pair. A regression result alone does not prove collinearity unless the fit is perfect, which means every point lies on the fitted line. For the example, all three do. Keep exact and approximate checks separate in any write-up so readers know which standard was applied, and state the tolerance whenever the coordinates came from measurement.
Reproduce the checks
First segment slope
Open the Slope Calculator and enter:
- First x coordinate
0- First y coordinate
1- Second x coordinate
2- Second y coordinate
5
Expected output:
slope
2The vertical change is four over horizontal change two.
Second segment slope
Open the Slope Calculator and enter:
- First x coordinate
2- First y coordinate
5- Second x coordinate
4- Second y coordinate
9
Expected output:
slope
2The same ratio holds for the second segment.
All-point line control
Open the Linear Regression Calculator and enter:
- X observations
0,2,4- Y observations
1,5,9
Expected output:
Slope
2Intercept
1The complete list lies on the stated line.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- MathWorld ↗ · 2026-10-08
- Primary definition and convention reference ↗ · 2026-10-08