# Find the width/height of a triangle given a side length and two lines

I'm a programmer and I came across a math problem in my current project that I can't figure out.

My situation looks like this. Everything in black is known or I know how to figure out.

• A and B are the two lines of which their equations are known.
• h is the length of the side between the two lines
• w is the width of the triangle
• I is the point where the two lines intersect

And I want to figure out the value of w

It's worth mentioning that my triangle can be any kind of triangle, not just isosceles.

Let's call your two equations $f(x)=Ax+B$ (the upper one) and $g(x)=Cx+D$.

For exactly the right $x=x_h$ they are $h$ apart. We then have $$f(x_h)-h=g(x_h)$$ from which $x_h$ can be isolated.

At their intercept, with $x=x_I$ we have $f(x_I)=g(x_I)$, from which we can isolate $x_I$.

Then $$x_I-x_h=w$$

• How do I go about finding the other side lengths? – SpaceFace Mar 9 '16 at 19:43
• @SpaceFace Do you know the $x$-position of the line $h$? – Bobson Dugnutt Mar 9 '16 at 19:51
• No, that's essentially what I'm trying to figure out. – SpaceFace Mar 9 '16 at 19:55
• @SpaceFace See my new answer; was this what you were looking for? – Bobson Dugnutt Mar 9 '16 at 20:02
• Yeah, I actually just came up with the same thing on my own a few moments ago, I might give my own answer with a bit more detall, but I'll mark this. – SpaceFace Mar 9 '16 at 20:10