To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
The technical storage or access that is used exclusively for statistical purposes.
The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
3 Responses
Project P onto the direction v = B−A: t = ((P−A)·v)/(v·v) and foot H = A + t v; here v=(4,1), (P−A)=(1,5), so t=9/17 and H=(53/17, 43/17). Think of it as P’s shadow dropped onto AB by a light shining perpendicular to the line; see vector projections at https://www.khanacademy.org/math/linear-algebra/vectors-and-spaces/dot-cross-products/a/linear-algebra-vector-projections.
Use the orthogonal projection onto the direction of the line. Let v = B − A and t = ((P − A) · v)/(v · v); then the foot F is A + t v. Here A = (1,2), B = (5,3), P = (2,7). So v = (4,1) and P − A = (1,5). Compute the dot products: (P − A) · v = 1·4 + 5·1 = 9, and v · v = 4^2 + 1^2 = 17, so t = 9/17. Therefore F = A + (9/17)v = (1,2) + (9/17)(4,1) = (1 + 36/17, 2 + 9/17) = (53/17, 43/17). Quick check: F − P is proportional to (1, −4), which is perpendicular to v = (4,1), so it’s consistent. Hope this helps!
Love this question! When I think “foot of the perpendicular,” I imagine dropping the shadow of point P onto the line through A and B, using the direction the line is already pointing. Vectors make this super clean: you just slide along the line by exactly the right amount.
Here’s the vector recipe
– Direction of the line: v = B − A
– From A to your point: w = P − A
– How far to slide along the line (the “dimmer switch”): t = (w · v) / (v · v)
– Foot of the perpendicular (the point on the line): F = A + t v
Why this works: You’re projecting w onto v. The projection tells you exactly how much of w points along the line, and that’s where the foot lands.
Now let’s do your example
– A = (1, 2), B = (5, 3), P = (2, 7)
– v = B − A = (5 − 1, 3 − 2) = (4, 1)
– w = P − A = (2 − 1, 7 − 2) = (1, 5)
– Dot products: w · v = 1·4 + 5·1 = 9, and v · v = 4² + 1² = 17
– So t = 9/17
– Foot: F = A + t v = (1, 2) + (9/17)(4, 1)
= (1 + 36/17, 2 + 9/17)
= (53/17, 43/17)
That’s the point on the line AB closest to P.
Quick check (for peace of mind!)
The vector from F to P should be perpendicular to v = AB.
– PF = F − P = (53/17 − 2, 43/17 − 7) = (19/17, −76/17)
– v · PF = (4, 1) · (19/17, −76/17) = (76 − 76)/17 = 0
Perfect: perpendicular!
Notes and extras
– If you care about the foot on the segment AB (not the whole line), check t:
– If 0 ≤ t ≤ 1, it’s on the segment.
– If t < 0, the closest point on the segment is A. - If t > 1, the closest point on the segment is B.
– Same formula works in any dimension. Just keep your dot products handy.
So the vector-y way is: project (P − A) onto (B − A), then add to A. In your example, the foot is F = (53/17, 43/17).