Way back in the day, I was fairly obsessed with triangles. I really enjoyed my trigonometry class in high school. In addition to being interesting, it was the impetus for me learning to code. I got a little tired of doing all the myriad of sin() and cos() and tan() functions to solve the triangles needed by my homework, so I decided to write an app for my TI-83+ graphing calculator to do it all for me. The app would ask you for the three things you knew about the triangle (almost any combination of sides or angles) and give you back all the rest of the information (including perimeter and area). I still have that source code.

In the course of writing this little app, I realized that, with rare exception, you could “solve” a triangle with any three pieces of information chosen from the side lengths, angles, area, or perimeter.

Unfortunately, I couldn’t really find formulae to handle some of the cases. Given three sides, you can use Heron’s Formula for finding the area, but I couldn’t find a formula to derive a side length from the area.

So, I set out to find a way to do it myself. It wasn’t very hard… just a lot of algebra to flip around.

Since I wanted to get the length of a side given two other sides and the area, it seemed logical to use Heron’s Formula: it has all the components I need, just in the wrong format. Here’s how I did it.

Then, we proceed to manipulate the terms to isolate one of the side lengths on one side of the equals sign, while moving $$K$$ (the area) to the other side:

Distribute through the first group:

And simplify:

Distribute through the next group:

And simplify:

And finally the last group:

And simplified:

At this point, let’s decide we want to isolate $$c$$ and say that’s the side we’re solving for. Let’s start pulling it out:

We can see this is in the quadratic form if we let $$x = c^2$$:

By applying the quadratic formula, we can solve for $$x$$:

Finally, we divide through the $$-2$$:

And substitue back in our value for $$x$$:

And like that, we’re able to solve a triangle given two sides and the area.

1. This is a variant of the Pythagorean theorem ($$c^2 = a^2 + b^2$$)
2. This also looks an awful lot like the Law of cosines, which isn’t surprising since the Pythagorean theorem is a special case of the Law of cosines (the case where $$cos(C) = 0$$): ($$c^2 = a^2 + b^2 -2ab * cos(C)$$
3. By applying the Law of cosines to our newly-derived formula, you can also figure out how to solve for $$C$$ (the angle opposite side $$c$$) with the area of the triangle: