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 centres of the circles and the point of intersection of two transverse common tangents to the circles.

**Examples:**

Input :r1 = 4, r2 = 8Output :1:2Input :r1 = 5, r2 = 13Output :5:13

**Approach**:

- Let the radii of the circles be
**r1**&**r2**and**C1**&**C2**respectively. - Let
**P**be the point of intersection of two transverse common tangents to the circles, and**A1**&**A2**be the point of contact of the tangents with the circles. -
In triangle
**PC1A1**& triangle**PC2A2**,

angle**C1A1P**= angle**C2A2P**= 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**A1PC1**= angle**A2PC2**{vertically opposite angles are always equal}

so, angle**A1C1P**= angle**A2C2P**

as angles are same, triangles**PC1A1**&**PC2A2**are similiar. - So, due to similiarity of the triangles,

**C1P/C2P = C1A1/C2A2 = r1/r2**

## C++

`// C++ program to find the ratio ` `// of the distance between the centres of the circles ` `// and the point of intersection ` `// of two transverse common tangents ` `// to the circles which do not touch each other ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `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 = 8; ` ` ` `ratiotang(r1, r2); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find the ratio ` `// of the distance between the centres of the circles ` `// and the point of intersection ` `// of two transverse common tangents ` `// to the circles which do not touch each other ` ` ` `import` `java.io.*; ` ` ` `class` `GFG{ ` ` ` ` ` `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 = ` `8` `; ` ` ` `ratiotang(r1, r2); ` ` ` `} ` `} ` ` ` `// This code is contributed by NamrataSrivastava1 ` |

*chevron_right*

*filter_none*

## Python

`# Python3 program to find the ratio ` `# of the distance between the centres of the circles ` `# and the point of intersection ` `# of two transverse common tangents ` `# to the circles which do not touch each other ` ` ` `def` `GCD(a, b): ` ` ` `if` `(b!` `=` `0` `): ` ` ` `return` `GCD(b, a` `%` `b); ` ` ` `else` `: ` ` ` `return` `a; ` ` ` `# Function to find the ratio ` `def` `ratiotang(r1, r2): ` ` ` ` ` `print` `(` `"The ratio is"` `, r1 ` `/` `/` `GCD(r1, r2), ` ` ` `":"` `, r2 ` `/` `/` `GCD(r1, r2)); ` ` ` `# Driver code ` `r1 ` `=` `4` `; r2 ` `=` `8` `; ` `ratiotang(r1, r2); ` ` ` `# This code is contributed by Code_Mech ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the ratio ` `// of the distance between the centres of the circles ` `// and the point of intersection ` `// of two transverse common tangents ` `// to the circles which do not touch each other ` `using` `System; ` ` ` `class` `GFG ` `{ ` ` ` ` ` `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 ` ` ` `static` `public` `void` `Main () ` ` ` `{ ` ` ` ` ` `int` `r1 = 4, r2 = 8; ` ` ` `ratiotang(r1, r2); ` ` ` `} ` `} ` ` ` `// This code is contributed by Tushil. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find the ratio ` `// of the distance between the centres of the circles ` `// and the point of intersection ` `// of two transverse common tangents ` `// to the circles which do not touch each other ` ` ` `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` `= 8; ` `ratiotang(` `$r1` `, ` `$r2` `); ` ` ` `// This code is contributed by AnkitRai01 ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

The ratio is 1:2

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.

## Recommended Posts:

- Ratio of the distance between the centers of the circles and the point of intersection of two direct 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
- Length of the transverse common tangent between the two non intersecting circles
- 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 the perpendicular bisector of the line joining the centers of two circles
- Maximum possible intersection by moving centers of line segments
- Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given
- Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given
- Tangents between two Convex Polygons
- Ratio of mth and nth terms of an A. P. with given ratio of sums
- Maximum points of intersection n circles
- Length of the direct common tangent between two externally touching circles
- Length of direct common tangent between the two non-intersecting Circles
- Length of direct common tangent between two intersecting Circles
- Find the number which when added to the given ratio a : b, the ratio changes to c : d
- Program for Point of Intersection of Two Lines
- Find intersection point of lines inside a section
- Section formula (Point that divides a line in given ratio)
- Program to find the common ratio of three numbers

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.