Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am struggling to understand an equation given in an academic paper (in atmospheric sciences/geography) that I am reading. The paper defines a line, called the Clear Line, which is derived through linear regression of a number of points. They state that

the transformation that quantifies the perpendicular displacement of a point from this line with be given by: $d = x \sin \theta - y \cos \theta$, where $\theta$ is the slope angle of the line.

I understand this to mean that the given equation should tell me the perpendicular distance from the point to the line. I have two problems: I can't see how this works, and it gives me different answers to other formulae that I do understand.

The diagram below shows a point (A) and two lines, $y = x$ and $y = x + 6$. Obviously the distance from the point (the dotted line) should be longer for $y = x + 6$ than it should be for $y = x$, but the formula given in the paper gives the same result for both. Of course this is the case, as the formula takes into account three of the four variables involved (gradient of the line and x and y locations of the point, but not the y-intercept of the line).

enter image description here

So, I have two questions:

  1. Am I correct in stating that the formula given in the paper does not calculate the distance from the point to the line.

  2. Given that it doesn't do that - what does it do? I assume it does something relevant (either that or the paper is completely wrong!) - but I can't seem to work out what it does by using trigonometry, constructing various triangles, and trying to understand where the equation came from - but I can't work it out!. It does seem to produce an answer that is vageuly related to the direction (if we just look at lines of different gradients - ignoring the intercepts - it seems to give a result which is related to the distance from the line).

Any ideas would be much appreciated!

share|improve this question
    
What is your software for sketching the plots? –  Ned Dabby Jan 5 '13 at 16:14
    
I used GeoGebra - see geogebra.org/cms –  robintw Jan 5 '13 at 19:19
add comment

1 Answer 1

up vote 1 down vote accepted

Distance of a point $(x_0,y_0)$ from a line $ax+by+c=0$ is $|ax_0+by_0+c|/\sqrt{a^2+b^2}$. You can write the equation of a line as $x\sin(\theta)-y\cos(\theta)+d=0$ where $\theta$ is angle with $x$ axis and $d$ is signed distance of origin from the line. Then distance of the point $P_0=(x_0,y_0)$ from the line will be $D_0=|x_0\sin(\theta)-y_0\cos(\theta)+d|$.

Edit 1:

Suppose you have the line $y=x+6$ and you want to write it in angle $\theta$ format.

a) Write this equation by bringing all terms to one side, as in $x-y+6=0$, now comparing with our blueprint $ax+by+c=0$ we have $a=1,b=-1,c=6$.

b) Find angle $\theta$ , in $[0,180)$ range, so that $\sin \theta=a/\sqrt{a^2+b^2}$. Here $\sin \theta=1/\sqrt{1^2+1^2}=1/\sqrt 2$. A calculator could be used to get $\theta$ but in this case we know from geometry $\theta=45^\circ$. In general $\theta=\sin^{-1} (a/\sqrt{a^2+b^2})$. Here $\sin^{-1}$ is a function that is available on most programs as $asin$ or $arcsin$ or $inv\ sin$, etc.

c) To get the $d$ in $x\sin(\theta)-y\cos(\theta)+d=0$ simply use $d=c/\sqrt{a^2+b^2}$. So to convert $x-y+6=0$ we divide the equation by $\sqrt{a^2+b^2}$, which is $\sqrt 2$ in our example, to get $1/\sqrt 2 \ x-1/\sqrt 2 \ y+6/\sqrt2=0$. Now comparing against $x\sin(\theta)-y\cos(\theta)+d=0$ we have $\sin \theta =1/\sqrt 2$, $\cos\theta=1/\sqrt 2$, and $d=6/\sqrt 2$. The meaning of $d$ here is the length of line segment that starts from origin and ends perpendicular to the original line $y=x+6$.

share|improve this answer
    
Thanks. Can you confirm what $d$ should be? Is it just the y-intercept? I have tried plotting the $x \sin \theta - y \cos \theta + d = 0$ for various values of $d$, and it seems to change the angle of the line, as well as the y-intercept of the line (and $d$ doesn't seem to be the y-intercept). Any ideas? –  robintw Jan 4 '13 at 12:40
    
Here is another formulation you might find easier to use. If the equation of line is $y=mx+b$ then distance of $(x_0,y_0)$ from it will be $d=|y_0-mx_0-b|/\sqrt{1+m^2}$. For example the distance of the point $(9,3)$ from the line $y=x+6$ is $d=|3-1*9-6|/\sqrt{1+1^2}=12/\sqrt{2}=6\sqrt{2}$, which agrees with your picture. –  Maesumi Jan 4 '13 at 23:15
    
Thanks for the other formulation. You're right, I do understand that more, but unfortunately I need to understand the other formulation too - as the paper I am basing some of my work on uses it, and I need to understand the consequences of them not having the $+ d$ on the end of their equation. I can see that the line $y =x $ can be represented as $x \sin \theta - y \cos \theta = 0$, but I can't see how the $+ d$ bit works. It doesn't seem to behave like the y-intercept - so how, for example, should I represent $y = x + 6$ in the $\sin$ and $\cos$ formulation? –  robintw Jan 5 '13 at 17:21
    
Their equation is not standard/correct. An equation means equality of two quantities. If they are dropping one side it is probably because they assume it is known implicitly. But it is not clear to me what they mean. In my first answer $d$ is the perpendicular distance of origin from the given line (it is not $y$ or $x$ intercept). If there is no such thing in their paper then it likely means their line or main line is going through origin and hence $d=0$, as in your line $y=x$. In my comment $d$ is the distance of $(x_0,y_0)$ from the line. I'll edit my answer to add an example. –  Maesumi Jan 6 '13 at 0:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.