Area of circle inscribed in a Isosceles Trapezoid - GeeksforGeeks

22 Feb, 2022
Given two bases of the isosceles trapezoid ABCD as a and b, the task is to find the area of circle inscribed in this trapezoid 
Examples:  
Input: a = 10, b = 30 
Output: Area = 235.57

Input: a = 20, b = 36 
Output: Area = 565.38
Derivation: Given a circle inscribed in trapezium ABCD (sides AB = n and CD = m), we need to find out the height of the trapezium i.e., (AL), which is half of the radius of the circle to find the area of the circle.
For finding the height of circle we do following operation. 
The circle will always touch the sides of trapezium at their midpoints, Say the midpoints of AB, BD, CD, AC are G, F, H, E, and join them with the center of the circle.Now from Symmetry, we can see that  
The circle will always touch the sides of trapezium at their midpoints, Say the midpoints of AB, BD, CD, AC are G, F, H, E, and join them with the center of the circle.
Now from Symmetry, we can see that  
AG = AE = n/2, 
EC = CG = m/2, 
HD = DF = n/2,
GB = FB = m/2
Now in Triangle ACL apply the Pythagoras theorem.  
Now in Triangle ACL apply the Pythagoras theorem.  
Hypotenuse AC = m/2 + n/2
Base CL = CH - AG = m/2 - n/2

we get 
Perpendicular AL = Square_root(m * n)
Therefore the height of the Trapezium = AL = Square_Root(Product of given sides)Now the radius of the circle is simple half of the height and hence the area can be calculated easily.
Therefore the height of the Trapezium = AL = Square_Root(Product of given sides)
Now the radius of the circle is simple half of the height and hence the area can be calculated easily.
Approach:  
Find the height of the trapezoid as (square_root( m * n )).Find the radius of the incircle  
Find the height of the trapezoid as (square_root( m * n )).
Find the radius of the incircle  
R = height / 2 
  = square_root(m * n) / 2
Now find the area of the circle 
Now find the area of the circle 
= Pi * R2 
= ( 3.141 * m * n ) / 4
Below is the implementation of the above approach: 
C++
Java
Python3
C#
Javascript
// CPP implementation to find// the area of the circle// inscribed in a trapezoid// having non- parallel sides m, n#include<bits/stdc++.h>using namespace std; // Function to find area of circle// inscribed in a trapezoid// having non- parallel sides m, ndouble area_of_circle(int m, int n){    // radius of circle by the    // formula i.e. root( m * n) / 2    // area of circle = (3.141 ) * ( R ** 2 )     int square_of_radius = ( m * n ) / 4;    double area = ( 3.141 * square_of_radius );    return area;} // Driver Codeint main(){    int n = 10;    int m = 30;    cout << (area_of_circle(m, n));} // This code is contributed by mohit kumar 29
// Java Program to find// the area of the circle// inscribed in a trapezoid// having non- parallel sides m, nclass GFG{         // Function to find area of circle    // inscribed in a trapezoid    // having non- parallel sides m, n    static double area_of_circle(int m, int n)    {        // radius of circle by the        // formula i.e. root( m * n) / 2        // area of circle = (3.141 ) * ( R ** 2 )             int square_of_radius = ( m * n ) / 4;        double area = ( 3.141 * square_of_radius );        return area;    }         // Driver code    public static void main (String[] args)    {        int n = 10;        int m = 30;        System.out.println(area_of_circle(m, n));    }} // This code is contributed by Yash_R
# Python 3 implementation to find# the area of the circle# inscribed in a trapezoid# having non- parallel sides  m, n  # Function to find area of circle# inscribed in a trapezoid# having non- parallel sides  m, ndef area_of_circle(m, n):    # radius of circle by the    # formula i.e. root( m * n) / 2    # area of circle = (3.141 ) * ( R ** 2 )         square_of_radius = ( m * n ) / 4    area = ( 3.141 * square_of_radius )    return area # Driver Codeif __name__=='__main__':    n = 10    m = 30    print(area_of_circle(m, n))
// C# Program to find// the area of the circle// inscribed in a trapezoid// having non- parallel sides m, nusing System; class GFG{     // Function to find area of circle// inscribed in a trapezoid// having non- parallel sides m, nstatic double area_of_circle(int m, int n){    // radius of circle by the    // formula i.e. root( m * n) / 2    // area of circle = (3.141 ) * ( R ** 2 )     int square_of_radius = ( m * n ) / 4;    double area = ( 3.141 * square_of_radius );    return area;} // Driver codepublic static void Main (){    int n = 10;    int m = 30;    Console.WriteLine(area_of_circle(m, n));}} // This code is contributed by Sanjit_Prasad
<script> // Javascript Program to find// the area of the circle// inscribed in a trapezoid// having non- parallel sides m, n // Function to find area of circle// inscribed in a trapezoid// having non- parallel sides m, nfunction area_of_circle(m, n){         // Radius of circle by the    // formula i.e. root( m * n) / 2    // area of circle = (3.141 ) * ( R ** 2 )     var square_of_radius = ( m * n ) / 4;    var area = ( 3.141 * square_of_radius );    return area;} // Driver Codevar n = 10;var m = 30; document.write(area_of_circle(m, n)); // This code is contributed by Khushboogoyal499     </script>
235.575
 
mohit kumar 29
Sanjit_Prasad
Yash_R
khushboogoyal499
varshagumber28
sumitgumber28
simmytarika5
area-volume-programs
Aptitude
Geometric
Mathematical
Mathematical
Geometric
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
| | Question 44
Puzzle | How much money did the man have before entering the bank?
Order and Ranking Questions & Answers
Aptitude | GATE CS 1998 | Question 77
Seating Arrangement | Aptitude
Circle and Lattice Points
Closest Pair of Points using Divide and Conquer algorithm
How to check if two given line segments intersect?
Program for distance between two points on earth
How to check if a given point lies inside or outside a polygon?