Difference between revisions of "Heron's Formula"

(Proof 2)
(Proof)
 
(17 intermediate revisions by 13 users not shown)
Line 8: Line 8:
  
 
where the [[semi-perimeter]] <math>s=\frac{a+b+c}{2}</math>.
 
where the [[semi-perimeter]] <math>s=\frac{a+b+c}{2}</math>.
 
  
 
== Proof ==
 
== Proof ==
 +
Using basic [[Trigonometry]], we have
 +
<cmath>[ABC]=\frac{ab}{2}\sin C, </cmath>
 +
which simplifies to
 +
<cmath>[ABC]=\frac{ab}{2}\sqrt{1-\cos^2 C}.</cmath>
  
<math>[ABC]=\frac{ab}{2}\sin C</math>
+
The [[Law of Cosines]] states that in triangle <math>ABC</math>, <math>c^2 = a^2 + b^2 - 2ab\cos C</math>, which can be written as <math>\cos C = \frac{a^2 + b^2 - c^2}{2ab}</math>. Thus,
 
+
<math>[ABC]=\frac{ab}{2}\sqrt{1-\left(\frac{a^2+b^2-c^2}{2ab}\right)^2}.</math>
<math>=\frac{ab}{2}\sqrt{1-\cos^2 C}</math>
 
 
 
<math>=\frac{ab}{3}\sqrt{1-\left(\frac{a^2+b^2-c^2}{2ab}\right)^2}</math>
 
 
 
<math>=\sqrt{\frac{a^2b^2}{4}\left[1-\frac{(a^2+b^2-c^2)^2}{4a^2b^2}\right]}</math>
 
 
 
<math>=\sqrt{\frac{4a^2b^2-(a^2+b^2-c^2)^2}{16}}</math>
 
 
 
<math>=\sqrt{\frac{(2ab+a^2+b^2-c^2)(2ab-a^2-b^2+c^2)}{16}}</math>
 
  
<math>=\sqrt{\frac{((a+b)^2-c^2)(c^2-(a-b)^2)}{16}}</math>
+
Now, we can simplify:
 +
<cmath>[ABC]=\sqrt{\frac{a^2b^2}{4}\left[1-\frac{(a^2+b^2-c^2)^2}{4a^2b^2}\right]}</cmath>
  
<math>=\sqrt{\frac{(a+b+c)(a+b-c)(b+c-a)(a+c-b)}{16}}</math>
+
<cmath>=\sqrt{\frac{4a^2b^2-(a^2+b^2-c^2)^2}{16}}</cmath>
  
<math>=\sqrt{s(s-a)(s-b)(s-c)}</math>
+
<cmath>=\sqrt{\frac{(2ab+a^2+b^2-c^2)(2ab-a^2-b^2+c^2)}{16}}</cmath>
  
== Proof 2 ==
+
<cmath>=\sqrt{\frac{((a+b)^2-c^2)(c^2-(a-b)^2)}{16}}</cmath>
\centering
 
\includegraphics{Heron.png}
 
  
 +
<cmath>=\sqrt{\frac{(a+b+c)(a+b-c)(b+c-a)(a+c-b)}{16}}</cmath>
  
<math>b^2 - (a-x)^2 = h^2</math>
+
<cmath>=\sqrt{s(s-a)(s-b)(s-c)}</cmath>
<math>b^2 - a^2 + 2ax - x^2 = h^2</math>
 
  
<math>c^2 - h^2 = h^2</math>
+
==Isosceles Triangle Simplification==
  
<math>b^2 - a^2 + 2ax - x^2 = c^2 - x^2</math>
+
<math>A=\sqrt{s(s-a)(s-b)(s-c)}</math> for all triangles
  
<math>2ax = c^2 - b^2 + a^2</math>
+
<math>b=c</math> for all isosceles triangles
<math>x = \frac{c^2 - b^2 + a^2}{2a}</math>
 
  
<math>h^2 = c^2 - x^2 = (c-x) (c+x)</math>
+
<math>A=\sqrt{s(s-a)(s-b)(s-b)}</math> simplifies to <math>A=(s-b)\sqrt{s(s-a)}</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>
+
==Square root simplification/modification==
<math> = \frac{2\sqrt(s(s - a)(s - b)(s - c))}{a}</math>
+
From <cmath>A=\sqrt{s(s-a)(s-b)(s-c)}</cmath> We can "take out" the <math>1/2</math> in each <math>s</math>, then we have <cmath>A=\frac{1}{4}\sqrt{(a+b+c)(-a+b+c)(a-b+c)(a+b-c)}</cmath>Using the [[difference of squares]] on the first two and last two factors, we get <cmath>A=\frac{1}{4}\sqrt{(b^2+2bc+c^2-a^2)(a^2-b^2+2bc-c^2)}</cmath>and using the difference of squares again, we get <cmath>A=\frac{1}{4}\sqrt{(2bc)^2-(-a^2+b^2+c^2)^2}</cmath> From this equation (although seemingly not symmetrical), it is much easier to calculate the area of a certain triangle with side lengths with quantities with square roots. One can remember this formula by noticing that when finding the cosine of an angle in a triangle, the formula is <cmath>\cos{A}=\frac{-a^2+b^2+c^2}{2bc}</cmath> and the two terms in the formula are just the [[denominator]] and [[numerator]] of the fraction for <math>\cos{A}</math>, only they're squared. This can also serve as a reason for why the area <math>A</math> is never imaginary. This is equivalent of ending at step <math>4</math> in the proof and distributing.
  
