Given a straight line which passes through a given point (x0, y0) such that this point bisects the line segment in two equal line segments. The task is to find the equation of this straight line.
Input: x0 = 4, y0 = 3
Output: 3x + 4y = 24
Input: x0 = 7, y0 = 12
Output: 12x + 7y = 168
Let PQ be the line and AB be the line segment between the axes. The x-intercept and y-intercept are a & b respectively.
Now, as C(x0, y0) bisects AB so,
x0 = (a + 0) / 2 i.e. a = 2x0
Similiarly, y0 = (0 + b) / 2 i.e. b = 2y0
We know that the equation of a straight line in intecept form is,
x / a + y / b = 1
Here, a = 2x0 & b = 2y0
So, x / 2x0 + y / 2y0 = 1
or, x / x0 + y / y0 = 2
Therefore, x * y0 + y * x0 = 2 * x0 * y0
Below is the implementation of the above approach:
3x + 4y = 24
- Given n line segments, find if any two segments intersect
- Represent a given set of points by the best possible straight line
- Length of the normal from origin on a straight line whose intercepts are given
- Area of triangle formed by the axes of co-ordinates and a given straight line
- Find X and Y intercepts of a line passing through the given points
- How to check if two given line segments intersect?
- Maximum possible intersection by moving centers of line segments
- Number of horizontal or vertical line segments to connect 3 points
- Reflection of a point about a line in C++
- Perpendicular distance between a point and a Line in 2 D
- Check whether the point (x, y) lies on a given line
- Shortest distance between a Line and a Point in a 3-D plane
- Program to delete a line given the line number from a file
- Minimum distance from a point to the line segment using Vectors
- Section formula (Point that divides a line in given ratio)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.