# Python | Sympy Segment.perpendicular_bisector() method

In Sympy, the function `perpendicular_bisector()` is used to find the perpendicular bisector of the given segment. If no point is specified or the point specified is not on the bisector then the bisector is returned as a Line. Otherwise, a Segment is returned that joins the point specified and the intersection of the bisector and the segment.

```Syntax: Segment.perpendicular_bisector(p=None)

Parameters:
p: Point

Returns:
bisector: Line or Segment
```

Example #1:

 `# import sympy and Point, Segment ` `from` `sympy ``import` `Point, Segment ` ` `  `p1, p2, p3 ``=` `Point(``0``, ``0``), Point(``6``, ``6``), Point(``5``, ``1``) ` `s1 ``=` `Segment(p1, p2) ` ` `  `# using perpendicular_bisector() method ` `perpendicularBisector ``=` `s1.perpendicular_bisector() ` ` `  `print``(perpendicularBisector) `

Output:

`Line2D(Point2D(3, 3), Point2D(-3, 9))`

Example #2:

 `# import sympy and Point, Segment ` `from` `sympy ``import` `Point, Segment ` ` `  `p1, p2, p3 ``=` `Point(``0``, ``0``), Point(``6``, ``6``), Point(``5``, ``1``) ` `s1 ``=` `Segment(p1, p2) ` ` `  `# using perpendicular_bisector() method ` `perpendicularBisector ``=` `s1.perpendicular_bisector(p3) ` ` `  `print``(perpendicularBisector) `

Output:

`Segment2D(Point2D(5, 1), Point2D(3, 3))`
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.