A common question is to prove/disprove that three points in $\mathbb{R}^2$ are colinear. For, example
Show that $(-1, 8)$, $(1, -2)$ and $(2, 1)$ lie on a common line.
What are some methods one could use to answer questions of this nature?
A common question is to prove/disprove that three points in $\mathbb{R}^2$ are colinear. For, example
Show that $(-1, 8)$, $(1, -2)$ and $(2, 1)$ lie on a common line.
What are some methods one could use to answer questions of this nature?
Since there seems to be some confusion as to the fit of $(-1,8)$ vs. $(-1,-8)$, try to use the other two points.
So say that point $a$ is $(x_1, y_1)$, point $b$ is $(x_2, y_2)$, and we'll start with the assumption that $x_1\neq x_2$.
The general "two-point" formula for the equation of a line (given two points) is given by:
$(y - y_1) = \frac{(y_2 - y_1)} {(x_2 - x_1)} (x-x_1)\quad\quad\quad(1)$
where $\frac{(y_2 - y_1)} {(x_2 - x_1)} = m $
($m$ represents the slope of the line). You the need to simplify the equation by solving for $y$ and putting the equation, e.g., in slope-intercept form: $y = mx + b$ where $b$ is the $y$-intercept (the value of $y$ when $x = 0$). Then you need then to substitute the $x$-coordinate of the third point for $x$ in the equation, likewise for $y$. If the result, after doing so, is not an equality, then the third point doesn't "satisfy" the equation; in other words, it is therefore not on the line.
If $(-1,8)$ does not satisfy the equation of the line (such that after replacing $x$ and $y$ with the third point's coordinates, the two sides of the equation don't match, try using $(-1,-8)$, and if that works, you need to recheck the method you used to obtain the point $(-1,8)$.
Of course, you can also use the slope-intercept form, after computing the slope, as above: $y = mx + b$ To solve for $b$, the $y$-intercept, simply evaluate the equation, putting $x = 0.$ That should give you $y = b$ (at $x = 0$): the point at which the line intersects the $y$-axis.
Caveat:
Now, suppose $x_1 = x_2$. Then what? We certainly cannot use the general two-point formulation given above, since if $x_1=x_2$, then $x_2 - x_1 = 0$, and division by zero is undefined. What do you know about lines for which the slope is undefined?
Such lines are always vertical lines, perpendicular to the $x$-axis, so every $x$-coordinate on such a line is identical. If we can rewrite the equation provided above in (1) as such:
$(x_2 - x_1)(y - y_1) = (y_2 - y_1)(x-x_1)$
The left side evaluates to $0$; simplifying gives us the equation $x = x_1.$
Recommendation: if this question is related to your studying for exams etc., it's important to understand how to compute the equation of a line, given two points, given the slope, and also how to easily move back and forth between such forms.
For 3 points to be collinear:
The area of the triangle formed by given 3 points should be ZERO.
Suppose there are three points given A(x1, y1)
, B(x2, y2)
and C(x3, y3)
. Then
x1 y1 1 Area(ABC) = (1/2)det x2 y2 1 x3 y3 1
Where det is determinant. So find this determinant, if zero, the given points are collinear otherwise not.
For n points to be collinear:
Input: P1, P2, P3, ... , Pn
Method 1:
(P1, P2, P3)
(P3, P4, P5)
and so on till (Pn-2, Pn-1, Pn)
Method 2:
Food for thought: If you want to find 3 collinear points from given n points then it's rather tough and time complexity is more.
Thanks.
Here are three tests of collinearity.
Distance Test
This is the first test I learned to check if three points were collinear. It actually tests if one point is between two others. Given three points $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$, the point $(x_2,y_2)$ is between $(x_1,y_1)$ and $(x_3,y_3)$ when $ |(x_1,y_1)-(x_3,y_3)|=|(x_1,y_1)-(x_2,y_2)|+|(x_2,y_2)-(x_3,y_3)| $ If any of the three points is between the other two, they are collinear; that is, if any of the distances is the sum of the other two.
$\hspace{3cm}$
Area Test
The area of a triangle is given by half the determinant of the vectors of two of the sides. That is, given
$\hspace{4cm}$
The area of the triangle is $ \frac12\det\begin{bmatrix}x_2-x_1&y_2-y_1\\\\x_3-x_1&y_3-y_1\end{bmatrix} $ The three points are collinear exactly when this area is $0$.
Volume Test
Given three points in $\mathbb{R}^2$, first we move them into $\mathbb{R}^3$, $z=1$ to be precise. Next the volume of the tetrahedron formed by three points and the origin is one sixth the determinant of the three points.
That is, the volume of
$\hspace{3cm}$
is $ \frac16\det\begin{bmatrix}x_1&y_1&1\\x_2&y_2&1\\x_3&y_3&1\end{bmatrix} $
The volume of a pyramid is one third of the base times the altitude. In the case above, the altitude is $1$. Thus, the points are collinear exactly when this volume is $0$.
For three to be collinear, the sum of the distance between two pairs of points equals the distance between the third pair of points (ie .|AB|+|AC|=|BC| or |AB|+|BC|=|AC| or |AC|+|BC|=|AB|
(upps: didn't notice the date of the original posting (it's one year old) But now that I've written so much I just leave it here for the cursory reader)
A very elementary method is the following (which is in effect just Arturo Magidin's formula made geometrically explicite).
Assume your three points in a matrix $\small A=\begin{bmatrix} 1&2&7 \\ 4&7&22 \end{bmatrix} = \begin{bmatrix} x_1&x_2&x_3 \\ y_1&y_2&y_3 \end{bmatrix}$ where the first row shows the coordinates on the x-axis and the second row that of the y-axis. We might imagine a triangle on the plane.
First we drag that triangle vertically, such that the first point lies on the x-axis , that means, we subtract from all y-coordinates that of the first point. We get $\small A_1=\begin{bmatrix} 1&2&7 \\ 0&3&18 \end{bmatrix} \qquad \qquad (=A- \begin{bmatrix} .&.&. \\ 4&4&4 \end{bmatrix})$ Then we drag that triangle horizontally, such that the second point lies on the y-axis, that means, we subtract from all x-coordinates that of the second point. We get $\small A_2=\begin{bmatrix} -1&0&5 \\ 0&3&18 \end{bmatrix} \qquad \qquad (=A_1- \begin{bmatrix} 2&2&2\\.&.&. \end{bmatrix})$ Now we can imagine a diagonal line from (-1,0) to (0,3) and the third point must lie on that line. Without changing the configuration of the triangle we might scale the x and the y-extensions for convenience, such that the first x-coordinate is -1 and the second y-coordinate is +1, so we divide the y-xoordinates by 3, and even can leave the x-coordinates untouched: $\small A_3=\begin{bmatrix} -1&0&5 \\ 0&1&6 \end{bmatrix} $ Now the first four coordinates define the diagonal line with slope 1 through (-1,0) and (0,1) and each collinear point must have $\small y_k=1+x_k$ or $\small y_k-x_k=1$. We see that this is true immediately, but we can also subtract the x-coordinates from the y-coordinates to make it explicite: $\small A_4=\begin{bmatrix} 0&0&0 \\ 1&1&1 \end{bmatrix} $ which shows then collinearity of our three points.
Another example which is not collinear is $\small B=\begin{bmatrix} 1&2&3 \\ 4&7&5 \end{bmatrix} $ We translate to $\small x_2=0, y_1=0$ $\small B_2=B-\begin{bmatrix} 2&2&2 \\ 4&4&4 \end{bmatrix}=\begin{bmatrix} -1&0&1 \\ 0&3&1 \end{bmatrix} $ We rescale to $\small x_1=-1, y_2=1$ $\small B_3= \begin{bmatrix} 1 \\ \frac13\end{bmatrix} \cdot B_2=\begin{bmatrix} -1&0&1 \\ 0&1& \frac13 \end{bmatrix} $ and immediately we see by the difference $\small x_3-y_3 \ne 1$ that the third point is not collinear with the other two points.