# How to determine if 3 points on a 3-D graph are collinear?

Let the points $A, B$ and $C$ be $(x_1, y_1, z_1), (x_2, y_2, z_2)$ and $(x_3, y_3, z_3)$ respectively. How do I prove that the 3 points are collinear? What is the formula?

## 5 Answers

From $A(x_1,y_1,z_1),B(x_2,y_2,z_2),C(x_3,y_3,z_3)$ we can get their position vectors.

$\vec{AB}=(x_2-x_1,y_2-y_1,z_2-z_1)$ and $\vec{AC}=(x_3-x_1,y_3-y_1,z_3-z_1)$.

Then $||\vec{AB}\times\vec{AC}||=0\implies A,B,C$ collinear.

• This is the best way of doing it - it provides an algorithm, rather than an existential condition. Commented Sep 26, 2014 at 22:46
• okay, so this means that (1,1,1) (1,2,1) (1,1,3) are collinear but the problem system says I'm wrong can somebody pls explain this Commented Sep 29, 2020 at 2:36

The three points $A,B,C$ are collinear if and only if there exists a real number $k$ such that $$x_3-x_1=k(x_2-x_1)\ \ \text{and}\ \ y_3-y_1=k(y_2-y_1)\ \ \text{and}\ \ z_3-z_1=k(z_2-z_1).$$

• Counterexample: $(0,0,0),(0,0,0)$ and $(1,1,1) \;$
– user57159
Commented Sep 27, 2014 at 1:58

The formula is

\begin{equation*} \text{rank} \left( \begin{array}{cccc} 1 & x_1 & x_2 & x_3\\ 1 & y_1 & y_2 & y_3 \\ 1 & z_1 & z_2 &z_3 \end{array} \right)\le 2 \end{equation*}

that is, the following three minors are zero

\begin{equation*} \left| \begin{array}{ccc} 1 & x_1 & x_2 \\ 1 & y_1 & y_2 \\ 1 & z_1 & z_2 \end{array} \right| = \left| \begin{array}{ccc} 1 & x_1 & x_3 \\ 1 & y_1 & y_3 \\ 1 & z_1 & z_3 \end{array} \right|= \left| \begin{array}{ccc} 1 & x_2 & x_3 \\ 1 & y_2 & y_3 \\ 1 & z_2 & z_3 \end{array} \right|=0 \end{equation*} The rank $\le 2$ condition also works for $3$ points in $n$ dimensions.

Find the three distances between the points. Use Heron's formula (and these three distances) to find the area of the triangle. If the area is positive, then the three points are not collinear. They form a triangle. If the area is 0, then the three points are collinear.

• This is very prone to numeric errors - and if you break down Heron's formula, you'll find that it's zero iff either $a+b=c$ or $b+c=a$ or $c+a=b$; testing each of those (with appropriate tolerances) is much better than testing their product against zero, but the cross-product test is better still. Commented Sep 27, 2014 at 0:09

If the distance between |AB|+|BC|=|AC| then A,B,C are collinear.

• Please use $\rm \LaTeX$. Commented Feb 3, 2017 at 15:27
• This only holds if $B$ lies between $A$ and $C$... Commented Feb 3, 2017 at 16:22
• Do all 3 ways. If any are equal, then colinear. Commented Apr 3, 2022 at 1:16