So you thought you couldn't calculate the area of a triangle unless you knew its height, didn't you? And unless you know the height, you have to turn to trigonometry and invoke the sine rule or cosine rule before you have enough data to find the area, right?

As the taunting tone of the text up top should tip you off, the answer is no; but they don't seem to teach this in high schools. Hero's formula, sometimes called Heron's formula, lets you find any triangle's area given only the lengths of its sides. Here it is:

Let the sides of the triangle in question have lengths a, b and c respectively. (Actually, it doesn't really have to be respectively; you can swap any two sides' names and the formula will still work... you can even call a "c" and call c "b" and call b "a" and things still won't change, or you could just colour in the triangle on the page and measure how much your pencil shortens to get an estimate of its area, or you could just drink and watch TV because you don't care for no area of no goddamn triangle--but then why are you reading this node anyway, dumbass?) Then let s be half the sum of the sides:

```s = a + b + c
_________
2
```
Then the area of your triangle (or whoever's triangle it is that you're playing around with--just get their permission) is described by

Area2 = s(s-a)(s-b)(s-c)

Obviously, you just take the square root (make sure you take the positive square root, because negative areas confuse the hell out of tilers and carpenters and various other tradesmen) of the expression on the right to find the triangle's area.

To prove that the formula works, draw a triangle, drop a perpendicular line from one vertex to the opposite side (thus dividing the triangle into two right-angled triangles), then play around with the standard area formula (in combination with Pythagorus applied to these two right-angled triangles) until you get the expression above. Then do it all again with an obtuse-angled triangle, or reformulate your proof so that it's general enough to cover obtuse- and acute-angled triangles in one blow.

This truly classic formula for computing the area of a triangle is numerically unstable for needle-like triangles (triangles where one side is considerably shorter than both of the other two sides). This is particularly true if single precision floating point arithmetic is used to compute the formula. A more numerically stable approach is to sort the lengths of the three sides such that a >= b >= c and then compute the area of the triangle using:
sqrt( ( a + ( b + c ) ) * ( c - ( a - b ) ) * ( c + ( a - b ) ) * ( a + ( b - c ) ) ) / 4
Do NOT remove any parentheses from this formula!

Note that if c - ( a - b ) is less than zero then the above formula will yield a NaN. This indicates that the values a, b and c are not side-lengths of a valid triangle.