# Stability of Area of Triangle?

1. Apr 7, 2005

### MtX

Consider the following algorithm for computing the area of a triangle with sides of length A, B, and C:

S = (A+B+C) / 2
Area1(A,B,C) = sqrt(S(S-C)(S-B)(S-A)).

A) Explain why this approach is unstable, and illustrate with an example.

B) A student proposes the following less efficient, but more stable, approach:

Area2(A,B,C) = sqrt((A+B+C)(A+B-C)(A-B+C)(-A+B+C)) / 4

Explain why this approach is still unstable and illustrate with an example.

C) Reaarange the formula to produce a more stable version. Explain why it is more stable.

I really have no clue on how to start off but for parts A) and B), I plan to insert arbitrary values of A, B and C, compare the area of the triangle using sides A, B, and C, versus the value of the area after using the Area1 and Area2 equations as examples. I am guessing the compared values will differ greatly and as a result makes this "approach" unstable.

For Part C) however, I have no clue how to begin. Am I suppose to create my own formula? Or modify theirs? What should I do?

Thanks.

2. Apr 8, 2005

### mathman

I am not sure what "stability" is supposed to mean. I'll assume that it means expression without minus signs. With very little difficulty I got:

area=sqrt(S(S3+AB(A+B)+AC(A+C)+BC(B+C)+ABC)/2)