# Biggest Reuleaux Triangle inscirbed within a square inscribed in a semicircle

Given here is a semicircle of radius **r** which inscribes a square which in turn inscribes a reuleaux triangle. The task is to find the maximum possible area of this reuleaux triangle.

**Examples:**

Input : x = 5Output : 14.0954Input : x = 8Output : 36.0842

**Approach**:We know, the side of the square inscribed within a semicircle is, **a = 2r/√5**. (Please refer here)

Also, in the reuleaux triangle, **x = a**.

So, **x = 2*r/√5**

So, Area of Reuleaux Triangle:

A = 0.70477*x^2 = 0.70477*(r^2/5)

Below is the implementation of the above approach:

## C++

`// C++ Program to find the biggest Reuleaux triangle ` `// inscribed within in a square which in turn ` `// is inscribed within a semicircle ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the biggest reuleaux triangle ` `float` `Area(` `float` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < 0) ` ` ` `return` `-1; ` ` ` ` ` `// height of the reuleaux triangle ` ` ` `float` `x = (2 * r) / ` `sqrt` `(5); ` ` ` ` ` `// area of the reuleaux triangle ` ` ` `float` `A = 0.70477 * ` `pow` `(x, 2); ` ` ` ` ` `return` `A; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `float` `r = 5; ` ` ` `cout << Area(r) << endl; ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java Program to find the biggest ` `// Reuleaux triangle inscribed within ` `// in a square which in turn is ` `// inscribed within a semicircle ` `import` `java.lang.Math; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the biggest reuleaux triangle ` `static` `float` `Area(` `float` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < ` `0` `) ` ` ` `return` `-` `1` `; ` ` ` ` ` `// height of the reuleaux triangle ` ` ` `float` `x = (` `2` `* r) /(` `float` `)(Math.sqrt(` `5` `)); ` ` ` ` ` `// area of the reuleaux triangle ` ` ` `float` `A = ` `0` `.70477f *(` `float` `)(Math.pow(x, ` `2` `)); ` ` ` ` ` `return` `A; ` `} ` ` ` `// Driver code ` `public` `static` `void` `main(String[] args) ` `{ ` ` ` `float` `r = ` `5` `; ` ` ` `System.out.println(Area(r)); ` `} ` `} ` ` ` `// This code is contributed by Mukul Singh. ` |

*chevron_right*

*filter_none*

## Python3

`# Python3 Program to find the biggest ` `# Reuleaux triangle inscribed within ` `# in a square which in turn is inscribed ` `# within a semicircle ` `import` `math as mt ` ` ` `# Function to find the biggest ` `# reuleaux triangle ` `def` `Area(r): ` ` ` ` ` `# radius cannot be negative ` ` ` `if` `(r < ` `0` `): ` ` ` `return` `-` `1` ` ` ` ` `# height of the reuleaux triangle ` ` ` `x ` `=` `(` `2` `*` `r) ` `/` `mt.sqrt(` `5` `) ` ` ` ` ` `# area of the reuleaux triangle ` ` ` `A ` `=` `0.70477` `*` `pow` `(x, ` `2` `) ` ` ` ` ` `return` `A ` ` ` `# Driver code ` `r ` `=` `5` `print` `(Area(r)) ` ` ` `# This code is contributed by ` `# Mohit Kumar 29 ` |

*chevron_right*

*filter_none*

## C#

`// C# Program to find the biggest ` `// Reuleaux triangle inscribed within ` `// in a square which in turn is ` `// inscribed within a semicircle ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` `// Function to find the biggest reuleaux triangle ` `static` `double` `Area(` `double` `r) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(r < 0) ` ` ` `return` `-1; ` ` ` ` ` `// height of the reuleaux triangle ` ` ` `double` `x = (2 * r) / (` `double` `)(Math.Sqrt(5)); ` ` ` ` ` `// area of the reuleaux triangle ` ` ` `double` `A = 0.70477 * (` `double` `)(Math.Pow(x, 2)); ` ` ` ` ` `return` `A; ` `} ` ` ` `// Driver code ` `public` `static` `void` `Main() ` `{ ` ` ` `double` `r = 5; ` ` ` `Console.WriteLine(Area(r)); ` `} ` `} ` ` ` `// This code is contributed by chandan_jnu ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP Program to find the biggest Reuleaux ` `// triangle inscribed within in a square ` `// which in turn is inscribed within a semicircle ` ` ` `// Function to find the biggest ` `// reuleaux triangle ` `function` `Area(` `$r` `) ` `{ ` ` ` ` ` `// radius cannot be negative ` ` ` `if` `(` `$r` `< 0) ` ` ` `return` `-1; ` ` ` ` ` `// height of the reuleaux triangle ` ` ` `$x` `= (2 * ` `$r` `) / sqrt(5); ` ` ` ` ` `// area of the reuleaux triangle ` ` ` `$A` `= 0.70477 * pow(` `$x` `, 2); ` ` ` ` ` `return` `$A` `; ` `} ` ` ` `// Driver code ` `$r` `= 5; ` ` ` `echo` `Area(` `$r` `); ` ` ` `// This code is contributed by Ryuga ` `?> ` ` ` |

*chevron_right*

*filter_none*

**Output:**

14.0954

## Recommended Posts:

- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within a hexagon
- Biggest Reuleaux Triangle inscribed within a square which is inscribed within an ellipse
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Circle
- Biggest Reuleaux Triangle within A Square
- Biggest Square that can be inscribed within an Equilateral triangle
- Largest triangle that can be inscribed in a semicircle
- Largest square that can be inscribed in a semicircle
- Largest square that can be inscribed within a hexagon which is inscribed within an equilateral triangle
- Area of a square inscribed in a circle which is inscribed in an equilateral triangle
- Largest ellipse that can be inscribed within a rectangle which in turn is inscribed within a semicircle
- Area of a circle inscribed in a rectangle which is inscribed in a semicircle
- Radius of the biggest possible circle inscribed in rhombus which in turn is inscribed in a rectangle
- Largest rectangle that can be inscribed in a semicircle

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.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.