Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Area of a n-sided regular polygon with given Radius?
Here we will see how to get the area of an n-sided regular polygon whose radius is given. Here the radius is the distance from the center to any vertex. To solve this problem, we draw a perpendicular from the center to one side. Let each side have length 'a'. The perpendicular divides the side into two equal parts, each of length a/2. The perpendicular and the radius form an angle x, and let the radius length be r.
The polygon can be divided into N equal triangles from the center. For any polygon with N sides, the central angle is 360°/N. Therefore, the angle x (half of the central angle) is 180°/N.
Syntax
float polygonArea = (r * r * n * sin(angle_in_radians)) / 2;
Where −
- r is the radius from center to vertex
- n is the number of sides
- angle is (360°/n) converted to radians
Mathematical Formula
Using trigonometry −
- sin(x) = (a/2)/r, so a = 2 * r * sin(x)
- cos(x) = h/r, so h = r * cos(x)
- Area of one triangle = (1/2) * base * height = (1/2) * a * h
- Total area = N * (1/2) * a * h = N * r² * sin(x) * cos(x) / 2
- Since sin(2x) = 2 * sin(x) * cos(x), the formula becomes: Area = (N * r² * sin(2?/N)) / 2
Example
Here's a C program to calculate the area of a regular hexagon with radius 9 units −
#include <stdio.h>
#include <math.h>
float polygonArea(float r, int n) {
float angleInRadians = (360.0 / n) * (M_PI / 180.0);
return (r * r * n * sin(angleInRadians)) / 2;
}
int main() {
float radius = 9.0f;
int sides = 6;
float area = polygonArea(radius, sides);
printf("Radius: %.1f units<br>", radius);
printf("Number of sides: %d<br>", sides);
printf("Polygon Area: %.2f square units<br>", area);
return 0;
}
Radius: 9.0 units Number of sides: 6 Polygon Area: 210.44 square units
Key Points
- The radius refers to the distance from center to any vertex (circumradius)
- The formula works for any regular polygon with n ? 3 sides
- Always convert degrees to radians when using trigonometric functions in C
- Use
M_PIconstant frommath.hfor accurate calculations
Conclusion
The area of a regular n-sided polygon with circumradius r is calculated using the formula: Area = (n × r² × sin(360°/n)) / 2. This approach divides the polygon into triangular sections and uses trigonometry to find the total area.
