The point of intersection of two straight lines according to the equations. Equations of a plane and a straight line

Using this online calculator you can find the point of intersection of lines on a plane. A detailed solution with explanations is given. To find the coordinates of the point of intersection of lines, set the type of equation of lines ("canonical", "parametric" or "general"), enter the coefficients of the equations of lines in the cells and click on the "Solve" button. See the theoretical part and numerical examples below.

×

Warning

Clear all cells?

Close Clear

Data entry instructions. Numbers are entered as integers (examples: 487, 5, -7623, etc.), decimals (ex. 67., 102.54, etc.) or fractions. The fraction must be entered in the form a/b, where a and b (b>0) are integers or decimals. Examples 45/5, 6.6/76.4, -7/6.7, etc.

The point of intersection of lines on a plane - theory, examples and solutions

1. The point of intersection of lines given in general form.

Oxy L 1 and L 2:

Let's build an extended matrix:

If B" 2 =0 and WITH" 2 =0, then the system of linear equations has many solutions. Therefore straight L 1 and L 2 match. If B" 2 =0 and WITH" 2 ≠0, then the system is inconsistent and, therefore, the lines are parallel and do not have a common point. If B" 2 ≠0, then the system of linear equations has a unique solution. From the second equation we find y: y=WITH" 2 /B" 2 and substituting the resulting value into the first equation we find x: x=−WITH 1 −B 1 y. We got the point of intersection of the lines L 1 and L 2: M(x, y).

2. The point of intersection of lines given in canonical form.

Let a Cartesian rectangular coordinate system be given Oxy and let straight lines be given in this coordinate system L 1 and L 2:

Let's open the brackets and make the transformations:

Using a similar method, we obtain the general equation of the straight line (7):

From equations (12) it follows:

How to find the intersection point of lines given in canonical form is described above.

4. The point of intersection of lines specified in different views.

Let a Cartesian rectangular coordinate system be given Oxy and let straight lines be given in this coordinate system L 1 and L 2:

We'll find t:

A 1 x 2 +A 1 mt+B 1 y 2 +B 1 pt+C 1 =0,

Let us solve the system of linear equations with respect to x, y. To do this, we will use the Gaussian method. We get:

Example 2. Find the point of intersection of lines L 1 and L 2:

L 1: 2x+3y+4=0, (20)
(21)

To find the point of intersection of lines L 1 and L 2 you need to solve the system of linear equations (20) and (21). Let us present the equations in matrix form.

Intersection point

Let us be given two straight lines, defined by their coefficients and . You need to find their point of intersection, or find out that the lines are parallel.

Solution

If two lines are not parallel, then they intersect. To find the intersection point, it is enough to create a system of two straight line equations and solve it:

Using Cramer’s formula, we immediately find a solution to the system, which will be the desired one intersection point:



If the denominator is zero, i.e.

then the system has no solutions (direct parallel and do not coincide) or has infinitely many (direct match). If it is necessary to distinguish between these two cases, it is necessary to check that the coefficients of the lines are proportional with the same coefficient of proportionality as the coefficients and , for which it is enough to calculate the two determinants; if they are both equal to zero, then the lines coincide:

Implementation

struct pt(double x, y;); struct line(double a, b, c;); constdouble EPS =1e-9; double det (double a, double b, double c, double d)(return a * d - b * c;) bool intersect (line m, line n, pt & res)(double zn = det (m.a, m.b, n.a , n.b);if(abs(zn)< EPS)returnfalse; res.x=- det (m.c, m.b, n.c, n.b)/ zn; res.y=- det (m.a, m.c, n.a, n.c)/ zn;returntrue;} bool parallel (line m, line n){returnabs(det (m.a, m.b, n.a, n.b))< EPS;} bool equivalent (line m, line n){returnabs(det (m.a, m.b, n.a, n.b))< EPS &&abs(det (m.a, m.c, n.a, n.c))< EPS &&abs(det (m.b, m.c, n.b, n.c))< EPS;}

Lesson from the series “ Geometric algorithms»

Hello dear reader.

Tip 1: How to find the coordinates of the point of intersection of two lines

Let's write three more new functions.

The LinesCross() function will determine whether intersect whether two segment. In it, the relative position of the segments is determined using vector products. To calculate vector products, we will write a function – VektorMulti().

The RealLess() function will be used to implement the comparison operation “<” (строго меньше) для вещественных чисел.

Task 1. Two segments are given by their coordinates. Write a program that determines do these segments intersect? without finding the intersection point.

Solution
. The second is given by dots.



Consider the segment and points and .

The point lies to the left of the line, for it the vector product > 0, since the vectors are positively oriented.

The point is located to the right of the line, for which the vector product is< 0, так как векторы отрицательно ориентированы.

In order for the points and to lie on opposite sides of the straight line, it is sufficient that the condition be satisfied< 0 (векторные произведения имели противоположные знаки).

Similar reasoning can be carried out for the segment and points and .

So if , then the segments intersect.

To check this condition, the LinesCross() function is used, and the VektorMulti() function is used to calculate vector products.

ax, ay – coordinates of the first vector,

bx, by – coordinates of the second vector.

Program geometr4; (Do 2 segments intersect?) Const _Eps: Real=1e-4; (calculation accuracy) var x1,y1,x2,y2,x3,y3,x4,y4: real; var v1,v2,v3,v4: real;function RealLess(Const a, b: Real): Boolean; (Strictly less than) begin RealLess:= b-a> _Eps end; (RealLess)function VektorMulti(ax,ay,bx,by:real): real; (ax,ay - a coordinates bx,by - b coordinates) begin vektormulti:= ax*by-bx*ay; end;Function LinesCross(x1,y1,x2,y2,x3,y3,x4,y4:real): boolean; (Do the segments intersect?) begin v1:=vektormulti(x4-x3,y4-y3,x1-x3,y1-y3); v2:=vektormulti(x4-x3,y4-y3,x2-x3,y2-y3); v3:=vektormulti(x2-x1,y2-y1,x3-x1,y3-y1); v4:=vektormulti(x2-x1,y2-y1,x4-x1,y4-y1); if RealLess(v1*v2,0) and RealLess(v3*v4,0) (v1v2<0 и v3v4<0, отрезки пересекаются} then LinesCross:= true else LinesCross:= false end; {LinesCross}begin {main} writeln(‘Введите координаты отрезков: x1,y1,x2,y2,x3,y3,x4,y4’); readln(x1,y1,x2,y2,x3,y3,x4,y4); if LinesCross(x1,y1,x2,y2,x3,y3,x4,y4) then writeln (‘Да’) else writeln (‘Нет’) end.

Program execution results:

Enter the coordinates of the segments: -1 1 2 2.52 2 1 -1 3
Yes.

We wrote a program that determines whether segments specified by their coordinates intersect.

In the next lesson we will create an algorithm that can be used to determine whether a point lies inside a triangle.

Dear reader.

You have already become acquainted with several lessons from the Geometric Algorithms series. Is everything written in an accessible way? I will be very grateful if you leave feedback about these lessons. Perhaps something still needs to be improved.

Sincerely, Vera Gospodarets.

Let two segments be given. The first one is given by dots P 1 (x 1 ;y 1) And P 2 (x 2 ;y 2). The second one is given by points P 3 (x 3 ;y 3) And P 4 (x 4 ;y 4).

The relative position of the segments can be checked using vector products:

Consider the segment P 3 P 4 and dots P 1 And P2.

Dot P 1 lies to the left of the line P 3 P 4, for her the vector product v 1 > 0, since the vectors are positively oriented.
Dot P2 located to the right of the line, for it the vector product v 2< 0 , since the vectors are negatively oriented.

To make the point P 1 And P2 lay on opposite sides of a straight line P 3 P 4, it is sufficient for the condition to be satisfied v 1 v 2< 0 (the vector products had opposite signs).

Similar reasoning can be carried out for the segment P 1 P 2 and points P 3 And P 4.

So if v 1 v 2< 0 And v 3 v 4< 0 , then the segments intersect.

The cross product of two vectors is calculated using the formula:

Where:
ax, ay— coordinates of the first vector,
bx, by— coordinates of the second vector.

Equation of a line passing through two different points specified by their coordinates.

Let two non-coinciding points be given on a straight line: P 1 with coordinates ( x 1 ;y 1) And P2 with coordinates (x 2 ; y 2).

Intersection of lines

Accordingly, a vector with origin at the point P 1 and end at a point P2 has coordinates (x 2 -x 1 , y 2 -y 1). If P(x, y) is an arbitrary point on a line, then the coordinates of the vector P 1 P equal (x - x 1, y - y 1).

Using the vector product, the condition for collinearity of vectors P 1 P And P 1 P 2 can be written like this:
|P 1 P,P 1 P 2 |=0, i.e. (x-x 1)(y 2 -y 1)-(y-y 1)(x 2 -x 1)=0
or
(y 2 -y 1)x + (x 1 -x 2)y + x 1 (y 1 -y 2) + y 1 (x 2 -x 1) = 0

The last equation is rewritten as follows:
ax + by + c = 0, (1)
Where
a = (y 2 -y 1),
b = (x 1 -x 2),
c = x 1 (y 1 -y 2) + y 1 (x 2 -x 1)

So, the straight line can be specified by an equation of the form (1).

How to find the point of intersection of lines?
The obvious solution is to solve the system of line equations:

ax 1 +by 1 =-c 1
ax 2 +by 2 =-c 2
(2)

Enter symbols:

Here D is the determinant of the system, and Dx,Dy— determinants resulting from replacing the column of coefficients with the corresponding unknown with a column of free terms. If D ≠ 0, then system (2) is definite, that is, it has a unique solution. This solution can be found using the following formulas: x 1 =D x /D, y 1 =D y /D, which are called Cramer's formulas. A quick reminder of how the second-order determinant is calculated. The determinant distinguishes two diagonals: the main and the secondary. The main diagonal consists of elements taken in the direction from the upper left corner of the determinant to the lower right corner. Side diagonal - from the upper right to the lower left. The second-order determinant is equal to the product of the elements of the main diagonal minus the product of the elements of the secondary diagonal.

In the old days, I was interested in computer graphics, both 2D and 3D, including mathematical visualizations. What is called just for fun, as a student, I wrote a program that visualizes N-dimensional figures rotating in any dimensions, although practically I was only able to determine the points for a 4-D hypercube. But this is just a saying. My love for geometry has remained with me from then to this day, and I still love solving interesting problems in interesting ways.
I came across one of these problems in 2010. The task itself is quite trivial: you need to find whether two 2-D segments intersect, and if they do, find the point of their intersection. A more interesting solution is one that, I think, turned out to be quite elegant, and which I want to offer to the reader. I don’t claim the originality of the algorithm (although I would like to), but I couldn’t find similar solutions on the Internet.
Task
Given two segments, each of which is defined by two points: (v11, v12), (v21, v22). It is necessary to determine whether they intersect, and if they intersect, find the point of their intersection.
Solution
First you need to determine whether the segments intersect. The necessary and sufficient condition for intersection that must be met for both segments is the following: the end points of one of the segments must lie in different half-planes if the plane is divided by a line on which the second of the segments lies. Let's demonstrate this with a drawing.

The left figure (1) shows two segments, for both of which the condition is met, and the segments intersect. In the right (2) figure, the condition is met for segment b, but for segment a it is not met, and accordingly the segments do not intersect.
It may seem that determining which side of the line a point lies on is a non-trivial task, but fear has big eyes, and everything is not so difficult. We know that vector multiplication of two vectors gives us a third vector, the direction of which depends on whether the angle between the first and second vector is positive or negative, respectively, such an operation is anticommutative. And since all the vectors lie on the X-Y plane, their vector product (which must be perpendicular to the vectors being multiplied) will only have a non-zero component Z, and accordingly, the difference between the products of vectors will only be in this component. Moreover, when changing the order of multiplication of vectors (read: the angle between the multiplied vectors), it will consist solely in changing the sign of this component.
Therefore, we can multiply the vector of the dividing segment in pairs by vectors directed from the beginning of the dividing segment to both points of the segment being checked.

If the Z components of both products have a different sign, then one of the angles is less than 0 but greater than -180, and the second is greater than 0 and less than 180, respectively, the points lie on opposite sides of the line. If the Z components of both products have the same sign, therefore they lie on the same side of the line.
If one of the components of Z is zero, then we have a borderline case when the point lies exactly on the line being tested. Let's leave it to the user to determine if they want to consider this an intersection.
Then we need to repeat the operation for another segment and line, and make sure that the location of its end points also satisfies the condition.
So, if everything is fine and both segments satisfy the condition, then the intersection exists. Let's find it, and the vector product will also help us with this.
Since in the vector product we only have a non-zero component Z, then its modulus (vector length) will be numerically equal to exactly this component. Let's see how to find the intersection point.

The length of the vector product of vectors a and b (as we found out, is numerically equal to its component Z) is equal to the product of the absolute values ​​of these vectors and the sine of the angle between them (|a| |b| sin(ab)). Accordingly, for the configuration in the figure we have the following: |AB x AC| = |AB||AC|sin(α), and |AB x AD| = |AB||AD| sin(β). |AC|sin(α) is a perpendicular from point C to segment AB, and |AD|sin(β) is a perpendicular from point D to segment AB (leg ADD"). Since angles γ and δ are vertical angles, then they are equal, which means the triangles PCC" and PDD" are similar, and accordingly the lengths of all their sides are proportional in equal proportions.
Having Z1 (AB x AC, which means |AB||AC|sin(α)) and Z2 (AB x AD, which means |AB||AD|sin(β)), we can calculate CC"/DD" ( which will be equal to Z1/Z2), and also knowing that CC"/DD" = CP/DP, you can easily calculate the location of point P. Personally, I do it as follows:

Px = Cx + (Dx-Cx)*|Z1|/|Z2-Z1|;
Py = Cy + (Dy-Cy)*|Z1|/|Z2-Z1|;

That's all. I think it's really very simple and elegant. In conclusion, I would like to provide the function code that implements this algorithm. The function uses a homemade vector template , which is an int-sized vector template with components of type typename. Those interested can easily adjust the function to their vector types.

1 template 2 bool are_crossing(vector const &v11, vector const &v12, vector const &v21, vector const &v22, vector *crossing) 3 ( 4 vector cut1(v12-v11), cut2(v22-v21); 5 vector prod1, prod2; 6 7 prod1 = cross(cut1 * (v21-v11)); 8 prod2 = cross(cut1 * (v22-v11)); 9 10 if(sign(prod1[Z]) == sign(prod2[Z]) || (prod1[Z] == 0) || (prod2[Z] == 0)) // We also cut off borderline cases 11 return false; 12 13 prod1 = cross(cut2 * (v11-v21)); 14 prod2 = cross(cut2 * (v12-v21)); 15 16 if(sign(prod1[Z]) == sign(prod2[Z]) || (prod1[Z] == 0) || (prod2[Z] == 0)) // We also cut off borderline cases 17 return false; 18 19 if(crossing) ( // Check whether it is necessary to determine the intersection location 20 (*crossing)[X] = v11[X] + cut1[X]*fabs(prod1[Z])/fabs(prod2[Z]- prod1[Z]); 21 (*crossing)[Y] = v11[Y] + cut1[Y]*fabs(prod1[Z])/fabs(prod2[Z]-prod1[Z]); 22 ) 23 24 return true; 25)


When solving some geometric problems using the coordinate method, you have to find the coordinates of the point of intersection of lines. Most often you have to look for the coordinates of the point of intersection of two lines on a plane, but sometimes there is a need to determine the coordinates of the point of intersection of two lines in space. In this article we will deal with finding the coordinates of the point at which two lines intersect.

Page navigation.

The point of intersection of two lines is a definition.

Let's first define the point of intersection of two lines.

Thus, in order to find the coordinates of the point of intersection of two straight lines defined on a plane by general equations, you need to solve a system composed of equations of given straight lines.

Let's look at the example solution.

Example.

Find the intersection point of two lines defined in a rectangular coordinate system on a plane by the equations x-9y+14=0 and 5x-2y-16=0.

Solution.

We are given two general equations of lines, let's make a system out of them: . Solutions to the resulting system of equations are easily found by solving its first equation with respect to the variable x and substituting this expression into the second equation:

The found solution to the system of equations gives us the desired coordinates of the point of intersection of two lines.

Answer:

M 0 (4, 2) x-9y+14=0 and 5x-2y-16=0 .

So, finding the coordinates of the point of intersection of two straight lines, defined by general equations on a plane, comes down to solving a system of two linear equations with two unknown variables. But what if lines on a plane are given not by general equations, but by equations of a different type (see types of equations of a line on a plane)? In these cases, you can first reduce the equations of lines to a general form, and only after that find the coordinates of the intersection point.

Example.

And .

Solution.

Before finding the coordinates of the intersection point of the given lines, we reduce their equations to a general form. Transition from parametric straight line equations to the general equation of this line is as follows:

Now let's carry out the necessary actions with the canonical equation of the straight line:

Thus, the desired coordinates of the point of intersection of the lines are the solution to a system of equations of the form . To solve it we use:

Answer:

M 0 (-5, 1)

There is another way to find the coordinates of the point of intersection of two lines on a plane. It is convenient to use when one of the lines is given by parametric equations of the form , and the other is an equation of a straight line of a different type. In this case, in another equation, instead of the variables x and y, you can substitute the expressions And , from where it will be possible to obtain the value that corresponds to the intersection point of the given lines. In this case, the point of intersection of the lines has coordinates.

Let's find the coordinates of the point of intersection of the lines from the previous example using this method.

Example.

Determine the coordinates of the point of intersection of the lines And .

Solution.

Let's substitute the straight line expression into the equation:

Having solved the resulting equation, we get . This value corresponds to the common point of the lines And . We calculate the coordinates of the intersection point by substituting a straight line into the parametric equations:
.

Answer:

M 0 (-5, 1) .

To complete the picture, one more point should be discussed.

Before finding the coordinates of the point of intersection of two lines on a plane, it is useful to make sure that the given lines actually intersect. If it turns out that the original lines coincide or are parallel, then there can be no question of finding the coordinates of the point of intersection of such lines.

You can, of course, do without such a check and immediately create a system of equations of the form and solve it. If a system of equations has a unique solution, then it gives the coordinates of the point at which the original lines intersect. If the system of equations does not have solutions, then we can conclude that the original lines are parallel (since there is no pair of real numbers x and y that would simultaneously satisfy both equations of the given lines). From the presence of an infinite number of solutions to a system of equations, it follows that the original straight lines have infinitely many common points, that is, they coincide.

Let's look at examples that fit these situations.

Example.

Find out whether the lines and intersect, and if they intersect, then find the coordinates of the intersection point.

Solution.

The given equations of lines correspond to the equations And . Let's solve the system made up of these equations .

It is obvious that the equations of the system are linearly expressed through each other (the second equation of the system is obtained from the first by multiplying both its parts by 4), therefore, the system of equations has an infinite number of solutions. Thus, the equations define the same line, and we cannot talk about finding the coordinates of the point of intersection of these lines.

Answer:

The equations and define the same straight line in the rectangular coordinate system Oxy, so we cannot talk about finding the coordinates of the intersection point.

Example.

Find the coordinates of the point of intersection of the lines And , if possible.

Solution.

The condition of the problem allows that the lines may not intersect. Let's create a system from these equations. Let us apply to solve it, since it allows us to establish the compatibility or incompatibility of a system of equations, and if it is compatible, find a solution:

The last equation of the system after the direct passage of the Gauss method turned into an incorrect equality, therefore, the system of equations has no solutions. From this we can conclude that the original lines are parallel, and we cannot talk about finding the coordinates of the point of intersection of these lines.

Second solution.

Let's find out whether the given lines intersect.

- normal line vector , and the vector is a normal line vector . Let's check the execution And : equality is true, since, therefore, the normal vectors of the given lines are collinear. Then these lines are parallel or coincident. Thus, we cannot find the coordinates of the intersection point of the original lines.

Answer:

It is impossible to find the coordinates of the intersection point of the given lines, since these lines are parallel.

Example.

Find the coordinates of the intersection point of the lines 2x-1=0 and , if they intersect.

Solution.

Let's compose a system of equations that are general equations of given straight lines: . The determinant of the main matrix of this system of equations is nonzero , therefore the system of equations has a unique solution, which indicates the intersection of the given lines.

To find the coordinates of the point of intersection of the lines, we need to solve the system:

The resulting solution gives us the coordinates of the point of intersection of the lines, that is, 2x-1=0 and .

Answer:

Finding the coordinates of the point of intersection of two lines in space.

The coordinates of the point of intersection of two lines in three-dimensional space are found similarly.

Let's look at the solutions to the examples.

Example.

Find the coordinates of the intersection point of two lines given in space by the equations And .

Solution.

Let’s compose a system of equations from the equations of given lines: . The solution of this system will give us the desired coordinates of the point of intersection of lines in space. Let's find the solution to the written system of equations.

The main matrix of the system has the form , and extended - .

Let's define A and the rank of the matrix T. We use

If the lines intersect at a point, then its coordinates are the solution systems of linear equations

How to find the point of intersection of lines? Solve the system.

Here you go geometric meaning of a system of two linear equations with two unknowns- these are two intersecting (most often) lines on a plane.

It is convenient to split the task into several stages. Analysis of the condition suggests that it is necessary:
1) Make an equation of one straight line.
2) Write an equation for the second line.
3) Find out the relative position of the lines.
4) If the lines intersect, then find the point of intersection.

Example 13.

Find the point of intersection of lines

Solution: It is advisable to search for the intersection point using the analytical method. Let's solve the system:

Answer:

P.6.4. Distance from point to line

We have a straight strip of river in front of us and our task is to get to it by the shortest route. There are no obstacles, and the most optimal route will be to move along the perpendicular. That is, the distance from a point to a line is the length of the perpendicular segment.

Distance in geometry is traditionally denoted by the Greek letter “rho”, for example: – the distance from the point “em” to the straight line “de”.

Distance from point to a straight line expressed by the formula

Example 14.

Find the distance from a point to a line

Solution: all you need to do is carefully substitute the numbers into the formula and carry out the calculations:

Answer:

P.6.5. Angle between straight lines.

Example 15.

Find the angle between the lines.

1. Check whether the lines are perpendicular:

Let's calculate the scalar product of the direction vectors of the lines:
, which means the lines are not perpendicular.
2. Find the angle between straight lines using the formula:

Thus:

Answer:

Second order curves. Circle

Let a rectangular coordinate system 0xy be specified on the plane.

Second order curve is a line on a plane defined by an equation of the second degree relative to the current coordinates of the point M(x, y, z). In general, this equation looks like:

where coefficients A, B, C, D, E, L are any real numbers, and at least one of the numbers A, B, C is non-zero.



1.Circle is the set of points on the plane, the distance from which to a fixed point M 0 (x 0, y 0) is constant and equal to R. Point M 0 is called the center of the circle, and the number R is its radius

– equation of a circle with center at point M 0 (x 0, y 0) and radius R.

If the center of the circle coincides with the origin of coordinates, then we have:

– canonical equation of a circle.

Ellipse.

Ellipse is a set of points on a plane, for each of which the sum of the distances to two given points is a constant value (and this value is greater than the distances between these points). These points are called ellipse foci.

is the canonical equation of the ellipse.

The relationship is called eccentricity ellipse and is denoted by: , . Since then< 1.

Consequently, as the ratio decreases, it tends to 1, i.e. b differs little from a and the shape of the ellipse becomes closer to the shape of a circle. In the limiting case when , we get a circle whose equation is

x 2 + y 2 = a 2.

Hyperbola

Hyperbole is a set of points on a plane, for each of which the absolute value of the difference in distances to two given points, called tricks, is a constant quantity (provided that this quantity is less than the distance between the focuses and is not equal to 0).

Let F 1, F 2 be the foci, the distance between them will be denoted by 2c, the parameter of the parabola).

– canonical equation of a parabola.

Note that the equation for negative p also specifies a parabola, which will be located to the left of the 0y axis. The equation describes a parabola, symmetrical about the 0y axis, lying above the 0x axis for p > 0 and lying below the 0x axis for p< 0.