[Math] extend a line in both way

geometry

I have a line segment, passing through the points $A = (100,100), B = (200, 200)$ and I would like to extend it by a certain length in both way.

I can get the length of the current line segment by
$$\sqrt{(B.x – A.x)^2 + (B.y – A.y)^2} \approx 141.42$$

But from here I don't know what I have to do to extend it equally in both ways.

Best Answer

The equation of a line is $y = mx + b$. Where $m$ is the slope.

In this line $m = \frac{200 - 100}{200-100} = \frac{100}{100} = 1$

So $y = x + b$. We can solve for $b$ by plugging in either $(100,100)$ or $(200,200)$ into the equation to get $200 = 200 + b$ or $100 = 100 + b$ so $b = 0$.

So the equation is $y = x$.

Pick a point $(x',y'); y' = x'$ on the line. If we extend the line so that the $x$ value increases by $h$ then what does the $y$ value increase by? $y' = x'$ so $y_{new} = x' + h = y' + h$. So the $y$ value also increases by $h$.

So what does the total distance increase by? $D((x',y'),(x'+h,y'+h)) = \sqrt{(x'+h - x')^2 + (y'+h - y')^2} = \sqrt{h^2 + h^2} = \sqrt{2h^2} = h\sqrt{2}$.

So if you want to increase the line by $D$ you must extend $x$ (and $y$) by... $D = h\sqrt2 \implies h = D/\sqrt2 = D*\frac{\sqrt 2}{2}$.

====

So for instance, if we want to extend the line $75$ units, we must increase $x$ by $75*\frac{\sqrt 2}{2}$ units to the point $(x = 100 +75*\frac{\sqrt 2}{2}, y = 100 +75*\frac{\sqrt 2}{2})$.

Related Question