# How to calculate the side of a right triangle from the coordinates of points and the length of one side?

I have the line AB. And I need to calculate the coordinates of point D.

I know the coordinates of points A, B and C.

If I make this an imaginary right triangle, I just need to know the length of the CD line (a in the picture)

Since I can easily calculate the line length AC (d on the picture) from the coordinates, I only need the line AD to calculate the CD using the Pythagorean theorem.

I know the coordinates of points A and B, so I can easily calculate the length of line AB from this.

But how do I calculate the length of the AD line so that I can then calculate the length of the CD? Or is it possible in another way? Unfortunately, I don't know the angles either.

Thank you

Let $$t$$ the $$y$$ coordinate of poinr $$D$$. We have by simili relations that: $$\frac{\sqrt{(x_4-x_2)^2+(t-y_2)^2}}{\sqrt{(x_1-x_4)^2+(y_1-t)^2}}=\frac{|y_3-t|}{|t-y_2|}$$ Now, you can notice that putting $$O(0,0)$$ on the point $$A$$, the points $$D$$ and $$C$$ have the same $$x$$ coordinate. And the equation becomes:

$$\frac{\sqrt{(x_3-x_2)^2+(t-y_2)^2}}{\sqrt{(x_1-x_3)^2+(y_1-t)^2}}=\frac{|y_3-t|}{|t-y_2|}$$

Can you finish it from here?

• Thanks, but it doesn't work. If I give a simple example A [1,1], B [11,11], C [5,1]. Here it is easy to deduce that it is D [5,5], but using your formula, I figured that y4=6.3294. What am I doing wrong, please? yesterday

Hint: Obtain the equation of the line (say $$L$$) passing through $$C$$ and perpendicular to the line $$AC$$. Calculate the point of intersection of $$L$$ and the line $$AB$$. This should give you the coordinates of $$D$$. In other words, if $$D$$ has the coordinates $$(x_4,y_4)$$, then you have the following constraints:

1. $$(x_1-x_3)(x_4-x_3)+(y_1-y_3)(y_4-y_3)=0$$. (Because $$AC$$ is perpendicular to $$CD$$)
2. $$\frac{y_4-y_2}{y_2-y_1}=\frac{x_4-x_2}{x_2-x_1}$$ (Because $$D$$ lies on $$AB$$. The cases where $$x_1=x_2$$ and/or $$y_1=y_2$$ can be dealt with similarly)

These can be solved to obtain $$x_4,y_4$$

• Thanks, but there's a mistake somewhere. If I give a simple example A [1,1], B [11,11], C [5,1]. Here it is easy to deduce that it is D [5,5], but using your formula, I figured that x4=5 but y4=1 and I didn't figure out where the problem is? Am I doing something wrong or is there a mistake in the formula, please? yesterday
• @yoda666 Thanks for pointing out. Apologies for my negligence. There were some typographical errors in my answer in both equations. I have edited it. Should be fine now. Cheers! yesterday
• Yes, now the calculation is correct y4 = 5. Thanks again for the simple calculation. yesterday

This works only for Pythagorean triples or for triangles "similar" to Pythagorean triples. If $$\space d \space$$ is not an odd integer, round to an odd integer greater than $$\space 1 \space$$and then multiply or divide all sides (as needed) by $$\space \dfrac{d}{\text{rounded-number}}$$ after the following calculations are complete.

Assuming Pythagorean triples where all sides are integers, we begin with the Pythagorean theorem where $$\space A^2+B^2=C^2\space$$ and Euclid's formula where $$\space A=m^2-k^2 \quad B=2mk\quad C=m^2+k^2.\quad$$ From your diagram we let the $$x$$-coordinate be $$\space d=A.\quad$$ For any primitiive Pythagorean triple, $$\space A=2x+1, x\in\mathbb{N}\space$$ and, for each $$A$$-value, there are $$2^{n-1}$$ primitive triples where $$\space n\space$$ is the number of distinct prime factors of $$\space A.\quad$$ We can find all of these triples by solving the $$A$$-function for $$\space k\space$$ and testing a defined range of $$m$$-values to see which yield integers. Note that there may be additional triples found if they are odd square multiples of primitives.

Let us begin $$A=m^2-k^2\implies k=\sqrt{m^2-A}\\ \text{for}\qquad \sqrt{A+1} \le m \le \frac{A+1}{2}$$ The lower limit ensures $$k\in\mathbb{N}$$ and the upper limit ensures $$m> k$$.

$$A=3\cdot 5=15\implies \sqrt{15+1}=4\le m \le \frac{15+1}{2} =8\\ \text{and we find}\quad \sqrt{4^2-15}=1,\space \sqrt{8^2-15}=7\\ i.e. \space m\in\{4,8\}\implies k \in\{1,7\}$$ $$F(4,1)=(15,8,17)\qquad \qquad F(8,7)=(15,112,113)$$

Here, there are $$2^{2-1}=2$$ triples where $$a=8$$ or $$a=112$$ and $$AD$$ is either $$17$$ or $$113$$.

In this case, $$\space \theta\approx 28.1^\circ\space$$ 0r $$\space \theta\approx 82.4^\circ\space$$

If you happen to know an angle, you can find the closest matching Pythagorean triple using techiques described here.

You can find angle A using cosine theorem for ABC. Then use it to find length of AD from definition of cos for triangles

• I don't understand how we calculate this using a cosine theorem? This is good if I know all sides, but I don't know the angles. Or when I know only one angle and two adjacent sides. How will this help me here? Plus, in a right triangle, where can I do with the Pythagorean and Sin theorems? 12 hours ago
• You know coordinates of all points so you know all the sides of ABC, I have a typo in the answer