What is the intersection of two lines?
We say that two lines in 2D or 3D space are intersecting if they cross each other. The intersecting lines can cross at one point only — this point is called the point of intersection. If two lines have more than one point in common, then these lines coincide (i.e., are the same). It’s also possible that two lines do not intersect at all.
Info
In 2D space, if two lines do not have a common point, then these lines are parallel. In 3D space, however, two non-parallel lines can have no point in common! To learn more, visit our parallel line calculator or its twin brother, the perpendicular line calculator.
Point of intersection of two lines — formula
Let us now discuss the formulas for the point of intersection of two lines in a plane.
Assume the lines are given in the slope-intercept form equations, i.e.:
𝑦=𝑎1𝑥+𝑏1𝑦=𝑎2𝑥+𝑏2y=a1x+b1y=a2x+b2
Then the point of intersection, (𝑥0,𝑦0)(x0,y0), is given by the formula:
𝑥0=𝑏2−𝑏1𝑎1−𝑎2𝑦0=𝑎1𝑏2−𝑏1𝑎1−𝑎2+𝑏1x0=a1−a2b2−b1y0=a1a1−a2b2−b1+b1
If, instead, the lines are given by the standard form equations as:
𝐴1𝑥+𝐵1𝑦+𝐶1=0𝐴2𝑥+𝐵2𝑦+𝐶2=0A1x+B1y+C1=0A2x+B2y+C2=0
then you can find the point of intersection (𝑥0,𝑦0)(x0,y0) using these formulae:
𝑥0=𝐵1𝐶2−𝐵2𝐶1𝐴1𝐵2−𝐴2𝐵1𝑦0=𝐶1𝐴2−𝐶2𝐴1𝐴1𝐵2−𝐴2𝐵1x0=A1B2−A2B1B1C2−B2C1y0=A1B2−A2B1C1A2−C2A1
Derivation
To better understand where these formulas come from, let us derive the first of them. Take the two slope-intercept forms and note that their 𝑦y-values are equal at the point of intersection. This leads to the following:
𝑎1𝑥0+𝑏1=𝑎2𝑥0+𝑏2a1x0+b1=a2x0+b2
which simplifies to:
(𝑎1−𝑎2)𝑥0=𝑏2−𝑏1(a1−a2)x0=b2−b1
We can now easily solve for 𝑥0x0, the 𝑥x-value at which the intersection occurs:
𝑥0=𝑏2−𝑏1𝑎1−𝑎2x0=a1−a2b2−b1
Once we have 𝑥0x0, we plug it into the first equation to get the corresponding 𝑦0y0:
𝑦0=𝑎1𝑥0+𝑏1=𝑎1(𝑏2−𝑏1𝑎1−𝑎2)+𝑏1y0=a1x0+b1=a1(a1−a2b2−b1)+b1
That’s it! As you can see, these formulas are not very short and simple, even if they are easy to derive. Fortunately, you can always use our intersection of two lines calculator!
In the next section, we’ll discuss how to find the intersection of two lines in 3D space.
Intersection of two lines in 3D with example
Assume we have the parametric equations for two lines in 3D space. For the first line, we have:
𝑥=𝑥1𝑡+𝑎1𝑦=𝑦1𝑡+𝑏1𝑧=𝑧1𝑡+𝑐1x=x1t+a1y=y1t+b1z=z1t+c1
and for the second, we have:
𝑥=𝑥2𝑠+𝑎2𝑦=𝑦2𝑠+𝑏2𝑧=𝑧2𝑠+𝑐2x=x2s+a2y=y2s+b2z=z2s+c2
The parameters are 𝑠,𝑡∈𝑅s,t∈R (i.e., they can be any real value) and thus both represent all possible points on their respective lines.
🙋 If you have two points on the line (𝑞1,𝑞2,𝑞3)(q1,q2,q3) and (𝑟1,𝑟2,𝑟3)(r1,r2,r3), the parametric equations of the line passing through them is:
𝑥=(𝑞1−𝑟1)𝑡+𝑟1x=(q1−r1)t+r1
𝑦=(𝑞2−𝑟2)𝑡+𝑟2y=(q2−r2)t+r2
𝑧=(𝑞3−𝑟3)𝑡+𝑟3z=(q3−r3)t+r3
To learn more, check out our line equation from two points calculator.
If these two lines have an intersection point, then the parameters 𝑡t and 𝑠s have some values (which we’ll specify as 𝑡0t0 and 𝑠0s0) that deliver the same point (𝑥0,𝑦0,𝑧0)(x0,y0,z0). In other words, the system of equations:
𝑥1𝑡0+𝑎1=𝑥2𝑠0+𝑎2𝑦1𝑡0+𝑏1=𝑦2𝑠0+𝑏2𝑧1𝑡0+𝑐1=𝑧2𝑠0+𝑐2x1t0+a1y1t0+b1z1t0+c1=x2s0+a2=y2s0+b2=z2s0+c2
which we may rewrite as:
𝑥1𝑡0−𝑥2𝑠0=𝑎2−𝑎1𝑦1𝑡0−𝑦2𝑠0=𝑏2−𝑏1𝑧1𝑡0−𝑧2𝑠0=𝑐2−𝑐1x1t0−x2s0y1t0−y2s0z1t0−z2s0=a2−a1=b2−b1=c2−c1
has the solution (𝑡0,𝑠0)(t0,s0). If there is no solution, our lines do not intersect.
Assume the solution (𝑡0,𝑠0)(t0,s0) exists. Be careful — this is not the intersection point yet! To find the intersection point, we must substitute 𝑡0t0 into the parametric equations for the first line or 𝑠0s0 into the equations for the second line.
It sounds complicated, but it’s not! The best way to understand how this method works is to see it in action. Let us go through an example together.
Example
Let’s find the intersection point of the following two lines:
First line:
Second line:
We write down the system:
and simplify it to:
Let’s solve it. We’ll do it by hand, but you can also use Omni’s system of equations calculator.
From the first equation, we get 𝑠=𝑡s=t, while from the third one, we have . Hence, as well. Therefore,
Let’s plug in into the equations for the first line:
Therefore, our lines intersect at the 3D point (9,11.5,4)(9,11.5,4). Don’t hesitate to test this example in our intersection of two lines calculator!
How to use this intersection of two lines calculator
This is how you can use our tool to get your results quickly and easily:
-
Tell us the dimension of your problem: is it 2D or 3D?
-
Enter the equations of your lines. In the case of 2D problems, you can choose between the slope-intercept form and the general form. For 3D problems, enter the parametric form.
-
The results appear immediately. Omni’s intersection of two lines calculator will display the coordinates of the intersection point, or it will warn you that the lines do not intersect.
-
If the latter happens, check carefully if you’ve entered the correct equations.
FAQ
How do I know if two lines in 2D intersect?
To determine if two lines in a plane intersect, check their slopes. If the slopes are different, then the lines intersect at a single unique point. If the slopes are equal, then compute the intercepts:
- If the intercepts are different, the lines are parallel and have no point in common.
- If the intercepts are equal, the lines coincide and have all points in common.
Do non-parallel lines always intersect in 3D?
No, two non-parallel lines in 3D space generally do not intersect. Such lines are called skew lines, and they do not lie in the same plane. In fact, two lines in 3D space can be:
- Intersecting at exactly one point;
- Parallel to each other (but not identical);
- Identical (and therefore also parallel); or
- Skew (neither parallel nor intersecting).
What is the intersection of lines y=x+3 and y=2x+1?
The answer is (2, 5). To arrive at this result, we solve the equation x + 3 = 2x + 1, which gives x = 2. Then we plug in x = 2 into y = x + 3 to get y = 5. So the point of intersection has the coordinates (x, y) = (2, 5), as claimed.