This article is from the Puzzles FAQ, by Chris Cole chris@questrel.questrel.com and Matthew Daly mwdaly@pobox.com with numerous contributions by others.
Find the radius of the inscribed and circumscribed circles for a triangle.
geometry/circles.and.triangles.s
Let a, b, and c be the sides of the triangle. Let s be the
semiperimeter, i.e. s = (a + b + c) / 2. Let A be the area
of the triangle, and let x be the radius of the incircle.
Divide the triangle into three smaller triangles by drawing
a line segment from each vertex to the incenter. The areas
of the smaller triangles are ax/2, bx/2, and cx/2. Thus,
A = ax/2 + bx/2 + cx/2, or A = sx.
We use Heron's formula, which is A = sqrt(s(s-a)(s-b)(s-c)).
This gives us x = sqrt((s-a)(s-b)(s-c)/s).
The radius of the circumscribed circle is given by R = abc/4A.
 
Continue to: