Entry tags:
Distance from a point to a line
This was something covered in pre-calculus, way back in 7th grade. Like most of precalc, it didn't leave a deep conscious impression on me. Or much of any impression, in this case. In my new hobby of revisiting math fundamentals, largely in bed, I tried to figure it out in my head, got annoyed, and looked it up. The formula isn't bad, though not one I was working toward (it uses Ax+By+C=0 lines, I was using y=mx+b), but the proofs I saw were pretty grotty. I came up with a new one I like more.
Simplify! Skipping the *really* simple stages, of horizontal and vertical lines, what's the distance from a line to the origin? Combining the two representations, the line is y=-Ax/B -C/B. A perpendicular line from the origin is y=Bx/A. Via algebra, he point of intersection is x=CA/(A^2+B^2), y=CB/(A^2+B^2). The distance from that to the origin is |C|/sqrt(A^2+B^2). (Adding |absolute value| because distances must be positive, also this C is actually a square root of C^2 from the Euclidean distance formula, so of course pick the positive root.)
Now, given a line and some other point (X,Y), we just have to translate the system so the point coincides with the origin. This turns the line into A(x-(-X))+B(y-(-Y))+C= Ax+AX+By+BY+C=Ax+By+(AX+BY+C)=0 Applying the previous result, the distance is |AX+BY+C|/sqrt(A^2+B^2). Voila!
I need a math icon.
Simplify! Skipping the *really* simple stages, of horizontal and vertical lines, what's the distance from a line to the origin? Combining the two representations, the line is y=-Ax/B -C/B. A perpendicular line from the origin is y=Bx/A. Via algebra, he point of intersection is x=CA/(A^2+B^2), y=CB/(A^2+B^2). The distance from that to the origin is |C|/sqrt(A^2+B^2). (Adding |absolute value| because distances must be positive, also this C is actually a square root of C^2 from the Euclidean distance formula, so of course pick the positive root.)
Now, given a line and some other point (X,Y), we just have to translate the system so the point coincides with the origin. This turns the line into A(x-(-X))+B(y-(-Y))+C= Ax+AX+By+BY+C=Ax+By+(AX+BY+C)=0 Applying the previous result, the distance is |AX+BY+C|/sqrt(A^2+B^2). Voila!
I need a math icon.