|  \
A|   \C
 |    \
p1  B   p3

If given point p1 & p2, side A & B how would you find point p3? I know given this information you can find side C and all of the interior angles.

side C:
C^2 = A^2 + B^2

angle c = 90
angle a = A/SIN(a) = C/SIN(c)
angle b = 180 - (a+c)

But after this, I am trying to find point p3 and I am not sure what direction to take. Any help would be appreciated.

Edit: The triangle will not necessarily be facing upwards along an axis, it will be rotated at angles depending on exterior variables such as position of a mouse on the computer screen.

  • $\begingroup$ You know the length of side $B$, and it seems one leg of your right triangle is horizontal. Thus, just add that length to the $x$-coordinate of p1... $\endgroup$ Sep 15, 2011 at 16:47
  • $\begingroup$ the triangle is going to be rotated at random angles that solution wont work. $\endgroup$ Sep 15, 2011 at 16:49
  • $\begingroup$ Then rotate the coordinates such that side $B$ is horizontal. You know the slope of side $A$, you can then derive the appropriate rotation matrix... $\endgroup$ Sep 15, 2011 at 16:51
  • $\begingroup$ Knowing points p1 and p2 you can find the line between them. You need the perpendicular to this line through point p1 and distance B along it. You may not know which direction to take, because given the information you have presented you can take either direction on the perpendicular. $\endgroup$ Sep 15, 2011 at 16:59

2 Answers 2


Let the coordinates of $p_n$ be $(x_n,y_n)$. Then the slope of $A$ is $m_A=\frac{y_2-y_1}{x_2-x_1}$. The slope of $B$ is $m_B=\frac{-1}{m_A}=\frac{x_1-x_2}{y_2-y_1}$. Then $p_3=p_1\pm B(\frac{1}{\sqrt{1+m_B^2}},\frac{m_B}{\sqrt{1+m_B^2}})$ where the sign ambiguity corresponds to two orientations of the triangle. I have ignored issues when the sides are vertical or horizontal, which can lead to division by zero

  • $\begingroup$ @RossMillikan Could you comment on how you go from the slope of $A$ and $B$ to $p3$? $\endgroup$
    – nachocab
    Sep 6, 2014 at 17:20
  • $\begingroup$ @nachocab: I got $m_B$ because it is perpendicular to $A$ and so the slopes are negative reciprocals. To get $p_3$ I made a unit vector with that slope and multiplied by the length, which is $B$ $\endgroup$ Sep 6, 2014 at 17:23
  • $\begingroup$ @RossMillikan ok, then I guess what I don't understand is where that unit vector comes from. If the vector is $(1,m_B)$ shouldn't the magnitude be $\sqrt{1+m_B^2}$? Also, does this method work for any triangle, or just right triangles? $\endgroup$
    – nachocab
    Sep 6, 2014 at 18:22
  • 1
    $\begingroup$ @nachocab: you are correct there should be a square root. I have fixed it. Thanks. The only place I used the right triangle was getting the slope of $B$ from the slope of $A$. If you get the slope of $B$ some other way, you can use the unit vector and length like this. $\endgroup$ Sep 6, 2014 at 20:50

If your triangle is in space, the given information doesn't determine it yet, because given any such triangle, rotating it around the line joining $p1$ and $p2$ gives you another valid triangle. If your triangle is in the plane, then the information does determine p3 as long as you decide whether the order $p1$, $p2$, $p3$ is clockwise or counterclockwise. Let's say then, the triangle is in the plane and, as shown in your neat ASCII picture, $p1$, $p2$, $p3$ is clockwise.

If you know about complex numbers, then $p3-p1 = -iB/A(p2-p1)$ (because multiplication by $B/A$ changes a length $A$ vector into a length $B$ vector, and multiplication by $-i$ rotates by $90^\circ$ clockwise).

If you don't want to use complex numbers, then say $p1=(x1, y1)$, $p2=(x2, y2)$ and $p3=(x3, y3)$. Since $p1p2p3$ is a right angle, the slopes of $p1p2$ and $p1p3$ multiply to $-1$, that gives you one equation for $x3$ and $y3$. Additionally, you know that the distance from $p1$ to $p3$ is B, which gives you a second equation for $x3$ and $y3$. The system formed by those equations will have two solutions, one corresponding to $p1$, $p2$, $p3$ being clockwise and the other corresponding to counterclockwise.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .