How to derive a general expression for the shortest distance between the origin and a straight line on a 2D cartesian plane?

Al-Layth

Junior Member
Joined
Dec 28, 2021
Messages
83
The problem I am dealing with is in the picture:
Cartesian Geometry Problem 1.jpg

my limited intellect could only conceive of two approaches to solving this problem.
The second approach turned out to be the first approach, but with extra steps. ;(

My Attempt - Find the Pythagorean distance between (x,mx+c) and the origin

[math]d= \sqrt{(x^2)+(mx+c)^2 }[/math]

and I stopped right there because my expression contains the variable "x" while the solution doesn't.

How can this problem be solved, I am completely stuck.
 
The problem I am dealing with is in the picture:
View attachment 35008

my limited intellect could only conceive of two approaches to solving this problem.
The second approach turned out to be the first approach, but with extra steps. ;(

My Attempt - Find the Pythagorean distance between (x,mx+c) and the origin

[math]d= \sqrt{(x^2)+(mx+c)^2 }[/math]

and I stopped right there because my expression contains the variable "x" while the solution doesn't.

How can this problem be solved, I am completely stuck.
The shortest distance from the origin to the line is the perpendicular distance.

Find the equation of the perpendicular line that contains the origin.
Find the intersecting point of the line y=mx + c and the perpendicular line.
Compute the Euclidean distance between the origin and the intersecting point.
 
Last edited:
The shortest distance from the origin to the line is the perpendicular distance.

Find the equation of the perpendicular line that contains the origin.
Find the intersecting point of the line y=mx + c and the perpendicular line.
Compute the Euclidean distance between the origin and the intersecting point.
I tried something similiar but instead of the perpendicular line that satisfies the origin I found a perpendicular line that satisfies (x,mx+c)

Is that different?
 
I tried something similiar but instead of the perpendicular line that satisfies the origin I found a perpendicular line that satisfies (x,mx+c)

Is that different?
Unless I misunderstood you, (x,mx+c) cannot be a perpendicular line because they have the same slope.

Two lines are said to be perpendicular if their slopes are negative reciprocals of each other. In other words, if the slope of one line is m, then the slope of the perpendicular line is -1/m. It would be easier if you show some attempt, even if it's wrong, to understand your thought process.
 
Hi Al-Layth. If you search keywords shortest distance between line and point, then you'll find a lot of video lessons using actual values. Once you understand that process, you can try doing the same steps using symbolic values. ?
[imath]\;[/imath]
 
oh yeah, thanks. I should have given the problem more thought...

on that note is there an even more general method for finding the shortest distance between a point and a function?

(x,y) and f(x)
Hi Al-Layth. If you search keywords shortest distance between line and point, then you'll find a lot of video lessons using actual values. Once you understand that process, you can try doing the same steps using symbolic values. ?
[imath]\;[/imath]
 
oh yeah, thanks. I should have given the problem more thought...

on that note is there an even more general method for finding the shortest distance between a point and a function?

(x,y) and f(x)
You mean, of course, between a specific point, (a, b), and the graph of a function, y = f(x).

Since the problem is far more general, the method is far more general! You'll learn in calculus how to minimize a function, and can apply that to the distance; or you can find the normal line to the curve and algebraically find where that passes through the point. The more general the problem, the less formulaic the solution.
 
The problem I am dealing with is in the picture:
View attachment 35008
The line [imath]\ell_1:\;y=mx+c[/imath] has slope [imath]m\ne0[/imath]
Any line that is perpendicular to [imath]\;\ell_1\;[/imath] has slope [imath]\dfrac{-1}{m}[/imath]
Hence the line [imath]\ell_2:\;y=\left(\dfrac{-1}{m}\right)x[/imath] passes through the origin and is perpendicular to [imath]\ell_1.[/imath]
Find the point [imath]P=\left\{\ell_2\cap\ell_1\right\}[/imath].
The distance [imath]P[/imath] is from [imath](0,0)[/imath] is the distance from [imath](0,0)\text{ to }\ell_1[/imath]
[imath][/imath][imath][/imath][imath][/imath]
 
I am going to state it a bit differently. We are given the line;

\(\displaystyle y=mx+c\)

Now, as stated, the perpendicular line passing through the origin is:

\(\displaystyle y=-\frac{x}{m}\)

Now you have two equations in two unknowns. Solve this system...what do you get?
 
I would equate the two expressions equal to y:

\(\displaystyle -\frac{x}{m}=mx+c\)

Multiply through by m:

\(\displaystyle -x=m^2x+mc\)

Solve for x:

\(\displaystyle x=-\frac{mc}{m^2+1}\)

Hence:

\(\displaystyle y=\frac{c}{m^2+1}\)

Thus, the distance from the origin to this point is:

\(\displaystyle d=\sqrt{\left(\frac{mc}{m^2+1}\right)^2+\left(\frac{c}{m^2+1}\right)^2}\)

\(\displaystyle d=\frac{c}{\sqrt{m^2+1}}\)
 
The problem I am dealing with is in the picture:
View attachment 35008
and I stopped right there because my expression contains the variable "x" while the solution doesn't.

How can this problem be solved, I am completely stuck.
It could have been possible that the x's will cancel out. Just because you see x's doesn't mean your expression is not a constant. For example x+3-1-x+2=4
 
The problem I am dealing with is in the picture:
View attachment 35008

my limited intellect could only conceive of two approaches to solving this problem.
The second approach turned out to be the first approach, but with extra steps. ;(

My Attempt - Find the Pythagorean distance between (x,mx+c) and the origin

[math]d= \sqrt{(x^2)+(mx+c)^2 }[/math]

and I stopped right there because my expression contains the variable "x" while the solution doesn't.

How can this problem be solved, I am completely stuck.
You failed to note a critical aspect of the problem. We are to find the shortest distance. This is a straight-forward problem of optimization in differential calculus. We need to take your function, find its derivative, set it to zero, and solve for x. There is no reason to assume the resulting derivative has no root.

[math] D = \sqrt{(x - 0)^2 + (mx + c - 0)^2} = \sqrt{(m^2 + 1)x^2 + 2cm x + c^2}.\\ \therefore \ \dfrac{dD}{dx} = 0 \iff \dfrac{2(m^2 + 1)x + 2cm}{2\sqrt{(m^2 + 1)x^2 + 2cmx + c^2}} = 0 \iff \\ 2(m^2 + 1)x + 2cm = 0 \iff x = - \dfrac{cm}{m^2 + 1}.\\ \therefore \ \min(D) = \sqrt{(m^2 + 1) * \left ( - \dfrac{cm}{m^2 + 1} \right )^2 + 2cm * \left (- \dfrac{cm}{m^2 + 1} \right ) + c^2} \implies \\ \min(D) = \sqrt{\dfrac{c^2m^2}{m^2 + 1} - \dfrac{2c^2m^2}{m^2 + 1} + \dfrac{c^2m^2 + c^2}{m^2 + 1}}= c * \sqrt{\dfrac{m^2 - 2m^2 + m^2 + 1}{m^2 + 1}} \implies \\ \min(D) = c * \sqrt{\dfrac{1}{m^2 + 1}} = c(m^2 + 1)^{-1/2}. [/math]
 
You failed to note a critical aspect of the problem. We are to find the shortest distance. This is a straight-forward problem of optimization in differential calculus. We need to take your function, find its derivative, set it to zero, and solve for x. There is no reason to assume the resulting derivative has no root.

[math] D = \sqrt{(x - 0)^2 + (mx + c - 0)^2} = \sqrt{(m^2 + 1)x^2 + 2cm x + c^2}.\\ \therefore \ \dfrac{dD}{dx} = 0 \iff \dfrac{2(m^2 + 1)x + 2cm}{2\sqrt{(m^2 + 1)x^2 + 2cmx + c^2}} = 0 \iff \\ 2(m^2 + 1)x + 2cm = 0 \iff x = - \dfrac{cm}{m^2 + 1}.\\ \therefore \ \min(D) = \sqrt{(m^2 + 1) * \left ( - \dfrac{cm}{m^2 + 1} \right )^2 + 2cm * \left (- \dfrac{cm}{m^2 + 1} \right ) + c^2} \implies \\ \min(D) = \sqrt{\dfrac{c^2m^2}{m^2 + 1} - \dfrac{2c^2m^2}{m^2 + 1} + \dfrac{c^2m^2 + c^2}{m^2 + 1}}= c * \sqrt{\dfrac{m^2 - 2m^2 + m^2 + 1}{m^2 + 1}} \implies \\ \min(D) = c * \sqrt{\dfrac{1}{m^2 + 1}} = c(m^2 + 1)^{-1/2}. [/math]
It would be much much easier to minimize D^2. After all, the min value for D will be when what is under the radical is the least (and non-negative). This is a straight-forward method taught in the optimization section of differential calculus.

Also, in your derivative to find the zero you simply set the numerator equal to 0. A fraction whose numerator is 0 is not necessarily equal to 0.
 
I would use trigonometry for the optimization. Consider two parallel lines a distance k apart, and from one line extend a ray to the other, where

\(\displaystyle \sin(\theta)=\frac{k}{d}\)

Or:

\(\displaystyle d=\frac{k}{\sin(\theta)}\)

The distance d will be minimized where the sine function is maximized, at the orthogonal angle.
 
The problem I am dealing with is in the picture:
View attachment 35008
my limited intellect could only conceive of two approaches to solving this problem.
The second approach turned out to be the first approach, but with extra steps. ;(
This reply is in response to the entire thread. Being that it was posted in the algebra forum and asked about actually deriving the formula, that is why my first reply was rather sparse. This one is more formal.
In analytical geometry a line in the plane is given as [imath]\ell:~\bf{ax+by+c=0}[/imath].
It is usual to state that [imath]\bf{a\cdot b\ne 0}[/imath] which simply means that [imath]\bf{\ell}~[/imath] is neither vertical nor horizonal.
If [imath]P:\left(x_0,y_0\right)[/imath] is a point then the distance of the point to the line is;
[imath]\mathcal{D}(P,~\ell)=\dfrac{\left|ax_0+by_0+c\right|}{\sqrt{a^2+b^2}}[/imath]. That is a well known formula.
If [imath]\bf{a\cdot b= 0}[/imath] then [imath]\bf{a}=0\text{ or }\bf{b}=0[/imath], the line vertical or horizonal. (if both zero there is no line)
Then the distance from [imath](0,0)[/imath] to [imath]\ell[/imath] is the distance from the line's intercept to the origin.
 
Top