# Determining if a point lies on a particular slope, between two points

This might be a simple question, but I'll ask anyways. I've been reading up on the basics of calculating the slope using two points: m = y1-y2/x1-x2

Which after that, I can figure out the equation of the line to test whether or not a point lies on that line. However, is it possible to check to see if that point I'm testing is on the line, and between two points? Let's say I have a line with the ends points (2,3) and (100,200), I would want to check to see if point (50,50) is on it.

-

Write the equation of the line, using point-slope form (derived from finding slope based on the two endpoints $(x_1, y_1), (x_2, y_2)$, and then using one of the two endpoints to find the equation).

Then, substitute the values of the point you're interested in into the equation of the line (its x-value of the point into "x" in the equation, and its y-value into "y" in your equation).

• If the point satisfies the equation of the line (results in a true equality), then the point is on the line. Then: If you want to know whether the point $(x, y)$ is "in between" the two endpoints, make sure that $x_1 \le x \le x_2$ or that $y_1 \le y \le y_2$.

• If the point of interest does not satisfy the equation of the line, then it is not on the line.

-
Of course! Thanks. – Adam Dec 10 '12 at 4:43

Three points $(x_i,y_i), 1\le i\le 3$ are co-linear $\iff$

$$\det\begin{pmatrix} x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\x_3 & y_3 &1\end{pmatrix}=0$$

Here $$\det\begin{pmatrix} 2 & 3 & 1 \\ 100 & 200 & 1 \\ 50 & 50 &1\end{pmatrix}$$

$$=\det\begin{pmatrix} 2 & 3 & 1 \\ 100-2 & 200-3 & 1-1 \\ 50-2 & 50-3 &1-1\end{pmatrix}$$ (applying $R_2'=R_2-R_1,R_3'=R_3-R_1$ )

$$=98(47)-48(197)\ne 0$$

-

Well, first, you'd check to see if it lies on the line--plug the $x$ and $y$ values into whatever equation you've come up with for the line to see if it satisfies it. If it satisfies the equation, then it lies between the two points if and only if its $x$-coordinate lies between $x_1$ and $x_2$ (for non-vertical lines) or its $y$-coordinate lies between $y_1$ and $y_2$ (for non-horizontal lines).

In your particular case, the point fails to lie on the line at all.

-

What you describe boils down to finding a $\lambda\in \mathbb{R}$ ($\lambda\in [0,1]$ if you want to check whether your point lines in the segments that connects $(x_1,y_1)$ and $(x_2,y_2)$) so that for your point $(x,y)$ it is:

$$x = \lambda x_1 + (1-\lambda)x_2\\ y=\lambda y_1 + (1-\lambda)y_2$$

What is the same, give the equation (i.e. the locus) of the points on the line which runs through your given points, $\frac{y-y_1}{y_2-y_1}=\frac{x-x_1}{x_2-x_1}$, just verify whether a given point satisfies this equation.

-