Two Points Form Equation of a Line

The equation of a non-vertical line passing through two points A\left( {{x_1},{y_1}} \right) and B\left( {{x_2},{y_2}} \right) is given by

\frac{{x - {x_1}}}{{{x_2} - {x_1}}} = \frac{{y - {y_1}}}{{{y_2} - {y_1}}}

To prove this equation let P\left( {x,y} \right) be any point on the given line l. Also this passing thorough A\left( {{x_1},{y_1}} \right) and B\left( {{x_2},{y_2}} \right) as shown in the given diagram.
Form A and B draw AL and BN perpendicular on X-axis and from point P draw PM also perpendicular on X-axis. Also from A draw perpendicular AD on BN.


Now from the given diagram, consider the similar triangles ADB and ACP, by the definition of slope we take

\frac{{PC}}{{BD}} = \frac{{AC}}{{AD}}\,\,\,{\text{ -  -  - }}\left( {\text{i}} \right)

Also from the given diagram we have

\begin{gathered} PC = PM - CM = y - {y_1} \\ \Rightarrow BD = BN - DN = {y_2} - {y_1} \\ \Rightarrow AC = LM = OM - ON = x - {x_1} \\ \Rightarrow AD = LN = ON - OL = {x_2} - {x_1} \\ \end{gathered}

Putting these all values in above equation (i) we have

\frac{{x - {x_1}}}{{{x_2} - {x_1}}} = \frac{{y - {y_1}}}{{{y_2} - {y_1}}}

Which is the equation of line through two points A\left( {{x_1},{y_1}} \right) and B\left( {{x_2},{y_2}} \right). This equation can also have the from

\frac{{x - {x_2}}}{{{x_1} - {x_2}}} = \frac{{y - {y_2}}}{{{y_1} - {y_2}}}

In determinant from, the given equation of a line through two points is

\left| {\begin{array}{*{20}{c}} x&y&1 \\ {{x_1}}&{{y_1}}&1 \\ {{x_2}}&{{y_2}}&1 \end{array}} \right| = 0

NOTE: There is an alternate way to prove two points form of equation of a straight line.
Consider the slope point form of equation of a line, we have

y - {y_1} = m\left( {x - {x_1}} \right)\,\,\,{\text{ -  -  - }}\left( {\text{i}} \right)

Since the line passing through the point \left( {{x_1},{y_1}} \right), above equation and we have slope of line is m = \frac{{{y_2} - {y_1}}}{{{x_2} - {x_1}}} so equation (i) becomes

\begin{gathered} y - {y_1} = \left( {\frac{{{y_2} - {y_1}}}{{{x_2} - {x_1}}}} \right)\left( {x - {x_1}} \right) \\ \frac{{x - {x_2}}}{{{x_1} - {x_2}}} = \frac{{y - {y_2}}}{{{y_1} - {y_2}}} \\ \end{gathered}