Intersection of Two Lines Calculator
Find where two lines cross. Enter them as y = mx + c or as Ax + By = C, and get the point, the angle between them, and a substitution check.
Intersection of Two Lines Calculator
Background.
Two straight lines in a plane do one of exactly three things: they cross at a single point, they never meet, or they are the same line wearing two different equations. This calculator handles all three and, crucially, tells you which one you have rather than returning a plausible-looking number in the cases where no single answer exists. Enter y = 2x + 1 and y = −x + 7 and it returns the crossing point (2, 5), the acute angle between them, and a substitution check on each equation so you can confirm the answer without redoing the algebra.
There are two ways to type the lines in, and the choice matters more than it first appears. Slope-intercept form, y = m·x + c, is how lines are written in almost every algebra class, and it is the natural choice when you already know a slope and an intercept. But it cannot describe a vertical line: x = 3 has no slope, and forcing it into y = m·x + c requires an infinite m. Standard form, A·x + B·y = C, has no such gap — a vertical line is simply one with B = 0, and x = 3 is written 1·x + 0·y = 3. If either of your lines is vertical, switch to standard form; the calculator converts slope-intercept input into standard form internally anyway, so both modes run through the same solver and give the same answer for any line both can express.
The method is Cramer's rule, published by Gabriel Cramer in 1750 and still the fastest hand method for a two-by-two system. Write the two equations in standard form, compute the determinant A₁B₂ − A₂B₁, and the coordinates fall out as two more determinants divided by it. What makes the rule useful beyond the arithmetic is that the determinant itself is the diagnostic: it is zero precisely when the lines are parallel or identical, and non-zero precisely when a unique intersection exists. That single number decides which of the three outcomes you are in before you compute anything else.
When the determinant is zero, the calculator does not return infinity, NaN, or a blank field — it raises a specific error that distinguishes the two cases, because they are genuinely different situations rather than one failure. Parallel lines with different intercepts have no solution at all: there is no point on both. Identical lines have infinitely many solutions, since every point of the line satisfies both equations. Textbooks call these an inconsistent system and a dependent system respectively, and the distinction matters as soon as you move from two variables to three.
The angle output is the acute angle between the lines, always reported between 0° and 90°. Two crossing lines actually create two pairs of angles that sum to 180°, and quoting the acute one is the standard convention. It is computed from the two lines' normal vectors rather than from their slopes, which is a deliberate choice: the slope-based formula tan θ = |(m₂ − m₁) ⁄ (1 + m₁m₂)| breaks down at exactly the cases you most want it to handle — it divides by zero when the lines are perpendicular, and it cannot be evaluated at all for a vertical line. The normal-vector formula has no such gaps and returns exactly 90° for perpendicular lines, including a vertical-and-horizontal pair.
The two check outputs are worth using. They substitute the solved point back into each original equation, so A₁x + B₁y should reproduce C₁ and A₂x + B₂y should reproduce C₂. If either one does not, the coefficients entered are not the ones intended. Every calculation runs in arbitrary-precision decimal arithmetic and is rounded only once, at the point the answer is returned, so the checks hold exactly rather than approximately for well-conditioned input.
What is intersection of two lines calculator?
The intersection of two lines is the set of points lying on both of them, which for two distinct non-parallel lines in a plane is exactly one point. Finding it is the same problem as solving a system of two linear equations in two unknowns, because a point (x, y) lies on a line precisely when its coordinates satisfy that line's equation. The system has a unique solution when the coefficient determinant A₁B₂ − A₂B₁ is non-zero; it is inconsistent (no solution) when the determinant is zero and the lines are distinct; and it is dependent (infinitely many solutions) when the two equations describe the same line. Those three cases correspond exactly to two lines crossing, running parallel, and coinciding.
How to use this calculator.
- Choose the form your lines are written in. Use standard form A·x + B·y = C if either line is vertical, because slope-intercept form cannot represent one.
- In slope-intercept mode, enter the slope and y-intercept of each line. The six standard-form fields are ignored.
- In standard mode, enter A, B and C for each line. For a vertical line x = 3, that is A = 1, B = 0, C = 3. For a horizontal line y = −2, it is A = 0, B = 1, C = −2. The four slope-intercept fields are ignored.
- Read the crossing point at the top. If the lines are parallel or identical you will get an explicit message instead, saying which of the two it is.
- Confirm the answer with the two check outputs: A₁x + B₁y should equal C₁, and A₂x + B₂y should equal C₂.
- Read the angle if you need it. It is the acute angle, always between 0° and 90°, and it reads exactly 90° when the lines are perpendicular.
The formula.
Both input forms are reduced to A·x + B·y = C before anything is solved. The conversion from slope-intercept is one rearrangement: y = m·x + c becomes m·x − y = −c, so A = m, B = −1 and C = −c. That is why one solver serves both modes, and why the answer is identical whichever mode you use for a line both can express.
Cramer's rule then solves the pair. The coefficient determinant is D = A₁B₂ − A₂B₁. Replacing the x-column with the constants gives Dₓ = C₁B₂ − C₂B₁, and replacing the y-column gives D_y = A₁C₂ − A₂C₁. When D is not zero, x = Dₓ ⁄ D and y = D_y ⁄ D. This is exactly the elimination method you would do by hand, with the bookkeeping written as determinants.
When D is zero the rule cannot be applied, and the reason is geometric rather than arithmetic: D = 0 means the two normal vectors are parallel, so the lines themselves are parallel. The system is still consistent in one sub-case — when Dₓ and D_y are also zero, the two equations are scalar multiples of one another and describe the same line, giving infinitely many solutions. Otherwise the lines are parallel and distinct, and there is no solution at all. The calculator tests exactly that and raises two different, specific errors, because reporting 'no answer' for a pair of identical lines would be wrong in a way that matters.
The determinant reported alongside the answer is the determinant of the matrix as you entered it, and its magnitude is not a property of the geometry. Scaling one equation by ten — writing 20x − 10y = −10 instead of 2x − y = −1 — describes the identical line but multiplies the determinant by ten. Only whether the determinant is zero is scale-independent, and that is the only thing the calculator uses it for.
The angle uses normal vectors deliberately. The familiar slope formula tan θ = |(m₂ − m₁) ⁄ (1 + m₁m₂)| fails in two places: the denominator is zero exactly when the lines are perpendicular, which is the case people most often want, and the formula cannot be evaluated at all when either line is vertical. Taking the angle between the normals n₁ = (A₁, B₁) and n₂ = (A₂, B₂) through cos θ = |n₁·n₂| ⁄ (‖n₁‖‖n₂‖) has neither problem. The absolute value in the numerator is what makes the result acute: without it, reversing the sign of one equation — which does not change the line — would return the supplementary angle instead. Perpendicularity is then the clean test A₁A₂ + B₁B₂ = 0, which is equivalent to m₁·m₂ = −1 when both slopes exist and remains correct when one line is vertical.
All arithmetic runs in arbitrary-precision decimal, and rounding to ten decimal places happens once, at the return boundary. Negative zero is normalised to zero so an intersection at the origin reads (0, 0) rather than (-0, -0).
A worked example.
Find where y = 2x + 1 and y = −x + 7 cross. By hand, set the two right-hand sides equal: 2x + 1 = −x + 7, so 3x = 6 and x = 2. Substituting back into either equation gives y = 2(2) + 1 = 5, or equally y = −2 + 7 = 5. The crossing point is (2, 5). Now the same problem the way the calculator does it. Converting to standard form, y = 2x + 1 becomes 2x − y = −1, so A₁ = 2, B₁ = −1, C₁ = −1. And y = −x + 7 becomes −x − y = −7, so A₂ = −1, B₂ = −1, C₂ = −7. The coefficient determinant is D = A₁B₂ − A₂B₁ = 2(−1) − (−1)(−1) = −2 − 1 = −3. It is not zero, so a unique intersection exists. The x-determinant is Dₓ = C₁B₂ − C₂B₁ = (−1)(−1) − (−7)(−1) = 1 − 7 = −6, giving x = −6 ⁄ −3 = 2. The y-determinant is D_y = A₁C₂ − A₂C₁ = 2(−7) − (−1)(−1) = −14 − 1 = −15, giving y = −15 ⁄ −3 = 5. Both match the hand solution. The checks confirm it: A₁x + B₁y = 2(2) − 1(5) = −1, which is C₁, and A₂x + B₂y = −1(2) − 1(5) = −7, which is C₂. The angle comes from the normal vectors n₁ = (2, −1) and n₂ = (−1, −1). Their dot product is 2(−1) + (−1)(−1) = −1, whose absolute value is 1. The magnitudes are √5 and √2, so cos θ = 1 ⁄ √10 ≈ 0.3162277660 and θ ≈ 71.5650511771°. That agrees with the slope-based check arctan(3) = 71.5650511771°, since tan θ = |(−1 − 2) ⁄ (1 + 2(−1))| = |−3 ⁄ −1| = 3. The lines are not perpendicular, and the perpendicularity flag reads 0 because A₁A₂ + B₁B₂ = −2 + 1 = −1, not 0. One note on the determinant. Entering these same two lines in standard mode as 2x − y = −1 and x + y = 7 — the more usual way to write the second one — gives a determinant of +3 rather than −3, while the point and the angle come out identical. That is the scaling effect: the determinant's sign and size depend on how each equation happens to be written, and only its being zero or non-zero is a fact about the geometry.
Frequently asked questions.
How do you find the intersection of two lines?
What if the two lines are parallel?
What if I enter the same line twice?
How do I enter a vertical line?
How is the angle between two lines calculated?
Why does the determinant change when I rewrite the same equation?
When are two lines perpendicular?
References& sources.
- [1]OpenStax. College Algebra 2e, §7.1 "Systems of Linear Equations: Two Variables" — the three outcomes for a two-variable linear system (one solution, no solution / inconsistent, infinitely many / dependent) and the substitution and elimination methods. Open access.
- [2]Dawkins, Paul. "Linear Systems with Two Variables." Paul's Online Math Notes, Lamar University Department of Mathematics — worked elimination and the geometric reading of the three cases. Open access.
- [3]Weisstein, Eric W. "Line-Line Intersection." MathWorld — Wolfram Research. The determinant form of the two-line intersection point. Retrieved 2026-07-29.
- [4]Cramer, Gabriel. Introduction à l'analyse des lignes courbes algébriques. Geneva: Frères Cramer & Cl. Philibert, 1750, Appendix I — the original statement of the determinant rule for solving linear systems. Bibliographic reference; not retrieved during authoring.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 977 calculators remain free
- No billing is enabled