Circumradius and Inradius of a Triangle

From the three sides, finds the circumradius as abc ÷ 4S and the inradius as S ÷ s, where S is the area and s the semi-perimeter.

The circle passing through all three vertices of a triangle is its circumcircle; the circle touching all three sides from the inside is its incircle. From the three side lengths you can find the area, and from there the radius of each circle.

Heron's formula gives the area first. With the semi-perimeter s=a+b+c2s = \dfrac{a + b + c}{2},

S=s(sa)(sb)(sc)S = \sqrt{s(s - a)(s - b)(s - c)}

Once the area SS is known, the circumradius RR and the inradius rr follow.

R=abc4Sr=SsR = \dfrac{abc}{4S} \qquad r = \dfrac{S}{s}

Example

With the defaults, a=3a = 3, b=4b = 4 and c=5c = 5, the semi-perimeter is s=3+4+52=6s = \dfrac{3 + 4 + 5}{2} = 6.

This triangle is right-angled, and sure enough its circumradius is exactly half the hypotenuse of 5.

Watch out

The three lengths must satisfy the triangle inequality: any two sides added together have to exceed the third. Sides of 3, 4 and 8 form no triangle at all and are rejected, and every side must be positive. The inradius formula r=Ssr = \dfrac{S}{s} comes from splitting the triangle into three pieces from the incentre, which shows the area equals 12r(a+b+c)=rs\dfrac{1}{2} r (a + b + c) = r s.