# Find the other-end coordinates of diameter in a circle

Given Center coordinate (c1, c2) and one coordinate (x1, y1) of the diameter of a circle, find the other end coordinate point (x2, y2) of diameter.

Examples:

Input : x1 = –1, y1 = 2, and c1 = 3, c2 = –6 Output : x2 = 7, y2 = -14 Input : x1 = 6.4, y1 = 3 and c1 = –10.7, c2 = 4 Output : x2 = -27.8, y2 = 5

**The Midpoint Formula: **

The midpoint of two ends coordinates points, (x1, y2) and (x2, y2) is the point M can be found by using:

We have need of a (x2, y2) cordinates so we apply the midpoint the formula

c_{1}= ((x_{1}+x_{2})/2), c2 = ((y_{1}+y_{2})/2) 2*c_{1}= (x_{1}+x_{2}), 2*c2 = (y_{1}+y_{2})x_{2}= (2*c_{1}- x_{1}), y_{2}= (2*c_{2}- y_{1})

## C++

`// CPP program to find the ` `// other-end point of diameter ` `#include <iostream> ` `using` `namespace` `std; ` ` ` `// function to find the ` `// other-end point of diameter ` `void` `endPointOfDiameterofCircle(` `int` `x1, ` ` ` `int` `y1, ` `int` `c1, ` `int` `c2) ` `{ ` ` ` `// find end point for x cordinates ` ` ` `cout << ` `"x2 = "` ` ` `<< (` `float` `)(2 * c1 - x1)<< ` `" "` `; ` ` ` ` ` `// find end point for y cordinates ` ` ` `cout << ` `"y2 = "` `<< (` `float` `)(2 * c2 - y1); ` ` ` `} ` `// Driven Program ` `int` `main() ` `{ ` ` ` `int` `x1 = -4, y1 = -1; ` ` ` `int` `c1 = 3, c2 = 5; ` ` ` ` ` `endPointOfDiameterofCircle(x1, y1, c1, c2); ` ` ` ` ` `return` `0; ` `} ` |

*chevron_right*

*filter_none*

## Java

`// Java program to find the other-end point of ` `// diameter ` `import` `java.io.*; ` ` ` `class` `GFG { ` ` ` ` ` `// function to find the other-end point of ` ` ` `// diameter ` ` ` `static` `void` `endPointOfDiameterofCircle(` `int` `x1, ` ` ` `int` `y1, ` `int` `c1, ` `int` `c2) ` ` ` `{ ` ` ` ` ` `// find end point for x cordinates ` ` ` `System.out.print( ` `"x2 = "` ` ` `+ (` `2` `* c1 - x1) + ` `" "` `); ` ` ` ` ` `// find end point for y cordinates ` ` ` `System.out.print(` `"y2 = "` `+ (` `2` `* c2 - y1)); ` ` ` `} ` ` ` ` ` `// Driven Program ` ` ` `public` `static` `void` `main (String[] args) ` ` ` `{ ` ` ` `int` `x1 = -` `4` `, y1 = -` `1` `; ` ` ` `int` `c1 = ` `3` `, c2 = ` `5` `; ` ` ` ` ` `endPointOfDiameterofCircle(x1, y1, c1, c2); ` ` ` `} ` `} ` ` ` `// This code is contributed by anuj_67. ` |

*chevron_right*

*filter_none*

## Python 3

`# Python3 program to find the ` `# other-end point of diameter ` ` ` `# function to find the ` `# other-end point of diameter ` `def` `endPointOfDiameterofCircle(x1, y1, c1, c2): ` ` ` ` ` `# find end point for x cordinates ` ` ` `print` `(` `"x2 ="` `, (` `2` `*` `c1 ` `-` `x1), end` `=` `" "` `) ` ` ` ` ` `# find end point for y cordinates ` ` ` `print` `(` `"y2 ="` `, (` `2` `*` `c2 ` `-` `y1)) ` ` ` `# Driven Program ` `x1 ` `=` `-` `4` `y1 ` `=` `-` `1` `c1 ` `=` `3` `c2 ` `=` `5` ` ` `endPointOfDiameterofCircle(x1, y1, c1, c2) ` ` ` `# This code is contributed by Smitha. ` |

*chevron_right*

*filter_none*

## C#

`// C# program to find the other - ` `// end point of diameter ` `using` `System; ` `class` `GFG { ` ` ` ` ` `// function to find the other - end ` ` ` `// point of diameter ` ` ` `static` `void` `endPointOfDiameterofCircle(` `int` `x1, ` ` ` `int` `y1, ` ` ` `int` `c1, ` ` ` `int` `c2) ` ` ` `{ ` ` ` `// find end point for x cordinates ` ` ` `Console.Write(` `"x2 = "` `+ (2 * c1 - x1) + ` `" "` `); ` ` ` ` ` `// find end point for y cordinates ` ` ` `Console.Write(` `"y2 = "` `+ (2 * c2 - y1)); ` ` ` `} ` ` ` ` ` `// Driver Code ` ` ` `public` `static` `void` `Main () ` ` ` `{ ` ` ` `int` `x1 = -4, y1 = -1; ` ` ` `int` `c1 = 3, c2 = 5; ` ` ` ` ` `endPointOfDiameterofCircle(x1, y1, c1, c2); ` ` ` `} ` `} ` ` ` `// This code is contributed by anuj_67. ` |

*chevron_right*

*filter_none*

## PHP

`<?php ` `// PHP program to find the ` `// other-end point of diameter ` ` ` `// function to find the ` `// other-end point of diameter ` `function` `endPointOfDiameterofCircle(` `$x1` `, ` ` ` `$y1` `, ` `$c1` `, ` `$c2` `) ` `{ ` ` ` `// find end point for x cordinates ` ` ` `echo` `"x2 = "` `,(2 * ` `$c1` `- ` `$x1` `),` `" "` `; ` ` ` ` ` `// find end point for y cordinates ` ` ` `echo` `"y2 = "` `, (2 * ` `$c2` `- ` `$y1` `); ` `} ` ` ` `// Driven Program ` `$x1` `= -4; ` `$y1` `= -1; ` `$c1` `= 3; ` `$c2` `= 5; ` ` ` `endPointOfDiameterofCircle(` `$x1` `, ` `$y1` `, ` ` ` `$c1` `, ` `$c2` `); ` ` ` `// This code is contributed by Smitha ` `?> ` |

*chevron_right*

*filter_none*

**Output**

x2 = 10 y2 = 11

** Similarly if we given a center (c1, c2) and other end codrdinate (x2, y2) of a diameter and we finding a (x1, y1) cordinates **

Proof for (x1, y1) :c1 = ((x1+x2)/2), c2 = ((y1+y2)/2) 2*c1 = (x1+x2), 2*c2 = (y1+y2) x1 = (2*c1 - x2), y1 = (2*c2 - y2)

**So The other end coordinates (x1, y1) of a diameter is **

x1 = (2*c1 - x2), y1 = (2*c2 - y2)

## Recommended Posts:

- Find the Diameter or Longest chord of a Circle
- Find the center of the circle using endpoints of diameter
- Find all possible coordinates of parallelogram
- Length of the chord the circle if length of the another chord which is equally inclined through the diameter is given
- Find coordinates of the triangle given midpoint of each side
- Find the original coordinates whose Manhattan distances are given
- Find whether only two parallel lines contain all coordinates points or not
- Find minimum area of rectangle with given set of coordinates
- Find area of the larger circle when radius of the smaller circle and difference in the area is given
- Program to find the diameter, cycles and edges of a Wheel Graph
- Find coordinates of a prime number in a Prime Spiral
- Program to find Circumference of a Circle
- Program to find area of a circle
- Program to calculate area of inner circle which passes through center of outer circle and touches its circumference
- Given equation of a circle as string, find area

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.