Showing posts with label Heron's formula. Show all posts
Showing posts with label Heron's formula. Show all posts

Monday, 27 July 2026

Circles Inscribed In Triangles

I watched an interesting video that shows the area of a circle inscribed in a 3 : 4 : 5 right-angled triangle is equal to \( \pi \).


This got me thinking about right-angled triangle in general and I noted in the comments to the video that for a right-angled triangle with sides of \(a, b, c\) where \(c\) is the hypotenuse, the radius \(r\) of the inscribed circle is given by:$$r=\frac{a+b-c}{2}$$One can see that when \(a=3\), \(b=4\) and \(c=5\), we get:$$ r =\frac{3+4-5}{2} = \frac{2}{2}=1$$The area of the inscribed circle is thus \( \pi\) square units. So I investigated the general case, for any triangle with sides of \(a\), \(b\) and \(c\), and this is the explanation and formula that Gemini came up with:


Inscribed Circles in Any General Triangle

The area of the inscribed circle (the incircle) can be expressed purely in terms of the side lengths $a$, $b$, and $c$ for any triangle, whether it is right-angled, acute, or obtuse.

To do this, we use two foundational concepts in geometry: Heron's Formula and the relationship between a triangle's area and its inradius.

Step 1: Define the Semi-perimeter

For any triangle with sides $a$, $b$, and $c$, we first calculate the semi-perimeter (half of the perimeter), usually denoted as $s$:

$$s = \frac{a + b + c}{2}$$

Step 2: The Radius Formula

The radius $r$ of an inscribed circle in any triangle is equal to the area of the triangle divided by its semi-perimeter. Using Heron's Formula for the area of the triangle, this gives us:

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

Which simplifies algebraically to:

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

Step 3: Calculate the Area of the Incircle

Now that we have the radius purely in terms of the sides (via $s$), we just plug it into the circle area formula ($A = \pi \, r^2 \,$). The square root neatly disappears:

$$A = \pi \left( \frac{(s-a)(s-b)(s-c)}{s} \right)$$

Summary of the General Formula

If you want to write the area of the inscribed circle entirely in a single expression using just $a$, $b$, and $c$ (without using the $s$ substitution), it looks like this:

$$A = \pi  \left( \frac{(b+c-a)(a+c-b)(a+b-c)}{4(a+b+c)} \right)$$

Both the formula using $s$ and the expanded algebraic formula above will work perfectly for any valid triangle.

Thursday, 18 July 2024

Area of Triangle Using Matrices and Determinants

I watched an interesting YouTube video explaining how to use matrices and determinants to find the area of a triangle given its vertices. Of course, one could use the distance formula to find the lengths of the sides and then use Heron's formula to find the area but this method is far quicker as we'll see.

The first example used in the video involved the points (1,1), (4,1) and (4,5). These coordinates are used to form a 3 x 3 matrix with the x coordinates forming the first column, the y coordinates forming the second column, and the third column consisting of three 1's. The result is as shown below:$$ \begin{bmatrix} 1 & 1 & 1 \\ 4 & 1 & 1\\ 4 & 5 & 1 \end{bmatrix} $$The determinant of this matrix is 12 and the area of the triangle is simply half the value of the determinant, namely 6. The coordinates were chosen by the author of the video so that the the triangle formed by the vertices is right-angled and its area quickly calculated. See Figure 1.


Figure 1: f = 3 units and g = 4 units
and so area is  3 x 4 / 2 = 6 square units

Here is a permalink to a SageMath algorithm that will calculate the area form the coordinates of the input vertices. The second example in the video involved the vertices (2, 3), (5, 7) and (10, -5). This produces the following matrix:
$$ \begin{bmatrix} 2 & 3 & 1 \\ 5 & 7 & 1\\ 10 & -5 & 1 \end{bmatrix} $$This matrix has a determinant of -56 and we take half of its absolute value to calculate the area of the triangle to be 28 square units. See Figure 2.


Figure 2

The video goes through the process of finding the lengths of f, g and h using the Pythagorean theorem and then using Heron's formula to find the area. This is done to confirm that matrix/determinant method actually works so I won't reproduce that here. Suffice to say that once the matrix M is constructed, we can say that:$$\text{Area of Triangle }=\frac{1}{2} \times \text{ det } |M|$$This got me thinking about quadrilaterals and whether this method could be extended to find the area of quadrilaterals but it doesn't appear to. The quadrilateral would need to be broken up into two triangles and the area of each calculated using the matrix/determinant method.

Tuesday, 12 September 2023

Cyclic Quadrilaterals

I was forced to think about cyclic quadrilaterals when looking for information about the number associated with my diurnal age today. 27190 is a member of OEIS A329950:


  A329950

Floor of area of quadrilateral with consecutive prime sides configured as a cyclic quadrilateral.



In the case of 27190, the consecutive prime sides are 157, 163, 167 and 173 and the area is given by Brahmagupta's formula: $$ \text{area }=\sqrt{(s-a) \times (s-b) \times (s-c) \times(s-d)}\\ \text{ where } s=\frac{a+b+c+d}{2} \text{ and }a,b,c \text{ and } d \text{ are the four sides}$$Here the area turns out to be 27190.9834504013 which is 27190 when truncated. The initial members of the sequence are (permalink):

13, 30, 70, 130, 214, 310, 461, 627, 874, 1167, 1423, 1750, 2094, 2512, 2995, 3574, 4137, 4603, 5237, 5829, 6526, 7522, 8507, 9478, 10390, 11014, 11650, 12932, 14314, 16053, 17799, 19278, 20698, 22159, 23994, 25403, 27190, 29033, 30595, 32718, 34558, 36255, 38014, 39954

The radius \(R\) of the circumcircle, referred to as the circumradius, is given by the formula:$$R=\frac{1}{4} \sqrt{\frac{(ab+cd)(ac+bd)(ad+bc)}{(s-a)(s-b)(s-c)(s-d)}}$$In the case of the cyclic quadrilateral with sides 157, 163, 167, 173 and truncated area of 27190, the truncated circumradius is 116 and the truncated area of the circumcircle is 42818 square units. 
These types of cyclic quadrilaterals are very close to being square in shape. For example, the quadrilateral with sides of 157, 163, 167 and 173 has an average side length of 165 and the area of a square with this side is 27225 square units and thus very close to 27190.

In the formula for the area given earlier, it can be noted that when \(d=0\), we get a triangle whose area is given by the familiar Heron's formula:$$ \text{area }=\sqrt{s \times (s-a) \times (s-b) \times (s-c) }\\ \text{ where } s=\frac{a+b+c}{2} \text{ and }\\a,b \text{ and } c \text{ are the three sides of the triangle}$$It should be noted that Brahmagupta's formula does not apply to quadrilaterals in general. It only applies to cyclic quadrilaterals. The more general formula is similar but more complex and I won't cover that here. For more information follow this link.

Friday, 16 October 2020

Heronian Triangles and Tetrahedra

I have mentioned Heronian triangles tangentially in a post of Saturday, 2nd December 2017 when dealing with the number 25080. This number is the area of a so-called almost equilateral triangle with sides of 240, 241 and 241. In that post, I stated that:

A close-to-equilateral integer triangle is defined to be a triangle with integer sides and integer area such that the largest and smallest sides differ in length by unity. The first five close-to-equilateral integer triangles have sides (5, 5, 6), (17, 17, 16), (65, 65, 66), (241, 241, 240) and (901, 901, 902).

Figure 1
This triangle is also an example of an Heronian triangle which is simply any triangle with integer sides that also has an integer area. The simplest example is such as a triangle is right-angled with sides of 3, 4 and 5 (see Figure 1). The area of the triangle is 6 square units. From any right-angled Heronian triangle, two isosceles Heronian triangle can be constructed. For example, the 3, 4, 5 right-angled triangle leads to the 5, 5, 6 and the 5, 5, 8 isosceles triangles.

I was reminded of Heronian triangles by my diurnal age today which is 26129. This number has the following property:


A306626




Numbers that set a record for occurrences as longest side of a primitive Heronian triangle.


A primitive Heronian triangle is one in which the greatest common divisor of the three sides is 1. The 3, 4, 5 triangle is primitive but the 6, 8, 10 triangle, though still Heronian, is not primitive because the greatest common divisor is 2. Figure 2 shows these record numbers up to 15725:

Figure 2
The list of numbers up to 26129 is as follows:

1, 5, 13, 17, 37, 52, 65, 85, 119, 125, 145, 221, 325, 481, 697, 725, 1025, 1105, 1625, 1885, 2465, 2665, 3145, 5525, 6409, 15457, 15725, 26129

As can be seen from the table in Figure 2, the number of possible triangles with a longest side of 15725 is 463 but no figure is available for the number of Heronian triangles with a longest side of 26129. The algorithm I developed to calculate the number works fine for smaller sides but times out for larger numbers. Here is a permalink to the code.

