Area of a square inscribed in a circle which is inscribed in a hexagon in C Program?

Here we will see how to find the area of a square inscribed in a circle, which is itself inscribed in a hexagon. Let's say the side of the hexagon is 'A', the radius of the inscribed circle is 'r', and the side of the square is 'a'.

A r a

Mathematical Relationship

For a regular hexagon with side A, the radius of the inscribed circle is −

r = (A × ?3) / 2

For a square inscribed in a circle, the diagonal of the square equals the diameter of the circle. Since the diagonal of a square with side 'a' is a?2, we have −

2r = a?2

Therefore: a = (2r) / ?2 = r?2

Substituting the value of r −

a = (A × ?3 × ?2) / 2 = A?6 / 2

The area of the square is −

Area = a² = (A?6 / 2)² = (A² × 6) / 4 = 3A² / 2

Syntax

float squareArea(float hexagonSide);

Example

Here's a C program to calculate the area of the inscribed square −

#include <stdio.h>
#include <math.h>

float squareArea(float A) {
    if (A < 0) {
        printf("Error: Side length cannot be negative<br>");
        return -1;
    }
    
    // Area = 3A²/2
    float area = (3.0 * A * A) / 2.0;
    return area;
}

int main() {
    float hexagonSide = 5.0;
    float area = squareArea(hexagonSide);
    
    if (area != -1) {
        printf("Hexagon side: %.2f<br>", hexagonSide);
        printf("Area of inscribed square: %.2f<br>", area);
    }
    
    return 0;
}
Hexagon side: 5.00
Area of inscribed square: 37.50

Step-by-Step Calculation

Let's verify our formula with the example −

  • Hexagon side (A) = 5
  • Circle radius (r) = (5 × ?3) / 2 ? 4.33
  • Square side (a) = r?2 ? 4.33 × 1.414 ? 6.12
  • Square area = a² ? (6.12)² ? 37.5
  • Using formula: Area = 3A²/2 = 3 × 25 / 2 = 37.5

Conclusion

The area of a square inscribed in a circle which is inscribed in a hexagon can be calculated using the formula Area = 3A²/2, where A is the side of the hexagon. This elegant relationship simplifies the complex geometric arrangement into a straightforward calculation.

Updated on: 2026-03-15T11:45:19+05:30

196 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements