You are given the coordinates of three points that are the vertices of a triangle. You need to determine if the triangle is a right triangle. Explain how you could determine this.

Respuesta :

Let A, B, C be the three points. Let

[tex]m_{AB},\quad m_{BC},\quad m_{AC} [/tex]

be the slopes of the lines AB, BC and AC, respectively. We can compute those slopes using the "rise over run" formula:

[tex]m_{PQ} = \dfrac{Q_y-P_y}{Q_x-P_x}[/tex]

Now, the triangle is a right triangle if and only if two of its sides are perpendicular. And two lines are perpendicular if and only if their slopes are in the following relationship:

[tex]m_{PQ} = -\dfrac{1}{m_{RS}} \iff m_{PQ}m_{RS} = -1[/tex]

So, all you need to to is to find the slope of the three sides (by dividing the difference between the y and x coordinates), and then check all the pairs: if a pair of slopes give -1 when multiplied, then the triangle is a right triangle.