Line intersection formula. The simplest problems with a straight line on a plane. Mutual arrangement of lines. Angle between lines

Lesson from the series "Geometric Algorithms"

Hello dear reader!

We continue to get acquainted with geometric algorithms. In the last lesson, we found the equation of a straight line in the coordinates of two points. We have an equation of the form:

Today we will write a function that, using the equations of two straight lines, will find the coordinates of their intersection point (if any). To check the equality of real numbers, we will use the special function RealEq().

Points on the plane are described by a pair of real numbers. When using the real type, it is better to arrange the comparison operations with special functions.

The reason is known: there is no order relation on the Real type in the Pascal programming system, so it is better not to use records of the form a = b, where a and b are real numbers.
Today we will introduce the RealEq() function to implement the “=” (strictly equal) operation:

Function RealEq(Const a, b:Real):Boolean; (strictly equal) begin RealEq:=Abs(a-b)<=_Eps End; {RealEq}

A task. Equations of two straight lines are given: and . Find their point of intersection.

Solution. The obvious solution is to solve the system of equations of lines: Let's rewrite this system a little differently:
(1)

We introduce the notation: , , . Here D is the determinant of the system, and are the determinants obtained by replacing the column of coefficients for the corresponding unknown with a column of free terms. If , then system (1) is definite, that is, it has a unique solution. This solution can be found by the following formulas: , , which are called Cramer's formulas. Let me remind you how the second order determinant is calculated. The determinant distinguishes between two diagonals: the main and 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.

The code uses the RealEq() function to check for equality. Calculations over real numbers are made with accuracy up to _Eps=1e-7.

Program geom2; Const _Eps: Real=1e-7;(calculation accuracy) var a1,b1,c1,a2,b2,c2,x,y,d,dx,dy:Real; Function RealEq(Const a, b:Real):Boolean; (strictly equal) begin RealEq:=Abs(a-b)<=_Eps End; {RealEq} Function LineToPoint(a1,b1,c1,a2,b2,c2: real; var x,y:real):Boolean; {Определение координат точки пересечения двух линий. Значение функции равно true, если точка пересечения есть, и false, если прямые параллельны. } var d:real; begin d:=a1*b2-b1*a2; if Not(RealEq(d,0)) then begin LineToPoint:=True; dx:=-c1*b2+b1*c2; dy:=-a1*c2+c1*a2; x:=dx/d; y:=dy/d; end else LineToPoint:=False End;{LineToPoint} begin {main} writeln("Введите коэффициенты уравнений: a1,b1,c1,a2,b2,c2 "); readln(a1,b1,c1,a2,b2,c2); if LineToPoint(a1,b1,c1,a2,b2,c2,x,y) then writeln(x:5:1,y:5:1) else writeln("Прямые параллельны."); end.

We have compiled a program with which you can, knowing the equations of the lines, find the coordinates of their intersection point.

Let two lines be given and it is required to find their point of intersection. Since this point belongs to each of the two given lines, its coordinates must satisfy both the equation of the first line and the equation of the second line.

Thus, in order to find the coordinates of the point of intersection of two lines, one should solve the system of equations

Example 1. Find the point of intersection of lines and

Solution. We will find the coordinates of the desired intersection point by solving the system of equations

The intersection point M has coordinates

Let us show how to construct a straight line from its equation. To draw a line, it is enough to know two of its points. To plot each of these points, we give an arbitrary value to one of its coordinates, and then from the equation we find the corresponding value of the other coordinate.

If in the general equation of a straight line, both coefficients at the current coordinates are not equal to zero, then to construct this straight line, it is best to find the points of its intersection with the coordinate axes.

Example 2. Construct a straight line.

Solution. Find the point of intersection of this line with the x-axis. To do this, we solve together their equations:

and we get . Thus, the point M (3; 0) of the intersection of this straight line with the abscissa axis was found (Fig. 40).

Solving then jointly the equation of the given line and the equation of the y-axis

we find the point of intersection of the line with the y-axis. Finally, we construct a line from its two points M and

  1. To find the coordinates of the intersection point of the graphs of functions, you need to equate both functions to each other, move all terms containing $ x $ to the left side, and the rest to the right side and find the roots of the resulting equation.
  2. The second way is to compose a system of equations and solve it by substituting one function into another
  3. The third method involves the graphic construction of functions and the visual definition of the intersection point.

Case of two linear functions

Consider two linear functions $ f(x) = k_1 x+m_1 $ and $ g(x) = k_2 x + m_2 $. These functions are called direct. Building them is easy enough, you just need to take any two values ​​$x_1$ and $x_2$ and find $f(x_1)$ and $(x_2)$. Then repeat the same with the $ g(x) $ function. Next, visually find the coordinate of the intersection point of the function graphs.

You should know that linear functions have only one intersection point and only when $ k_1 \neq k_2 $. Otherwise, in the case of $ k_1=k_2 $, the functions are parallel to each other, since $ k $ is the slope factor. If $ k_1 \neq k_2 $, but $ m_1=m_2 $, then the intersection point will be $ M(0;m) $. It is desirable to remember this rule for accelerated problem solving.

Example 1
Let $ f(x) = 2x-5 $ and $ g(x)=x+3 $ be given. Find the coordinates of the intersection point of function graphs.
Solution

How to do it? Since two linear functions are presented, the first thing we look at is the coefficient of the slope of both functions $ k_1 = 2 $ and $ k_2 = 1 $. Note that $ k_1 \neq k_2 $, so there is one intersection point. Let's find it using the equation $ f(x)=g(x) $:

$$ 2x-5 = x+3 $$

We move the terms from $ x $ to the left side, and the rest to the right:

$$ 2x - x = 3+5 $$

We got $ x=8 $ the abscissa of the intersection point of the graphs, and now let's find the ordinate. To do this, we substitute $ x = 8 $ into any of the equations either in $ f(x) $ or in $ g(x) $:

$$ f(8) = 2\cdot 8 - 5 = 16 - 5 = 11 $$

So, $ M (8;11) $ - is the intersection point of the graphs of two linear functions.

If you cannot solve your problem, then send it to us. We will provide a detailed solution. You will be able to familiarize yourself with the progress of the calculation and gather information. This will help you get a credit from the teacher in a timely manner!

Answer
$$ M (8;11) $$

Case of two non-linear functions

Example 3
Find the coordinates of the intersection point of function graphs: $ f(x)=x^2-2x+1 $ and $ g(x)=x^2+1 $
Solution

What about two non-linear functions? The algorithm is simple: we equate the equations to each other and find the roots:

$$ x^2-2x+1=x^2+1 $$

We spread the terms with $ x $ and without it on different sides of the equation:

$$ x^2-2x-x^2=1-1 $$

The abscissa of the desired point was found, but it is not enough. The ordinate $ y $ is still missing. Substitute $ x = 0 $ into any of the two equations of the problem statement. For example:

$$ f(0)=0^2-2\cdot 0 + 1 = 1 $$

$ M (0;1) $ - intersection point of function graphs

Answer
$$ M (0;1) $$

In two-dimensional space, two lines intersect only at one point, given by the coordinates (x, y). Since both lines pass through their point of intersection, the coordinates (x, y) must satisfy both equations that describe these lines. With some advanced skills, you can find the intersection points of parabolas and other quadratic curves.

Steps

Point of intersection of two lines

    Write down the equation of each line, isolating the variable "y" on the left side of the equation. Other terms of the equation should be placed on the right side of the equation. Perhaps the equation given to you instead of "y" will contain the variable f (x) or g (x); in this case isolate such a variable. To isolate a variable, perform the appropriate mathematical operations on both sides of the equation.

    • If the equations of the lines are not given to you, on the basis of information known to you.
    • Example. Given straight lines described by the equations and y − 12 = − 2 x (\displaystyle y-12=-2x). To isolate the "y" in the second equation, add the number 12 to both sides of the equation:
  1. You are looking for the intersection point of both lines, that is, the point whose (x, y) coordinates satisfy both equations. Since the variable "y" is on the left side of each equation, the expressions on the right side of each equation can be equated. Write down a new equation.

    • Example. Because y = x + 3 (\displaystyle y=x+3) and y = 12 − 2x (\displaystyle y=12-2x), then we can write the following equality: .
  2. Find the value of the variable "x". The new equation contains only one variable "x". To find "x", isolate this variable on the left side of the equation by doing the appropriate math on both sides of the equation. You should end up with an equation like x = __ (if you can't do that, see this section).

    • Example. x + 3 = 12 − 2 x (\displaystyle x+3=12-2x)
    • Add 2x (\displaystyle 2x) to each side of the equation:
    • 3x + 3 = 12 (\displaystyle 3x+3=12)
    • Subtract 3 from each side of the equation:
    • 3x=9 (\displaystyle 3x=9)
    • Divide each side of the equation by 3:
    • x = 3 (\displaystyle x=3).
  3. Use the found value of the variable "x" to calculate the value of the variable "y". To do this, substitute the found value "x" in the equation (any) straight line.

    • Example. x = 3 (\displaystyle x=3) and y = x + 3 (\displaystyle y=x+3)
    • y = 3 + 3 (\displaystyle y=3+3)
    • y=6 (\displaystyle y=6)
  4. Check the answer. To do this, substitute the value of "x" in another equation of a straight line and find the value of "y". If you get different "y" values, check that your calculations are correct.

    • Example: x = 3 (\displaystyle x=3) and y = 12 − 2x (\displaystyle y=12-2x)
    • y = 12 − 2 (3) (\displaystyle y=12-2(3))
    • y = 12 − 6 (\displaystyle y=12-6)
    • y=6 (\displaystyle y=6)
    • You got the same "y" value, so there are no errors in your calculations.
  5. Write down the coordinates (x, y). By calculating the values ​​\u200b\u200bof "x" and "y", you have found the coordinates of the point of intersection of two lines. Write down the coordinates of the intersection point in the form (x, y).

    • Example. x = 3 (\displaystyle x=3) and y=6 (\displaystyle y=6)
    • Thus, two lines intersect at a point with coordinates (3,6).
  6. Computations in special cases. In some cases, the value of the variable "x" cannot be found. But that doesn't mean you made a mistake. A special case occurs when one of the following conditions is met:

    • If two lines are parallel, they do not intersect. In this case, the variable "x" will simply be reduced, and your equation will turn into a meaningless equality (for example, 0 = 1 (\displaystyle 0=1)). In this case, write down in your answer that the lines do not intersect or there is no solution.
    • If both equations describe one straight line, then there will be an infinite number of intersection points. In this case, the variable "x" will simply be reduced, and your equation will turn into a strict equality (for example, 3 = 3 (\displaystyle 3=3)). In this case, write down in your answer that the two lines coincide.

    Problems with quadratic functions

    1. Definition of a quadratic function. In a quadratic function, one or more variables have a second degree (but not higher), for example, x 2 (\displaystyle x^(2)) or y 2 (\displaystyle y^(2)). Graphs of quadratic functions are curves that may not intersect or intersect at one or two points. In this section, we will tell you how to find the point or points of intersection of quadratic curves.

    2. Rewrite each equation by isolating the variable "y" on the left side of the equation. Other terms of the equation should be placed on the right side of the equation.

      • Example. Find the point(s) of intersection of the graphs x 2 + 2 x − y = − 1 (\displaystyle x^(2)+2x-y=-1) and
      • Isolate the variable "y" on the left side of the equation:
      • and y = x + 7 (\displaystyle y=x+7) .
      • In this example, you are given one quadratic function and one linear function. Remember that if you are given two quadratic functions, the calculations are the same as the steps below.
    3. Equate the expressions on the right side of each equation. Since the variable "y" is on the left side of each equation, the expressions on the right side of each equation can be equated.

      • Example. y = x 2 + 2 x + 1 (\displaystyle y=x^(2)+2x+1) and y = x + 7 (\displaystyle y=x+7)
    4. Transfer all the terms of the resulting equation to its left side, and write 0 on the right side. To do this, perform basic mathematical operations. This will allow you to solve the resulting equation.

      • Example. x 2 + 2 x + 1 = x + 7 (\displaystyle x^(2)+2x+1=x+7)
      • Subtract "x" from both sides of the equation:
      • x 2 + x + 1 = 7 (\displaystyle x^(2)+x+1=7)
      • Subtract 7 from both sides of the equation:
    5. Solve the quadratic equation. By transferring all the terms of the equation to its left side, you get a quadratic equation. It can be solved in three ways: using a special formula, and.

      • Example. x 2 + x − 6 = 0 (\displaystyle x^(2)+x-6=0)
      • When factoring the equation, you get two binomials, which, when multiplied, give the original equation. In our example, the first member x 2 (\displaystyle x^(2)) can be decomposed into x*x. Make the following entry: (x)(x) = 0
      • In our example, the intercept -6 can be factored as follows: − 6 ∗ 1 (\displaystyle -6*1), − 3 ∗ 2 (\displaystyle -3*2), − 2 ∗ 3 (\displaystyle -2*3), − 1 ∗ 6 (\displaystyle -1*6).
      • In our example, the second term is x (or 1x). Add each pair of intercept factors (in our example -6) until you get 1. In our example, the correct pair of intercept factors are -2 and 3 ( − 2 ∗ 3 = − 6 (\displaystyle -2*3=-6)), because − 2 + 3 = 1 (\displaystyle -2+3=1).
      • Fill in the gaps with the found pair of numbers: .
    6. Don't forget about the second point of intersection of the two graphs. If you solve the problem quickly and not very carefully, you can forget about the second intersection point. Here's how to find the "x" coordinates of two intersection points:

      • Example (factoring). If in the equation (x − 2) (x + 3) = 0 (\displaystyle (x-2)(x+3)=0) one of the expressions in brackets will be equal to 0, then the whole equation will be equal to 0. Therefore, we can write it like this: x − 2 = 0 (\displaystyle x-2=0)x = 2 (\displaystyle x=2) and x + 3 = 0 (\displaystyle x+3=0)x = − 3 (\displaystyle x=-3) (that is, you found two roots of the equation).
      • Example (use formula or complete square). When using one of these methods, a square root will appear in the solution process. For example, the equation from our example will take the form x = (− 1 + 25) / 2 (\displaystyle x=(-1+(\sqrt (25)))/2). Remember that when taking the square root, you will get two solutions. In our case: 25 = 5 ∗ 5 (\displaystyle (\sqrt(25))=5*5), and 25 = (− 5) ∗ (− 5) (\displaystyle (\sqrt (25))=(-5)*(-5)). So write down two equations and find two x values.
    7. Graphs intersect at one point or do not intersect at all. Such situations occur when the following conditions are met:

      • If the graphs intersect at one point, then the quadratic equation is decomposed into equal factors, for example, (x-1) (x-1) = 0, and the square root of 0 appears in the formula ( 0 (\displaystyle (\sqrt(0)))). In this case, the equation has only one solution.
      • If the graphs do not intersect at all, then the equation does not factorize, and the square root of a negative number appears in the formula (for example, − 2 (\displaystyle (\sqrt(-2)))). In this case, write in the answer that there is no solution.

Perpendicular line

This task is probably one of the most popular and in demand in school textbooks. The tasks based on this theme are manifold. This is the definition of the point of intersection of two lines, this is the definition of the equation of a straight line passing through a point on the original line at any angle.

We will cover this topic using in our calculations the data obtained using

It was there that the transformation of the general equation of a straight line, into an equation with a slope and vice versa, and the determination of the remaining parameters of a straight line according to given conditions were considered.

What do we lack in order to solve the problems that this page is devoted to?

1. Formulas for calculating one of the angles between two intersecting lines.

If we have two straight lines which are given by the equations:

then one of the angles is calculated like this:

2. Equation of a straight line with a slope passing through a given point

From formula 1, we can see two border states

a) when then and therefore these two given lines are parallel (or coincide)

b) when , then , and therefore these lines are perpendicular, that is, they intersect at a right angle.

What can be the initial data for solving such problems, except for a given straight line?

A point on a line and the angle at which the second line intersects it

The second equation of the line

What tasks can a bot solve?

1. Two straight lines are given (explicitly or implicitly, for example, by two points). Calculate the point of intersection and the angles at which they intersect.

2. Given one straight line, a point on a straight line, and one angle. Determine the equation of a straight line that intersects a given one at a specified angle

Examples

Two straight lines are given by equations. Find the point of intersection of these lines and the angles at which they intersect

line_p A=11;B=-5;C=6,k=3/7;b=-5

We get the following result

Equation of the first line

y = 2.2 x + (1.2)

Equation of the second line

y = 0.4285714285714 x + (-5)

Angle of intersection of two lines (in degrees)

-42.357454705937

Point of intersection of two lines

x=-3.5

y=-6.5


Do not forget that the parameters of the two lines are separated by a comma, and the parameters of each line by a semicolon.

The line passes through two points (1:-4) and (5:2) . Find the equation of a straight line that passes through the point (-2:-8) and intersects the original line at an angle of 30 degrees.

One straight line is known to us, since two points through which it passes are known.

It remains to determine the equation of the second straight line. One point is known to us, and instead of the second, the angle at which the first line intersects the second is indicated.

Everything seems to be known, but the main thing here is not to be mistaken. We are talking about the angle (30 degrees) not between the x-axis and the line, but between the first and second lines.

For this we post like this. Let's determine the parameters of the first line, and find out at what angle it intersects the x-axis.

line xa=1;xb=5;ya=-4;yb=2

General equation Ax+By+C = 0

Coefficient A = -6

Factor B = 4

Coefficient C = 22

Coefficient a= 3.6666666666667

Coefficient b = -5.5

Coefficient k = 1.5

Angle of inclination to the axis (in degrees) f = 56.309932474019

Coefficient p = 3.0508510792386

Coefficient q = 2.5535900500422

Distance between points=7.211102550928

We see that the first line crosses the axis at an angle 56.309932474019 degrees.

The source data does not say exactly how the second line intersects the first. After all, it is possible to draw two lines that satisfy the conditions, the first rotated 30 degrees clockwise, and the second 30 degrees counterclockwise.

Let's count them

If the second line is rotated 30 degrees COUNTER-CLOCKWISE, then the second line will have a degree of intersection with the x-axis 30+56.309932474019 = 86 .309932474019 degrees

line_p xa=-2;ya=-8;f=86.309932474019

Straight line parameters according to the given parameters

General equation Ax+By+C = 0

Coefficient A = 23.011106998916

Factor B = -1.4840558255286

Coefficient C = 34.149767393603

Equation of a straight line in segments x/a+y/b = 1

Coefficient a= -1.4840558255286

Coefficient b = 23.011106998916

Equation of a straight line with angular coefficient y = kx + b

Coefficient k = 15.505553499458

Angle of inclination to the axis (in degrees) f = 86.309932474019

Normal equation of the line x*cos(q)+y*sin(q)-p = 0

Coefficient p = -1.4809790664999

Coefficient q = 3.0771888256405

Distance between points=23.058912962428

Distance from point to line li =

that is, our second line equation is y= 15.505553499458x+ 23.011106998916

Have questions?

Report a typo

Text to be sent to our editors: