# How to determine if a 3D triangle given by points is a right triangle?

How do I figure out if a triangle is a right triangle in 3-D space if you are given three points: $P = (3, -2, -3)$, $Q = (7, 0, 1)$, $R = (1, 2, 1)$?

I know that it is an isosceles triangle (two sides are the same $6$ units). But how would I now calculate this to see if it is a right triangle?

-
If the dot product of AB and BC is zero, then the triangle ABC has a right angle at B. – Gerry Myerson Aug 25 '12 at 3:20

Compute the length of the three sides and then use Pythagoras Theorem to check if there is a right angle.

-
So if my calculations are correct, this is not a right triangle. I got 72 != 40. (72 is not equal to 40). Hopefully this is correct, because I don't really know too much about dot products or I would try it that way. – Avalon-96 Aug 25 '12 at 3:36
I checked them again and I have the correct lengths, PQ=6, QR=sqrt(40), and PR=6. So I drew out a triangle and figured that point P is where the right angle would be, if there was one. And So i said A=6, B=6, and C=sqrt(40). A^2 +B^2 = C^2. So 36+36 !=40. Am I doing something wrong here? – Avalon-96 Aug 25 '12 at 4:01
In my text book, they have it as (u-x) instead of (x-u). They just use a different denotation. Points P1 and P2 and it would be (x2 - x1). The text says to put the second point values first in each section. You can see the full formula in my previous question: math.stackexchange.com/questions/186570/… – Avalon-96 Aug 25 '12 at 4:11
@WillHunting I upvoted this yesterday but you didn't get a Nice Answer badge. This looks like a bug! – Rudy the Reindeer Dec 3 '12 at 9:03
Ah, got it. : ( It has a down vote and you had already got a badge for it. – Rudy the Reindeer Dec 3 '12 at 9:04

A right triangle must have two sides forming a right angle, and this happens iff two of its sides are orthogonal to each other, iff the corresponding vectors' dot product (inner product) is zero. This is exactly what Gerry hinted at in his comment (check $\,QP\cdot QR\,,\,QP\cdot PR\,,\,QR\cdot PR)$)

Edited in view of several comments below. Thanks.

*Further added: For example, $$\vec{QP}=(-4,-2,-4)\,\,,\,\,\vec{QR}=(-6,2,0)\Longrightarrow$$ $$\vec{QP}\cdot \vec{QR}=(-4)\cdot(-6)+(-2)\cdot2+(-4)\cdot 0=24-4+0=20$$

-
It wouldn't really be PR, it would be QRRP. It's a coincidence that PR has a dot product of 0, but if you shift the whole triangle, lets say one unit in the y direction, PR wouldn't work. – mathguy Aug 25 '12 at 3:32
From the previous question, I think OP doesn't know much about dot products. Feel free to edit into your answer. For any two given point $p_1 = (x_1, y_1, z_1)$, $p_2 = (x_2, y_2, z_2)$ the vector $\vec{p_1 p_2} =$ $p_2 - p_1 =$ $(x_2 - x_1, y_2 - y_1, z_2 - z_1)$. For any two given vectors $v = (a, b, c)$ and $w = (c, d, e)$ the dot product $v\cot w$ is given by $v \cdot w = ac + bd +ce$. – user2468 Aug 25 '12 at 3:33
This is the best answer, and far cleaner easier than using Pythagoras. But it's let down by the very last bit, about $P\cdot R$, which is wrong. As Sidd mentioned, you want to check $PQ \cdot QR$, and two other dot products like it. – user22805 Aug 25 '12 at 3:54
Hey DonAntonio, could you possibly do one of those dot products so I can see how it is done? For example, show the work for QP*QR? Thanks. – Avalon-96 Aug 25 '12 at 4:06
I'll add it in my answer, @Avalon-96 – DonAntonio Aug 25 '12 at 4:12

If you are studying the $3$-D geometry then it will be very useful if you learn dot and cross products . And to keep your spirit up , both are very simple, dot product is nothing but the projection of a line onto the other (base line from which you are measuring the angle) line. I can show you for any two vectors, say, $\overline{PR} \;\;\& \;\;\overline{PQ}$ ,

• $\overline{PR} = \overline{OR}-\overline{OP} \implies \overline{PR}=(1, 2, 1) - (3,-2,-3) \implies \overline{PR}= (-2, 4, 4)$.

• Similarly, $\overline{PQ} = \overline{OQ}-\overline{OP} \implies \overline{PQ}= (7, 0, 1) - (3,-2,-3) \implies \overline{PQ}= ( 4, 2, 4)$.

• Now, the dot product will give you , $\overline{PR}\cdot\overline{PQ} = (-2)(4) + (4)(2) + (4)(4) = -8 + 8 + 16 = 16$, and which is not $0$ so they are not perpendicular to each other.

Similarly you can do for rest of the other vectors.

-
You wrote "dot product is nothing but the projection of a line onto the other". Are you sure? That doesn't seem right to me. – user22805 Aug 25 '12 at 6:40
While I would like to appreciate your contribution, please note thae quality of the posts in the forum. I don't consider it nice to see posts which are not TeXed and there are all kinds of crazy short hands -- for instance u in place of you does not sound right. I have edited it now, but please ensure the same the next time you post here. – user21436 Aug 25 '12 at 7:36
And, David's question is valid: you'd want some thing like: the projection of vector $\vec{a}$ onto $\vec{b}$ is given by: $\dfrac{\vec{a} \cdot \vec{b}}{|\vec{b}|}$. – user21436 Aug 25 '12 at 7:37