# Distance between two points in the Cartesian plane

#### Poly

##### Member
Let $AB$ be the distance between the two points $A(x_{1} ~ x_{2})$ and $B(x_{2}, ~ y_{2})$ -- e.g. $AB = \sqrt{(x_{2}-x_{1})^2+(y_{2}-y_{1})^2}$.

Why is the point $P$ which divides $AB$ in the ratio $\lambda:\mu$ given by $\displaystyle ~~ \bigg(\frac{\lambda x_{2}+\mu x_{1}}{\lambda+\mu}, ~ \frac{\lambda y_{2}+\mu y_{1}}{\lambda+\mu}\bigg)$? How do you show that?

#### pickslides

##### Member
If AP is given by $\lambda$ then

$\displaystyle AP = \frac{\lambda}{\lambda+\mu}\times AB$

#### MarkFL

Staff member
Let point P be $\displaystyle (x_P,y_P)$.

Using a right triangle where AB is the hypotenuse, and working with the legs, you could set up the following equations:

Horizontal leg:

$\displaystyle \frac{\lambda}{\lambda+\mu}=\frac{x_P-x_1}{x_2-x_1}$

Vertical leg:

$\displaystyle \frac{\lambda}{\lambda+\mu}=\frac{y_P-y_1}{y_2-y_1}$

Now solve for $\displaystyle (x_P,y_P)$.

Last edited:

#### Poly

##### Member
How did you get those equations from the triangle?

#### Poly

##### Member
I sort of get it, but I'm bit confused about the choice of $\lambda$ and $\mu$ in the plotting.

#### MarkFL

Staff member
How did you get those equations from the triangle?
I assumed the segment AB is neither horizontal nor vertical, and arbitrarily placed a point on it and labeled it P. Then using the described triangle, from P I extended both a horizontal and a vertical line to the legs of the triangle at which the points of intersection divides the legs in the same ratio as P divides AB.

#### soroban

##### Well-known member
Hello, Poly!

Let $AB$ be the distance between the two points $A(x_1,\,y_1)$ and $B(x_2,\,y_2)$
. . $AB \:=\: \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$ . We don't need this.

Why is the point $P$ which divides $AB$ in the ratio $\lambda\!:\!\mu$ given by $\left(\dfrac{\lambda x_{2}+\mu x_{1}}{\lambda+\mu},\,\dfrac{\lambda y_{2}+\mu y_{1}}{\lambda+\mu}\right)$?
How do you show that?

Code:
                                    B
o(x2,y2)
*   |   :
*       |   :
M    *           | y2-y1
o               |   :
*                   |   :
(x1,y1) o-----------------------+   -
A - - - - x2-x1 - - - - C
Suppose $$M$$ divides $$AB$$ in the ratio $$\lambda\!:\!\mu \:=\:3:4$$

Then $$M$$ is $$\tfrac{3}{7}$$ of the way from $$A$$ to $$B.$$

The x-coordinate is: .$$x_1 + \tfrac{3}{7}(x_1-x_1) \:=\:\tfrac{4}{7}x_1 + \tfrac{3}{7}x_2$$

The y-coordinate is: .$$y_1 + \tfrac{3}{7}(y_2-y_1) \:=\:\tfrac{4}{7}y_1 + \tfrac{3}{7}y^2$$

The coordinates of $$M$$ are: .$$\left(\tfrac{4}{7}x_1+\tfrac{3}{7}x_2,\:\tfrac{4}{7}y_1 + \tfrac{3}{7}y_2\right)$$

. . $$=\;\left(\frac{4x_1 + 3x_2}{7},\:\frac{4y_1+3y_2}{7}\right) \;=\; \left(\frac{3x_2+4x_1}{3+4},\:\frac{3y_2+4y_1}{3+4}\right)$$

Compare this to the given formula.