# Drawing an altitude from origin to the opposite side of a triangle

If I know the vertexes of a triangle and one of them is origin O(0, 0). Then how can I draw altitude from origin to the opposite side of the triangle.

-
Hint: You want a line through the origin perpendicular to the line between the other two points. So the product of the two slopes is $-1$. –  Henry Jun 15 '11 at 6:06

If the vertices are $(a,b)$, $(p,q)$, and $(0,0)$, then the altitude from the opposite side to $(0,0)$ will be along the line that is perpendicular to the line joining $(a,b)$ and $(p,q)$.

If $a=p$, then the side is vertical, and the altitude goes from $(0,0)$ to $(a,0)$ (horizontal).

If $a\neq p$, then the side is in the line with slope $$\frac{q-b}{p-a},$$ so you want the line through $(0,0)$ with slope $$m = \frac{a-p}{q-b}.$$ This is the line $y=\left(\frac{a-p}{q-b}\right)x$. The intersection of this line with the line that contains the opposite side, which is $$y - b = \left(\frac{q-b}{p-a}\right)(x-a)$$ can be found by plugging in $y = \left(\frac{a-p}{q-b}\right)x$ and solving for $x$.

-