Difference between revisions of "Heron's Formula"

(Proof)
(Proof)
Line 30: Line 30:
 
<math>=\sqrt{s(s-a)(s-b)(s-c)}</math>
 
<math>=\sqrt{s(s-a)(s-b)(s-c)}</math>
  
== Proof ==
+
== Proof 2 ==
 +
 
 +
\includegraphics{Heron.png}
 +
 
  
 
<math>b^2 - (a-x)^2 = h^2</math>
 
<math>b^2 - (a-x)^2 = h^2</math>
Line 40: Line 43:
  
 
<math>2ax = c^2 - b^2 + a^2</math>
 
<math>2ax = c^2 - b^2 + a^2</math>
<math>x = (c^2 - b^2 + a^2)/2a</math>
+
<math>x = \frac{c^2 - b^2 + a^2}{2a}</math>
 +
 
 +
<math>h^2 = c^2 - x^2 = (c-x) (c+x)</math>
 +
<math> = (c - \frac{c^2 - b^2 + a^2}{2a}) (c + \frac{c^2 - b^2 + a^2}{2a})</math>
 +
<math> = \frac{-(2ac + c^2 + a^2) + b^2}{2a} * \frac{(2ac + c^2 + a^2) - b^2}{2a}</math>
 +
<math> = \frac{b^2 - (a^2 - 2ac + c^2)}{2a}</math>
 +
<math> = \frac{b^2 - (a - c)^2}{2a} * \frac{(a + c)^2 - b^2}{2a}</math>
 +
<math> = \frac{(b + a - c)(b - a + c)}{2a} * \frac{(a + c -b)(a + b + c)}{2a}</math>
 +
<math> = \frac{(2s - 2c)(2s - 2a)(2s - 2b)(2s)}{4a^2}</math>
 +
 
 +
<math>h = \frac{4\sqrt(s(s - a)(s - b)(s - c))}{2a}</math>
 +
<math> = \frac{2\sqrt(s(s - a)(s - b)(s - c))}{a}</math>
 +
 
 +
<math>[ABC] = \frac{1}{2} * a * h</math>
 +
<math>Substitute h with the equation and you get</math>
 +
 
 +
$[ABC] = \sqrt(s(s - a)(s - b)(s - c))
  
 
== See Also ==
 
== See Also ==

Revision as of 19:04, 8 February 2016

Heron's Formula (sometimes called Hero's formula) is a formula for finding the area of a triangle given only the three side lengths.

Theorem

For any triangle with side lengths ${a}, {b}, {c}$, the area ${A}$ can be found using the following formula:

$A=\sqrt{s(s-a)(s-b)(s-c)}$

where the semi-perimeter $s=\frac{a+b+c}{2}$.


Proof

$[ABC]=\frac{ab}{2}\sin C$

$=\frac{ab}{2}\sqrt{1-\cos^2 C}$

$=\frac{ab}{3}\sqrt{1-\left(\frac{a^2+b^2-c^2}{2ab}\right)^2}$

$=\sqrt{\frac{a^2b^2}{4}\left[1-\frac{(a^2+b^2-c^2)^2}{4a^2b^2}\right]}$

$=\sqrt{\frac{4a^2b^2-(a^2+b^2-c^2)^2}{16}}$

$=\sqrt{\frac{(2ab+a^2+b^2-c^2)(2ab-a^2-b^2+c^2)}{16}}$

$=\sqrt{\frac{((a+b)^2-c^2)(c^2-(a-b)^2)}{16}}$

$=\sqrt{\frac{(a+b+c)(a+b-c)(b+c-a)(a+c-b)}{16}}$

$=\sqrt{s(s-a)(s-b)(s-c)}$

Proof 2

\includegraphics{Heron.png}


$b^2 - (a-x)^2 = h^2$ $b^2 - a^2 + 2ax - x^2 = h^2$

$c^2 - h^2 = h^2$

$b^2 - a^2 + 2ax - x^2 = c^2 - x^2$

$2ax = c^2 - b^2 + a^2$ $x = \frac{c^2 - b^2 + a^2}{2a}$

$h^2 = c^2 - x^2 = (c-x) (c+x)$ $= (c - \frac{c^2 - b^2 + a^2}{2a}) (c + \frac{c^2 - b^2 + a^2}{2a})$ $= \frac{-(2ac + c^2 + a^2) + b^2}{2a} * \frac{(2ac + c^2 + a^2) - b^2}{2a}$ $= \frac{b^2 - (a^2 - 2ac + c^2)}{2a}$ $= \frac{b^2 - (a - c)^2}{2a} * \frac{(a + c)^2 - b^2}{2a}$ $= \frac{(b + a - c)(b - a + c)}{2a} * \frac{(a + c -b)(a + b + c)}{2a}$ $= \frac{(2s - 2c)(2s - 2a)(2s - 2b)(2s)}{4a^2}$

$h = \frac{4\sqrt(s(s - a)(s - b)(s - c))}{2a}$ $= \frac{2\sqrt(s(s - a)(s - b)(s - c))}{a}$

$[ABC] = \frac{1}{2} * a * h$ $Substitute h with the equation and you get$

$[ABC] = \sqrt(s(s - a)(s - b)(s - c))

See Also

External Links

In general, it is a good advice not to use Heron's formula in computer programs whenever we can avoid it. For example, whenever vertex coordinates are known, vector product is a much better alternative. Main reasons:

  • Computing the square root is much slower than multiplication.
  • For triangles with area close to zero Heron's formula computed using floating point variables suffers from precision problems.