Given the height of an isosceles triangle and two integers , . The task is to find the height from top of the triangle such that if we make a cut at height h from top parallel to base then the triangle must be divided into two parts with the ratio of their areas equal to n:m.
Input : H = 4, n = 1, m = 1 Output : 2.82843 Input : H = 4, n = 1, m = 0 Output : 4
First of all before proceeding let us mention some of the basic properties of an isosceles triangle.
Let ▲ABC is an isosceles triangle with AB = AC and BC being unequal side and base of the triangle. If D is mid-point of BC, then AD is our height H. Also, if we draw a parallel line to BC which cuts AB and AC at points E and F respectively and G being the midpoint of EF then ▲AEG is similar to ▲ABD, ▲AFG is similar to ▲ACD, ▲AEF is similar to ▲ABC, and by using properties of similar triangles we can conclude the following points:
AE/AB = AG/AD = EG/BD = EF/BC = AF/AC —–(i)
As per problem’s requirement, we have to find out the height h, such that the ratio of the area of ▲AEF to the area of trapezium EFCB = n:m.
Let, h is the height of cut from the top of the triangle.
Now, area of ▲AEF = 0.5 * AG * EF and area of trapezium EFCB = 0.5 * GD * (EF+BC)
also, ratio of both is n:m.
So, we can say that ratio of area of ▲AEF to area of ▲ABC is equal to n :(n+m).
=> area of ▲AEF / area of ▲ABC = n / (n+m)
=> (0.5 * AG * EF) / (0.5 * AD * BC) = n / (n+m)
=> (AG/AD) * (EF/BC) = n / (n+m)
=> (EF/BC) * (EF/BC) = n / (n+m)
=> h2 /H2 = n / (n+m)
=> h = H*sqrt(n/(n+m))
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Divide N into K unique parts such that gcd of those parts is maximum
- Find two vertices of an isosceles triangle in which there is rectangle with opposite corners (0, 0) and (X, Y)
- Maximum number of 2x2 squares that can be fit inside a right isosceles triangle
- Maximum number of squares that can fit in a right angle isosceles triangle
- Program To Check whether a Triangle is Equilateral, Isosceles or Scalene
- Find the altitude and area of an isosceles triangle
- Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Find the number which when added to the given ratio a : b, the ratio changes to c : d
- Divide number into two parts divisible by given numbers
- Divide a big number into two parts that differ by k
- Divide a number into two parts such that sum of digits is maximum
- Divide a number into two parts
- Count ways to divide C in two parts and add to A and B to make A strictly greater than B
- Split a number into 3 parts such that none of the parts is divisible by 3
- Check if difference of areas of two squares is prime
- Count number of ways to divide a number in 4 parts
- Minimum cuts required to divide the Circle into equal parts
- Find the number of ways to divide number into four parts such that a = c and b = d
- Divide a sorted array in K parts with sum of difference of max and min minimized in each part
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.