Area of Equilateral triangle inscribed in a Circle of radius R
Given an integer R which denotes the radius of a circle, the task is to find the area of an equilateral triangle inscribed in this circle.
Input: R = 4
Area of equilateral triangle inscribed in a circle of radius R will be 20.784, whereas side of the triangle will be 6.928
Input: R = 7
Area of equilateral triangle inscribed in a circle of radius R will be 63.651, whereas side of the triangle will be 12.124
Approach: Let the above triangle shown be an equilateral triangle denoted as PQR.
- The area of the triangle can be calculated as:
Area of triangle = (1/2) * Base * Height
- In this case, Base can be PQ, PR or QR and The height of the triangle can be PM. Hence,
Area of Triangle = (1/2) * QR * PM
- Now Applying sine law on the triangle ORQ,
RQ OR ------ = ------- sin 60 sin 30 => RQ = OR * sin60 / sin30 => Side of Triangle = OR * sqrt(3) As it is clearly observed PM = PO + OM = r + r * sin30 = (3/2) * r
- Therefore, the Base and height of the required equilateral triangle will be:
Base = r * sqrt(3) = r * 1.732 Height = (3/2) * r
- Compute the area of the triangle with the help of the formulae given above.
Below is the implementation of the above approach:
Time complexity : O(1)
Auxiliary Space : O(1)
My Personal Notes arrow_drop_up
Please Login to comment...