Given two circles of given radii, having there centres a given distance apart, such that the circles don’t touch each other. The task is to find the length of the transverse common tangent between the circles.

**Examples:**

Input:r1 = 4, r2 = 6, d = 12Output:6.63325Input:r1 = 7, r2 = 9, d = 21Output:13.6015

**Approach**:

- Let the radii of the circles be
**r1**&**r2**respectively. - Let the distance between the centers be
**d**units. - Draw a line O’R parallel to PQ,
**angle OPQ = angle RPQ = 90 deg**

**angle O’QP = 90 deg**

{ line joining the center of the circle to the point of contact makes an angle of 90 degree with the tangent }-
**angle RPQ + angle O’QP = 180 deg**

**PR || O’Q** -
Since opposite sides are parallel and interior angles are 90, therefore
**O’PQR**is a rectangle. **O’Q = RP = r2 and PQ = O’R**- In triangle
**OO’R****angle ORO’ = 90 deg**

By**Pythagoras theorem**,

**OR^2 + O’R^2 = OO’^2**

O’R^2 = OO’^2 – OR^2

O’R^2 = d^2 – (r1+r2)^2

O’R^2 = √(d^2 – (r1+r2)^2)

## C++

`// C++ program to find the length ` `// of the transverse common tangent ` `// between two circles which ` `// do not touch each other ` ` ` `#include <bits/stdc++.h> ` `using` `namespace` `std; ` ` ` `// Function to find the length ` `// of the transverse common tangent ` `void` `lengthOfTangent(` `double` `r1, ` `double` `r2, ` `double` `d) ` `{ ` ` ` ` ` `cout << ` `"The length of the transverse"` ` ` `<< ` `" common tangent is "` ` ` `<< ` `sqrt` `(` `pow` `(d, 2) - ` `pow` `((r1 + r2), 2)) ` ` ` `<< endl; ` `} ` ` ` `// Driver code ` `int` `main() ` `{ ` ` ` `double` `r1 = 4, r2 = 6, d = 12; ` ` ` `lengthOfTangent(r1, r2, d); ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find the length ` `// of the transverse common tangent ` `// between two circles which ` `// do not touch each other ` `class` `GFG { ` ` ` ` ` `// Function to find the length ` ` ` `// of the transverse common tangent ` ` ` `static` `void` `lengthOfTangent(` `double` `r1, ` ` ` `double` `r2, ` `double` `d) ` ` ` `{ ` ` ` ` ` `System.out.println(` `"The length of the transverse"` ` ` `+ ` `" common tangent is "` ` ` `+ Math.sqrt(Math.pow(d, ` `2` `) ` ` ` `- Math.pow((r1 + r2), ` `2` `))); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` `double` `r1 = ` `4` `, r2 = ` `6` `, d = ` `12` `; ` ` ` `lengthOfTangent(r1, r2, d); ` ` ` `} ` `} ` ` ` `// This code has been contributed by 29AjayKumar ` |

*chevron_right*

*filter_none*

## Python3

`# python 3 program to find the length ` `# of the transverse common tangent ` `# between two circles which ` `# do not touch each other ` `from` `math ` `import` `sqrt, ` `pow` ` ` `# Function to find the length ` `# of the transverse common tangent ` `def` `lengthOfTangent(r1, r2, d): ` ` ` `print` `(` `"The length of the transverse"` `, ` ` ` `"common tangent is"` `, ` ` ` `'{0:.6g}'` `.` `format` `(sqrt(` `pow` `(d, ` `2` `) ` `-` ` ` `pow` `((r1 ` `+` `r2), ` `2` `)))) ` ` ` `# Driver code ` `if` `__name__ ` `=` `=` `'__main__'` `: ` ` ` `r1 ` `=` `4` ` ` `r2 ` `=` `6` ` ` `d ` `=` `12` ` ` `lengthOfTangent(r1, r2, d) ` ` ` `# This code is contributed by ` `# Surendra_Gangwar ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the length ` `// of the transverse common tangent ` `// between two circles which ` `// do not touch each other ` `using` `System; ` ` ` `class` `GFG { ` ` ` `// Function to find the length ` ` ` `// of the transverse common tangent ` ` ` `static` `void` `lengthOfTangent(` `double` `r1, ` ` ` `double` `r2, ` `double` `d) ` ` ` `{ ` ` ` ` ` `Console.WriteLine(` `"The length of the transverse"` ` ` `+ ` `" common tangent is "` ` ` `+ Math.Sqrt(Math.Pow(d, 2) ` ` ` `- Math.Pow((r1 + r2), 2))); ` ` ` `} ` ` ` ` ` `// Driver code ` ` ` `static` `public` `void` `Main() ` ` ` `{ ` ` ` `double` `r1 = 4, r2 = 6, d = 12; ` ` ` `lengthOfTangent(r1, r2, d); ` ` ` `} ` `} ` ` ` `// This code has been contributed by ajit. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find the length ` `// of the transverse common tangent ` `// between two circles which ` `// do not touch each other ` ` ` `// Function to find the length ` `// of the transverse common tangent ` `function` `lengthOfTangent(` `$r1` `, ` `$r2` `, ` `$d` `) ` `{ ` ` ` ` ` `echo` `"The length of the transverse common tangent is "` `, ` ` ` `sqrt(pow(` `$d` `, 2) - pow((` `$r1` `+ ` `$r2` `), 2)) ; ` `} ` ` ` `// Driver code ` `$r1` `= 4; ` `$r2` `= 6; ` `$d` `= 12; ` `lengthOfTangent(` `$r1` `, ` `$r2` `, ` `$d` `); ` ` ` `// This code is contributed by AnkitRai01 ` `?> ` |

*chevron_right*

*filter_none*

**Output:**

The length of the transverse common tangent is 6.63325

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:

- Length of direct common tangent between the two non-intersecting Circles
- Ratio of the distance between the centers of the circles and the point of intersection of two transverse common tangents to the circles
- Length of direct common tangent between two intersecting Circles
- Length of the direct common tangent between two externally touching circles
- Distance between centers of two intersecting circles if the radii and common chord length is given
- Ratio of the distance between the centers of the circles and the point of intersection of two direct common tangents to the circles
- Radii of the three tangent circles of equal radius which are inscribed within a circle of given radius
- Radius of the inscribed circle within three tangent circles
- Number of common tangents between two circles if their centers and radius is given
- Count ways to divide circle using N non-intersecting chords
- Count ways to divide circle using N non-intersecting chord | Set-2
- Find the centroid of a non-self-intersecting closed Polygon
- Count ways to split array into K non-intersecting subsets
- Length of the perpendicular bisector of the line joining the centers of two circles
- Angle between a chord and a tangent when angle in the alternate segment is given
- Intersecting rectangle when bottom-left and top-right corners of two rectangles are given
- Program to calculate the area between two Concentric Circles
- Length of rope tied around three equal circles touching each other
- Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides
- Find Tangent at a given point on the curve

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.