<math>[ABC] = \frac{1}{2} * a * h</math>
+
===Note===
Substitute h with the equation and you get
+
Replacing <math>-a^2+b^2+c^2</math> as <math>2bc\cos{A}</math>, the area simplifies down to <math>\frac{1}{4}\sqrt{(2bc\sin{A})^2}</math>, or <math>\frac{1}{4}\cdot2bc\sin{A}</math>, or <math>\frac{1}{2}bc\sin{A}</math>, another common area formula for the triangle.
  
<math>[ABC] = \sqrt(s(s - a)(s - b)(s - c))</math>
+
==Example==
 +
Let's say that you have a right triangle with the sides <math>3</math> ,<math>4</math> , and <math>5</math>. Your semi- perimeter would be <math>6</math> since <math>(3+4+5)</math> ÷ <math>2</math> is <math>6</math>.
 +
Then you have <math>6-3=3</math>, <math>6-4=2</math>, <math>6-5=1</math>.
 +
<math>1\cdot 2\cdot 3=6.</math>
 +
<math> 6\cdot 6 = 36</math>
 +
The square root of <math>36</math> is <math>6</math>. The area of your triangle is <math>6</math>.
  
 
== See Also ==
 
== See Also ==

Latest revision as of 22:45, 6 October 2024

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

Using basic Trigonometry, we have \[[ABC]=\frac{ab}{2}\sin C,\] which simplifies to \[[ABC]=\frac{ab}{2}\sqrt{1-\cos^2 C}.\]

The Law of Cosines states that in triangle $ABC$, $c^2 = a^2 + b^2 - 2ab\cos C$, which can be written as $\cos C = \frac{a^2 + b^2 - c^2}{2ab}$. Thus, $[ABC]=\frac{ab}{2}\sqrt{1-\left(\frac{a^2+b^2-c^2}{2ab}\right)^2}.$

Now, we can simplify: \[[ABC]=\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)}\]

Isosceles Triangle Simplification

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

$b=c$ for all isosceles triangles

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

Square root simplification/modification

From \[A=\sqrt{s(s-a)(s-b)(s-c)}\] We can "take out" the $1/2$ in each $s$, then we have \[A=\frac{1}{4}\sqrt{(a+b+c)(-a+b+c)(a-b+c)(a+b-c)}\]Using the difference of squares on the first two and last two factors, we get \[A=\frac{1}{4}\sqrt{(b^2+2bc+c^2-a^2)(a^2-b^2+2bc-c^2)}\]and using the difference of squares again, we get \[A=\frac{1}{4}\sqrt{(2bc)^2-(-a^2+b^2+c^2)^2}\] From this equation (although seemingly not symmetrical), it is much easier to calculate the area of a certain triangle with side lengths with quantities with square roots. One can remember this formula by noticing that when finding the cosine of an angle in a triangle, the formula is \[\cos{A}=\frac{-a^2+b^2+c^2}{2bc}\] and the two terms in the formula are just the denominator and numerator of the fraction for $\cos{A}$, only they're squared. This can also serve as a reason for why the area $A$ is never imaginary. This is equivalent of ending at step $4$ in the proof and distributing.

Note

Replacing $-a^2+b^2+c^2$ as $2bc\cos{A}$, the area simplifies down to $\frac{1}{4}\sqrt{(2bc\sin{A})^2}$, or $\frac{1}{4}\cdot2bc\sin{A}$, or $\frac{1}{2}bc\sin{A}$, another common area formula for the triangle.

Example

Let's say that you have a right triangle with the sides $3$ ,$4$ , and $5$. Your semi- perimeter would be $6$ since $(3+4+5)$ ÷ $2$ is $6$. Then you have $6-3=3$, $6-4=2$, $6-5=1$. $1\cdot 2\cdot 3=6.$ $6\cdot 6 = 36$ The square root of $36$ is $6$. The area of your triangle is $6$.

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.