# Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles

Given two circles of given radii, such that the circles don’t touch each other, the task is to find the ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles.

**Examples:**

Input:r1 = 4, r2 = 6Output:2:3Input:r1 = 22, r2 = 43Output:22:43

**Approach**:

- Let the radii of the circles be
**r**&_{1}**r**and the centres be_{2}**C**&_{1}**C**respectively._{2} - Let
**P**be the point of intersection of two direct common tangents to the circles, and**A**&_{1}**A**be the point of contact of the tangents with the circles._{2} - In triangle
**PC**& triangle_{1}A_{1}**PC**,_{2}A_{2}

angle**C**= angle_{1}A_{1}P**C**=_{2}A_{2}P**90 deg**{ line joining the center of the circle to the point of contact makes an angle of 90 degree with the tangent },

also, angle**A**= angle_{1}PC_{1}**A**_{2}PC_{2}

so, angle**A**= angle_{1}C_{1}P**A**_{2}C_{2}P

as angles are same, triangles**PC**&_{1}A_{1}**PC**are_{2}A_{2}**similiar**. - So, due to similiarity of the triangles,

**C**_{1}P/C_{2}P = C_{1}A_{1}/C_{2}A_{2}= r_{1}/r_{2}

The ratio of the distance between the centres of the circles and the point of intersection of two direct common tangents to the circles = radius of the first circle : radius of the second circle

Below is the implementation of the above approach:

## C++

`// C++ program to find the ratio of the distance ` `// between the centers of the circles ` `// and the point of intersection of ` `// two direct common tangents to the circles ` `// which do not touch each other ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the GCD ` `int` `GCD(` `int` `a, ` `int` `b) ` `{ ` ` ` `return` `(b != 0 ? GCD(b, a % b) : a); ` `} ` ` ` `// Function to find the ratio ` `void` `ratiotang(` `int` `r1, ` `int` `r2) ` `{ ` ` ` `cout << ` `"The ratio is "` ` ` `<< r1 / GCD(r1, r2) ` ` ` `<< ` `" : "` ` ` `<< r2 / GCD(r1, r2) ` ` ` `<< endl; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `int` `r1 = 4, r2 = 6; ` ` ` `ratiotang(r1, r2); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find the ratio of the distance ` `// between the centers of the circles ` `// and the point of intersection of ` `// two direct common tangents to the circles ` `// which do not touch each other ` `class` `GFG { ` ` ` ` ` `// Function to find the GCD ` ` ` `static` `int` `GCD(` `int` `a, ` `int` `b) ` ` ` `{ ` ` ` `return` `(b != ` `0` `? GCD(b, a % b) : a); ` ` ` `} ` ` ` ` ` `// Function to find the ratio ` ` ` `static` `void` `ratiotang(` `int` `r1, ` `int` `r2) ` ` ` `{ ` ` ` `System.out.println(` `"The ratio is "` ` ` `+ r1 / GCD(r1, r2) ` ` ` `+ ` `" : "` ` ` `+ r2 / GCD(r1, r2)); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` `int` `r1 = ` `4` `, r2 = ` `6` `; ` ` ` `ratiotang(r1, r2); ` ` ` `} ` `} ` ` ` `// This code has been contributed by 29AjayKumar ` |

*chevron_right*

*filter_none*

## Python3

`# Python 3 program to find the ratio ` `# of the distance between the centers ` `# of the circles and the point of intersection ` `# of two direct common tangents to the circles ` `# which do not touch each other ` ` ` `# Function to find the GCD ` `from` `math ` `import` `gcd ` ` ` `# Function to find the ratio ` `def` `ratiotang(r1, r2): ` ` ` `print` `(` `"The ratio is"` `, ` `int` `(r1 ` `/` `gcd(r1, r2)), ` `":"` `, ` ` ` `int` `(r2 ` `/` `gcd(r1, r2))) ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` `r1 ` `=` `4` ` ` `r2 ` `=` `6` ` ` `ratiotang(r1, r2) ` ` ` `# This code is contributed by ` `# Surendra_Gangwar ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the ratio of the distance ` `// between the centers of the circles ` `// and the point of intersection of ` `// two direct common tangents to the circles ` `// which do not touch each other ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` ` ` `// Function to find the GCD ` ` ` `static` `int` `GCD(` `int` `a, ` `int` `b) ` ` ` `{ ` ` ` `return` `(b != 0 ? GCD(b, a % b) : a); ` ` ` `} ` ` ` ` ` `// Function to find the ratio ` ` ` `static` `void` `ratiotang(` `int` `r1, ` `int` `r2) ` ` ` `{ ` ` ` `Console.WriteLine(` `"The ratio is "` ` ` `+ r1 / GCD(r1, r2) ` ` ` `+ ` `" : "` ` ` `+ r2 / GCD(r1, r2)); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `Main(String[] args) ` ` ` `{ ` ` ` `int` `r1 = 4, r2 = 6; ` ` ` `ratiotang(r1, r2); ` ` ` `} ` `} ` ` ` `// This code contributed by Rajput-Ji ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find the ratio of the distance ` `// between the centers of the circles ` `// and the point of intersection of ` `// two direct common tangents to the circles ` `// which do not touch each other ` ` ` `// Function to find the GCD ` `function` `GCD(` `$a` `, ` `$b` `) ` `{ ` ` ` `return` `(` `$b` `!= 0 ? GCD(` `$b` `, ` `$a` `% ` `$b` `) : ` `$a` `); ` `} ` ` ` `// Function to find the ratio ` `function` `ratiotang(` `$r1` `, ` `$r2` `) ` `{ ` ` ` `echo` `"The ratio is "` `, ` `$r1` `/ GCD(` `$r1` `, ` `$r2` `), ` ` ` `" : "` `, ` `$r2` `/ GCD(` `$r1` `, ` `$r2` `) ; ` `} ` ` ` `// Driver code ` `$r1` `= 4; ` `$r2` `= 6; ` `ratiotang(` `$r1` `, ` `$r2` `); ` ` ` `// This code is contributed by AnkitRai01 ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

The ratio is 2 : 3

## Recommended Posts:

- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Number of common tangents between two circles if their centers and radius is given
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Find the radii of the circles which are lined in a row, and distance between the centers of first and last circle is given
- Length of direct common tangent between the two non-intersecting Circles
- Length of direct common tangent between two intersecting Circles
- Length of the direct common tangent between two externally touching circles
- Length of the perpendicular bisector of the line joining the centers of two circles
- Maximum points of intersection n circles
- Length of the transverse common tangent between the two non intersecting circles
- Maximum possible intersection by moving centers of line segments
- Path in a Rectangle with Circles
- Check if two given Circles are Orthogonal or not
- Check if two given circles touch or intersect each other
- Program to calculate the area between two Concentric Circles

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.