Given three lines equation,
a1x + b1y + c1 = 0
a2x + b2y + c2 = 0
a3x + b3y + c3 = 0
The task is to check whether the given three lines are concurrent or not. Three straight lines are said to be concurrent if they pass through a point i.e., they meet at a point.
Input : a1 = 2, b1 = -3, c1 = 5 a2 = 3, b2 = 4, c2 = -7 a3 = 9, b3 = -5, c3 = 8 Output : Yes Input : a1 = 2, b1 = -3, c1 = 5 a2 = 3, b2 = 4, c2 = -7 a3 = 9, b3 = -5, c3 = 4 Output : No
a1x + b1y + c1 = 0 ………. (1)
a2x + b2y + c2 = 0 ………. (2)
a3x + b3y + c3 = 0 ………. (3)
Suppose the eqn (i) and (ii) intersets at (x1, y1). Then (x1, y1) will satisfy bothe equations.
Therefore, solving (i) and (ii) using method of cross-multiplication, we get,
(x1/b1c2 – b2c1) = (y1/c1a2 – c2a1) = (1/a1b2 – a2b1)
x1 = (b1c2 – b2c1/a1b2 – a2b1) and
y1 = (c1a2 – c2a1/a1b2 – a2b1), a1b2 – a2b1 != 0
Therefore, the required coodinates of the point of intersection of the lines (i) and (ii) are
(b1c2 – b2c1/a1b2 – a2b1, c1a2 – c2a1/a1b2 – a2b1)
For, three of line to be concurrent, (x1, y1) must satisfy the equation (iii) as well.
a3x + b3y + c3 = 0
=> a3(b1c2 – b2c1/a1b2 – a2b1) + b3(c1a2 – c2a1/a1b2 – a2b1) + c3 = 0
=> a3(b1c2 – b2c1) + b3(c1a2 – c2a1) + c3(a1b2 – a2b1) = 0
So, we only need to check if above condition satisfy or not.
Below is the implemenatation of this approach:
- Check whether two straight lines are orthogonal or not
- Check if given two straight lines are identical or not
- Count of different straight lines with total n points with m collinear
- Check if it is possible to draw a straight line with the given direction cosines
- 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
- Distance between two parallel lines
- Maximum points of intersection n lines
- Program for Point of Intersection of Two Lines
- Minimum lines to cover all points
- Equation of straight line passing through a given point which bisects it into two equal line segments
- Non-crossing lines to connect points in a circle
- Number of triangles formed from a set of points on three lines
- Find whether only two parallel lines contain all coordinates points or not
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.