Of course the Heron whose name is being used to identify these types of triangles is the same person responsible for Heron's formula that states the area \(A\) of a triangle whose sides have lengths \(a, b, c\) is:$$A=\sqrt{s(s-a)(s-b)(s-c)} \text{ where } s=\frac{a+b+c}{2}$$It was interesting to learn that a shape is called equable if its perimeter equals its area. There are only five equable Heronian triangles and these have sides (5,12,13), (6,8,10), (6,25,29), (7,15,20), and (9,10,17). As another former Mathematics teacher pointed out in a blog post on Heronian triangles:
Students, or teachers, who liked "The Hitchhiker's Guide to the Galaxy" may enjoy the 7-15-20 triangle which has both perimeter and area of 42. Author Douglas Adams set 42 as the answer to "life, the universe, and everything" and Tony Crilly and Colin Fletcher have dubbed this the "hitchhiker triangle."
There is another category of Heronian triangles that is of interest. Since the area of an equilateral triangle with rational sides is an irrational number, no equilateral triangle is Heronian. However, there is a unique sequence of Heronian triangles that are "almost equilateral" because the three sides are of the form \(n − 1, n, n + 1\). Some of these are listed in Figure 3. These are very similar to the "close-to-equilateral" triangles, mentioned at the start of this blog, that are of the form \(n,n,n+1\) or \(n-1,n-1,n\). 

Figure 3: source

The numbers in column 2, the \(n\) column, form a Lucas sequence defined by$$a_n = 4 \times a_{n-1} - a_{n-2} \text{ with } a_0 = 2 \text{ and } a_1 = 4$$Alternatively, the formula \( (2+\sqrt{3})^n+(2-\sqrt{3})^n\) will generate all the terms. 

There's a lot more to said about Heronian triangles. For example, let's venture into three dimensions and an Heronian tetrahedron defined as a not necessarily regular tetrahedron whose sides, face areas, and volume are all rational numbers. It therefore is a tetrahedron all of whose faces are Heronian triangles and additionally that has rational volume. Figure 4 shows the integer Heronian tetrahedron having smallest maximum side length. It has edge lengths 51, 52, 53, 80, 84, 117; faces (117, 80, 53), (117, 84, 51), (80, 84, 52), (53, 51, 52); face areas 1170, 1800, 1890, 2016; and volume 18144. 

Figure 4: source

The integer Heronian tetrahedron with smallest possible surface area and volume has edges 25, 39, 56, 120, 153, and 160; areas 420, 1404, 1872, and 2688 (for a total surface area of 6384) and volume 8064. The smallest examples of integer Heronian tetrahedra composed of four identical copies of a single acute triangle (i.e., disphenoids) have pairs of opposite sides (148, 195, 203), (533, 875, 888), (1183, 1479, 1804), (2175, 2296, 2431), (1825, 2748, 2873), (2180, 2639, 3111), (1887, 5215, 5512), (6409, 6625, 8484), and (8619, 10136, 11275). An Heronian tetrahedron is sometimes called a perfect tetrahedron.

Saturday, 2 December 2017

25080: A Number Of Interest

The number of OEIS entries for numbers in the region 25000 can be quite few. For example, 25079 has three entries, 25078 has six, 25077 has five and so on. Thus it was surprising to note that 25080 has an impressive 43 entries. It helps that it's highly factorisable: 2 x 2 x 2 × 3 × 5 × 11 × 19. Let's look at one of these entries.

OEIS A102341: areas of 'close-to-equilateral' integer triangles. To quote from OEIS:
A close-to-equilateral integer triangle is defined to be a triangle with integer sides and integer area such that the largest and smallest sides differ in length by unity. The first five close-to-equilateral integer triangles have sides (5, 5, 6), (17, 17, 16), (65, 65, 66), (241, 241, 240) and (901, 901, 902).
The corresponding sequence of areas for these triangles is 12, 120, 1848, 25080, 351780. So the 'close-to-equilateral' integer triangle with sides 241, 241 and 240 has an integer area of 25080. Here is the image that I posted to my Twitter account, taken from WolframAlpha:

Here is further detail from the OEIS entry:
Heron's formula: a triangle with side lengths \( (x,y,z)  \) has area \(A = \sqrt {s*(s-x)*(s-y)*(s-z)} \) where \(s = (x+y+z)/\)2. For this sequence we assume integer side-lengths \(x = y = z \pm 1 \). Then for \(A \) to also be an integer, \( x+y+z \) must be even, so we can assume \( z = 2k \) for some positive integer \( k \). Now \( s = (x+y+z)/2 = 3k \pm 1 \) and \(A = \sqrt{(3*k \pm 1)*k*k*(k \pm 1)} = k*\sqrt{3*k^2 \pm 4*k + 1} \). To determine when this is an integer, set \( 3*k^2 \pm 4*k + 1 = d^2 \). If we multiply both sides by 3, it is easier to complete the square: \((3*k \pm 2)^2 - 1 = 3*d^2 \). Now we are looking for solutions to the Pell equation \( c^2 - 3*d^2 = 1 \) with \( c = 3*k \pm 2 \), for which there are infinitely many solutions: use the upper principal convergents of the continued fraction expansion of \( \sqrt{3} \). 
 Here are links supplied in the OEIS entry: