Equation direct derivation of the formula. Equation of a line passing through two points

Equation of a line passing through two points. In the article" " I promised you to look at the second way to solve the presented problems of finding the derivative, given a graph of a function and a tangent to this graph. We will discuss this method in , do not miss! Why in the next one?

The fact is that the formula for the equation of a straight line will be used there. Of course, you could just show this formula and advise you to learn it. But it’s better to explain where it comes from (how it is derived). It's necessary! If you forget it, you can quickly restore itwill not be difficult. Everything is outlined below in detail. So, we have two points A on the coordinate plane(x 1;y 1) and B(x 2;y 2), a straight line is drawn through the indicated points:

Here is the direct formula itself:


*That is, when substituting specific coordinates of points, we get an equation of the form y=kx+b.

**If you simply “memorize” this formula, then there is a high probability of getting confused with the indices when X. In addition, indices can be designated in different ways, for example:

That's why it's important to understand the meaning.

Now the derivation of this formula. Everything is very simple!


Triangles ABE and ACF are similar in acute angle (the first sign of similarity right triangles). It follows from this that the ratios of the corresponding elements are equal, that is:

Now we simply express these segments through the difference in the coordinates of the points:

Of course, there will be no error if you write the relationships of the elements in a different order (the main thing is to maintain consistency):

The result will be the same equation of the line. This is all!

That is, no matter how the points themselves (and their coordinates) are designated, by understanding this formula you will always find the equation of a straight line.

The formula can be derived using the properties of vectors, but the principle of derivation will be the same, since we will be talking about the proportionality of their coordinates. In this case, the same similarity of right triangles works. In my opinion, the conclusion described above is more clear)).

View output via vector coordinates >>>

Let a straight line be constructed on the coordinate plane passing through two given points A(x 1;y 1) and B(x 2;y 2). Let us mark an arbitrary point C on the line with coordinates ( x; y). We also denote two vectors:


It is known that for vectors lying on parallel lines (or on the same line), their corresponding coordinates are proportional, that is:

— we write down the equality of the ratios of the corresponding coordinates:

Let's look at an example:

Find the equation of a straight line passing through two points with coordinates (2;5) and (7:3).

You don’t even have to build the straight line itself. We apply the formula:

It is important that you grasp the correspondence when drawing up the ratio. You can't go wrong if you write:

Answer: y=-2/5x+29/5 go y=-0.4x+5.8

In order to make sure that the resulting equation is found correctly, be sure to check - substitute the coordinates of the data in the condition of the points into it. The equations should be correct.

That's all. I hope the material was useful to you.

Sincerely, Alexander.

P.S: I would be grateful if you tell me about the site on social networks.

Let the line pass through the points M 1 (x 1; y 1) and M 2 (x 2; y 2). The equation of a straight line passing through point M 1 has the form y-y 1 = k (x - x 1), (10.6)

Where k - still unknown coefficient.

Since the straight line passes through the point M 2 (x 2 y 2), the coordinates of this point must satisfy equation (10.6): y 2 -y 1 = k (x 2 - x 1).

From here we find Substituting the found value k into equation (10.6), we obtain the equation of a straight line passing through points M 1 and M 2:

It is assumed that in this equation x 1 ≠ x 2, y 1 ≠ y 2

If x 1 = x 2, then the straight line passing through the points M 1 (x 1,y I) and M 2 (x 2,y 2) is parallel to the ordinate axis. Its equation is x = x 1 .

If y 2 = y I, then the equation of the line can be written as y = y 1, the straight line M 1 M 2 is parallel to the abscissa axis.

Equation of a line in segments

Let the straight line intersect the Ox axis at point M 1 (a;0), and the Oy axis at point M 2 (0;b). The equation will take the form:
those.
. This equation is called equation of a straight line in segments, because numbers a and b indicate which segments the line cuts off on the coordinate axes.

Equation of a line passing through a given point perpendicular to a given vector

Let us find the equation of a straight line passing through a given point Mo (x O; y o) perpendicular to a given non-zero vector n = (A; B).

Let's take an arbitrary point M(x; y) on the line and consider the vector M 0 M (x - x 0; y - y o) (see Fig. 1). Since the vectors n and M o M are perpendicular, their scalar product is equal to zero: that is

A(x - xo) + B(y - yo) = 0. (10.8)

Equation (10.8) is called equation of a straight line passing through a given point perpendicular to a given vector .

Vector n= (A; B), perpendicular to the line, is called normal normal vector of this line .

Equation (10.8) can be rewritten as Ah + Wu + C = 0 , (10.9)

where A and B are the coordinates of the normal vector, C = -Ax o - Vu o is the free term. Equation (10.9) There is general equation straight(see Fig. 2).

Fig.1 Fig.2

Canonical equations of the line

,

Where
- coordinates of the point through which the line passes, and
- direction vector.

Second order curves Circle

A circle is the set of all points of the plane equidistant from a given point, which is called the center.

Canonical equation of a circle of radius R centered at a point
:

In particular, if the center of the stake coincides with the origin of coordinates, then the equation will look like:

Ellipse

An ellipse is a set of points on a plane, the sum of the distances from each of which to two given points And , which are called foci, is a constant quantity
, greater than the distance between foci
.

The canonical equation of an ellipse whose foci lie on the Ox axis, and the origin of coordinates in the middle between the foci has the form
G de
a semi-major axis length; b – length of the semi-minor axis (Fig. 2).

Properties of a straight line in Euclidean geometry.

An infinite number of straight lines can be drawn through any point.

Through any two non-coinciding points a single straight line can be drawn.

Two divergent lines in a plane either intersect at a single point or are

parallel (follows from the previous one).

In three-dimensional space, there are three options for the relative position of two lines:

  • lines intersect;
  • lines are parallel;
  • straight lines intersect.

Straight line— algebraic curve of the first order: a straight line in the Cartesian coordinate system

is given on the plane by an equation of the first degree (linear equation).

General equation of a straight line.

Definition. Any straight line on the plane can be specified by a first-order equation

Ax + Wu + C = 0,

and constant A, B are not equal to zero at the same time. This first order equation is called general

equation of a straight line. Depending on the values ​​of the constants A, B And WITH The following special cases are possible:

. C = 0, A ≠0, B ≠ 0- a straight line passes through the origin

. A = 0, B ≠0, C ≠0 (By + C = 0)- straight line parallel to the axis Oh

. B = 0, A ≠0, C ≠ 0 (Ax + C = 0)- straight line parallel to the axis OU

. B = C = 0, A ≠0- the straight line coincides with the axis OU

. A = C = 0, B ≠0- the straight line coincides with the axis Oh

The equation of a straight line can be represented in in various forms depending on any given

initial conditions.

Equation of a straight line from a point and a normal vector.

Definition. In Cartesian rectangular system coordinate vector with components (A, B)

perpendicular to the line given by the equation

Ax + Wu + C = 0.

Example. Find the equation of a line passing through a point A(1, 2) perpendicular to the vector (3, -1).

Solution. With A = 3 and B = -1, let’s compose the equation of the straight line: 3x - y + C = 0. To find the coefficient C

Let's substitute the coordinates of the given point A into the resulting expression. We get: 3 - 2 + C = 0, therefore

C = -1. Total: the required equation: 3x - y - 1 = 0.

Equation of a line passing through two points.

Let two points be given in space M 1 (x 1 , y 1 , z 1) And M2 (x 2, y 2, z 2), Then equation of a line,

passing through these points:

If any of the denominators is zero, the corresponding numerator should be set equal to zero. On

plane, the equation of the straight line written above is simplified:

If x 1 ≠ x 2 And x = x 1, If x 1 = x 2 .

Fraction = k called slope straight.

Example. Find the equation of the line passing through points A(1, 2) and B(3, 4).

Solution. Applying the formula written above, we get:

Equation of a straight line using a point and slope.

If the general equation of the line Ax + Wu + C = 0 lead to:

and designate , then the resulting equation is called

equation of a straight line with slope k.

Equation of a straight line from a point and a direction vector.

By analogy with the point considering the equation of a straight line through the normal vector, you can enter the task

a straight line through a point and a directing vector of a straight line.

Definition. Every non-zero vector (α 1 , α 2), whose components satisfy the condition

Aα 1 + Bα 2 = 0 called directing vector of a straight line.

Ax + Wu + C = 0.

Example. Find the equation of a straight line with a direction vector (1, -1) and passing through the point A(1, 2).

Solution. We will look for the equation of the desired line in the form: Ax + By + C = 0. According to the definition,

coefficients must satisfy the following conditions:

1 * A + (-1) * B = 0, i.e. A = B.

Then the equation of the straight line has the form: Ax + Ay + C = 0, or x + y + C / A = 0.

at x = 1, y = 2 we get C/A = -3, i.e. required equation:

x + y - 3 = 0

Equation of a straight line in segments.

If in the general equation of the straight line Ах + Ву + С = 0 С≠0, then, dividing by -С, we get:

or where

Geometric meaning coefficients is that coefficient a is the coordinate of the intersection point

straight with axis Oh, A b- coordinate of the point of intersection of the line with the axis OU.

Example. The general equation of a straight line is given x - y + 1 = 0. Find the equation of this line in segments.

C = 1, , a = -1, b = 1.

Normal equation of a line.

If both sides of the equation Ax + Wu + C = 0 divide by number which is called

normalizing factor, then we get

xcosφ + ysinφ - p = 0 -normal equation of a line.

The sign ± of the normalizing factor must be chosen so that μ*C< 0.

R- the length of the perpendicular dropped from the origin to the straight line,

A φ - the angle formed by this perpendicular with the positive direction of the axis Oh.

Example. The general equation of the line is given 12x - 5y - 65 = 0. Required to write Various types equations

this straight line.

The equation of this line in segments:

The equation of this line with the slope: (divide by 5)

Equation of a line:

cos φ = 12/13; sin φ= -5/13; p = 5.

It should be noted that not every straight line can be represented by an equation in segments, for example, straight lines,

parallel to the axes or passing through the origin.

The angle between straight lines on a plane.

Definition. If two lines are given y = k 1 x + b 1 , y = k 2 x + b 2, then the acute angle between these lines

will be defined as

Two lines are parallel if k 1 = k 2. Two straight lines are perpendicular,

If k 1 = -1/ k 2 .

Theorem.

Direct Ax + Wu + C = 0 And A 1 x + B 1 y + C 1 = 0 parallel when the coefficients are proportional

A 1 = λA, B 1 = λB. If also С 1 = λС, then the lines coincide. Coordinates of the point of intersection of two lines

are found as a solution to the system of equations of these lines.

The equation of a line passing through a given point perpendicular to a given line.

Definition. Line passing through a point M 1 (x 1, y 1) and perpendicular to the line y = kx + b

represented by the equation:

Distance from a point to a line.

Theorem. If a point is given M(x 0, y 0), then the distance to the straight line Ax + Wu + C = 0 defined as:

Proof. Let the point M 1 (x 1, y 1)- the base of a perpendicular dropped from a point M for a given

direct. Then the distance between points M And M 1:

(1)

Coordinates x 1 And at 1 can be found as a solution to the system of equations:

The second equation of the system is the equation of a straight line passing through a given point M 0 perpendicularly

given straight line. If we transform the first equation of the system to the form:

A(x - x 0) + B(y - y 0) + Ax 0 + By 0 + C = 0,

then, solving, we get:

Substituting these expressions into equation (1), we find:

The theorem has been proven.

Equation of a line on a plane.

As is known, any point on the plane is determined by two coordinates in some coordinate system. Coordinate systems can be different depending on the choice of basis and origin.

Definition. Line equation is called the relation y = f(x) between the coordinates of the points that make up this line.

Note that the equation of a line can be expressed parametrically, that is, each coordinate of each point is expressed through some independent parameter t.

A typical example is the trajectory of a moving point. In this case, the role of the parameter is played by time.

Equation of a straight line on a plane.

Definition. Any straight line on the plane can be specified by a first-order equation

Ax + Wu + C = 0,

Moreover, the constants A and B are not equal to zero at the same time, i.e. A 2 + B 2  0. This first order equation is called general equation of a straight line.

Depending on the values ​​of constants A, B and C, the following special cases are possible:

    C = 0, A  0, B  0 – the straight line passes through the origin

    A = 0, B  0, C  0 (By + C = 0) - straight line parallel to the Ox axis

    B = 0, A  0, C  0 (Ax + C = 0) – straight line parallel to the Oy axis

    B = C = 0, A  0 – the straight line coincides with the Oy axis

    A = C = 0, B  0 – the straight line coincides with the Ox axis

The equation of a straight line can be presented in different forms depending on any given initial conditions.

Equation of a straight line from a point and a normal vector.

Definition. In the Cartesian rectangular coordinate system, a vector with components (A, B) is perpendicular to the straight line given by the equation Ax + By + C = 0.

Example. Find the equation of the line passing through the point A(1, 2) perpendicular to the vector (3, -1).

With A = 3 and B = -1, let’s compose the equation of the straight line: 3x – y + C = 0. To find the coefficient C, we substitute the coordinates of the given point A into the resulting expression.

We get: 3 – 2 + C = 0, therefore C = -1.

Total: the required equation: 3x – y – 1 = 0.

Equation of a line passing through two points.

Let two points M 1 (x 1, y 1, z 1) and M 2 (x 2, y 2, z 2) be given in space, then the equation of the line passing through these points is:

If any of the denominators is zero, the corresponding numerator should be set equal to zero.

On the plane, the equation of the straight line written above is simplified:

if x 1  x 2 and x = x 1, if x 1 = x 2.

Fraction
=k is called slope straight.

Example. Find the equation of the line passing through points A(1, 2) and B(3, 4).

Applying the formula written above, we get:

Equation of a straight line using a point and slope.

If the general equation of the straight line Ax + By + C = 0 is reduced to the form:

and designate
, then the resulting equation is called equation of a straight line with slopek.

Equation of a straight line from a point and a direction vector.

By analogy with the point considering the equation of a straight line through a normal vector, you can enter the definition of a straight line through a point and the directing vector of the straight line.

Definition. Every non-zero vector ( 1,  2), the components of which satisfy the condition A 1 + B 2 = 0 is called the directing vector of the line

Ax + Wu + C = 0.

Example. Find the equation of a line with a direction vector (1, -1) and passing through point A(1, 2).

We will look for the equation of the desired line in the form: Ax + By + C = 0. In accordance with the definition, the coefficients must satisfy the conditions:

1A + (-1)B = 0, i.e. A = B.

Then the equation of the straight line has the form: Ax + Ay + C = 0, or x + y + C/A = 0.

at x = 1, y = 2 we get C/A = -3, i.e. required equation:

Equation of a straight line in segments.

If in the general equation of the straight line Ах + Ву + С = 0 С 0, then, dividing by –С, we get:
or

, Where

The geometric meaning of the coefficients is that the coefficient A is the coordinate of the point of intersection of the line with the Ox axis, and b– the coordinate of the point of intersection of the straight line with the Oy axis.

Example. The general equation of the line x – y + 1 = 0 is given. Find the equation of this line in segments.

C = 1,
, a = -1,b = 1.

Normal equation of a line.

If both sides of the equation Ax + By + C = 0 are divided by the number
which is called normalizing factor, then we get

xcos + ysin - p = 0 –

normal equation of a line.

The sign  of the normalizing factor must be chosen so that С< 0.

p is the length of the perpendicular dropped from the origin to the straight line, and  is the angle formed by this perpendicular with the positive direction of the Ox axis.

Example. The general equation of the line 12x – 5y – 65 = 0 is given. It is required to write various types of equations for this line.

equation of this line in segments:

equation of this line with slope: (divide by 5)

normal equation of a line:

; cos = 12/13; sin = -5/13; p = 5.

It should be noted that not every straight line can be represented by an equation in segments, for example, straight lines parallel to the axes or passing through the origin of coordinates.

Example. The straight line cuts off equal positive segments on the coordinate axes. Write an equation of a straight line if the area of ​​the triangle formed by these segments is 8 cm 2.

The equation of the straight line is:
, a = b = 1; ab/2 = 8; a = 4; -4.

a = -4 is not suitable according to the conditions of the problem.

Total:
or x + y – 4 = 0.

Example. Write an equation for a straight line passing through point A(-2, -3) and the origin.

The equation of the straight line is:
, where x 1 = y 1 = 0; x 2 = -2; y 2 = -3.

The angle between straight lines on a plane.

Definition. If two lines are given y = k 1 x + b 1, y = k 2 x + b 2, then the acute angle between these lines will be defined as

.

Two lines are parallel if k 1 = k 2.

Two lines are perpendicular if k 1 = -1/k 2 .

Theorem. Direct lines Ax + Wu + C = 0 and A 1 x + B 1 y + C 1 = 0 are parallel when the coefficients A are proportional 1 = A, B 1 = B. If also C 1 = C, then the lines coincide.

The coordinates of the point of intersection of two lines are found as a solution to the system of equations of these lines.

Equation of a line passing through a given point

perpendicular to this line.

Definition. A straight line passing through the point M 1 (x 1, y 1) and perpendicular to the straight line y = kx + b is represented by the equation:

Distance from a point to a line.

Theorem. If the point M(x) is given 0 , y 0 ), then the distance to the straight line Ах + Ву + С =0 is defined as

.

Proof. Let point M 1 (x 1, y 1) be the base of the perpendicular dropped from point M to a given straight line. Then the distance between points M and M 1:

The coordinates x 1 and y 1 can be found by solving the system of equations:

The second equation of the system is the equation of a line passing through a given point M 0 perpendicular to a given line.

If we transform the first equation of the system to the form:

A(x – x 0) + B(y – y 0) + Ax 0 + By 0 + C = 0,

then, solving, we get:

Substituting these expressions into equation (1), we find:

.

The theorem has been proven.

Example. Determine the angle between the lines: y = -3x + 7; y = 2x + 1.

k 1 = -3; k 2 = 2 tg =
;  = /4.

Example. Show that the lines 3x – 5y + 7 = 0 and 10x + 6y – 3 = 0 are perpendicular.

We find: k 1 = 3/5, k 2 = -5/3, k 1 k 2 = -1, therefore, the lines are perpendicular.

Example. Given are the vertices of the triangle A(0; 1), B(6; 5), C(12; -1). Find the equation of the height drawn from vertex C.

We find the equation of side AB:
; 4x = 6y – 6;

2x – 3y + 3 = 0;

The required height equation has the form: Ax + By + C = 0 or y = kx + b.

k = . Then y =
. Because the height passes through point C, then its coordinates satisfy this equation:
whence b = 17. Total:
.

Answer: 3x + 2y – 34 = 0.

Analytical geometry in space.

Equation of a line in space.

Equation of a line in space given a point and

direction vector.

Let's take an arbitrary line and a vector (m, n, p), parallel to the given line. Vector called guide vector straight.

On the straight line we take two arbitrary points M 0 (x 0 , y 0 , z 0) and M (x, y, z).

z

M 1

Let us denote the radius vectors of these points as And , it's obvious that - =
.

Because vectors
And are collinear, then the relation is true
= t, where t is some parameter.

In total, we can write: = + t.

Because this equation is satisfied by the coordinates of any point on the line, then the resulting equation is parametric equation of a line.

This vector equation can be represented in coordinate form:

By transforming this system and equating the values ​​of the parameter t, we obtain the canonical equations of a straight line in space:

.

Definition. Direction cosines direct are the direction cosines of the vector , which can be calculated using the formulas:

;

.

From here we get: m: n: p = cos : cos : cos.

The numbers m, n, p are called angle coefficients straight. Because is a non-zero vector, then m, n and p cannot be equal to zero at the same time, but one or two of these numbers can be equal to zero. In this case, in the equation of the line, the corresponding numerators should be set equal to zero.

Equation of a straight line in space passing

through two points.

If on a straight line in space we mark two arbitrary points M 1 (x 1, y 1, z 1) and M 2 (x 2, y 2, z 2), then the coordinates of these points must satisfy the straight line equation obtained above:

.

In addition, for point M 1 we can write:

.

Solving these equations together, we get:

.

This is the equation of a line passing through two points in space.

General equations of a straight line in space.

The equation of a straight line can be considered as the equation of the line of intersection of two planes.

As discussed above, a plane in vector form can be specified by the equation:

+ D = 0, where

- plane normal; - radius is the vector of an arbitrary point on the plane.

Lesson from the series “Geometric algorithms”

Hello dear reader!

Today we will start learning algorithms related to geometry. The fact is that olympiad problems in computer science, there are quite a lot of topics related to computational geometry, and solving such problems often causes difficulties.

Over the course of several lessons, we will consider a number of elementary subtasks on which the solution of most problems in computational geometry is based.

In this lesson we will create a program for finding the equation of a line, passing through given two points. To solve geometric problems, we need some knowledge of computational geometry. We will devote part of the lesson to getting to know them.

Insights from Computational Geometry

Computational geometry is a branch of computer science that studies algorithms for solving geometric problems.

The initial data for such problems can be a set of points on a plane, a set of segments, a polygon (specified, for example, by a list of its vertices in clockwise order), etc.

The result can be either an answer to some question (such as does a point belong to a segment, do two segments intersect, ...), or some geometric object (for example, the smallest convex polygon connecting given points, the area of ​​a polygon, etc.) .

We will consider problems of computational geometry only on the plane and only in the Cartesian coordinate system.

Vectors and coordinates

To apply the methods of computational geometry, it is necessary to translate geometric images into the language of numbers. We will assume that the plane is given a Cartesian coordinate system, in which the direction of rotation counterclockwise is called positive.

Now geometric objects receive an analytical expression. So, to specify a point, it is enough to indicate its coordinates: a pair of numbers (x; y). A segment can be specified by specifying the coordinates of its ends; a straight line can be specified by specifying the coordinates of a pair of its points.

But our main tool for solving problems will be vectors. Let me therefore recall some information about them.

Line segment AB, which has a point A is considered the beginning (point of application), and the point IN– end, called a vector AB and is denoted by either or by a bold lowercase letter, for example A .

To denote the length of a vector (that is, the length of the corresponding segment), we will use the modulus symbol (for example, ).

An arbitrary vector will have coordinates equal to the difference between the corresponding coordinates of its end and beginning:

,

here are the points A And B have coordinates respectively.

For calculations we will use the concept oriented angle, that is, the angle taking into account mutual arrangement vectors.

Oriented angle between vectors a And b positive if the rotation is from the vector a to vector b is performed in a positive direction (counterclockwise) and negative in the other case. See Fig.1a, Fig.1b. It is also said that a pair of vectors a And b positively (negatively) oriented.

Thus, the value of the oriented angle depends on the order in which the vectors are listed and can take values ​​in the interval.

Many problems in computational geometry use the concept of vector (skew or pseudoscalar) products of vectors.

The vector product of vectors a and b is the product of the lengths of these vectors and the sine of the angle between them:

.

Cross product of vectors in coordinates:

The expression on the right is a second-order determinant:

Unlike the definition given in analytical geometry, it is a scalar.

Sign vector product determines the position of the vectors relative to each other:

a And b positively oriented.

If the value is , then a pair of vectors a And b negatively oriented.

The cross product of nonzero vectors is zero if and only if they are collinear ( ). This means that they lie on the same line or on parallel lines.

Let's look at a few simple problems that are necessary when solving more complex ones.

Let's determine the equation of a straight line from the coordinates of two points.

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

Let two non-coinciding points be given on a straight line: with coordinates (x1; y1) and with coordinates (x2; y2). Accordingly, a vector with a start at a point and an end at a point has coordinates (x2-x1, y2-y1). If P(x, y) is an arbitrary point on our line, then the coordinates of the vector are equal to (x-x1, y – y1).

Using the vector product, the condition for collinearity of vectors and can be written as follows:

Those. (x-x1)(y2-y1)-(y-y1)(x2-x1)=0

(y2-y1)x + (x1-x2)y + x1(y1-y2) + y1(x2-x1) = 0

We rewrite the last equation as follows:

ax + by + c = 0, (1)

c = x1(y1-y2) + y1(x2-x1)

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

Problem 1. The coordinates of two points are given. Find its representation in the form ax + by + c = 0.

In this lesson we learned some information about computational geometry. We solved the problem of finding the equation of a line from the coordinates of two points.

In the next lesson, we will create a program to find the intersection point of two lines given by our equations.