Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question is following. I have a line with a given (X1, Y1) and (X2, Y2) coordinates (see figure below). I need to calculate coordinates of the middle of this line (X, Y). I tried to use classical method of finding distance between two coordinates, but it works only when the line is situated horizontally.

Could anybody help me with a formula to find coordinates of the middle of a given line please?

Thanks beforehand.


share|cite|improve this question
Generalization: You can get any point along the line by doing a weighted average of the vectors (e.g. $0.1*p1 + 0.9*p2$, to get 90% of the way towards p2). – ninjagecko Jun 8 '11 at 20:56

You can just average the points: $x = \dfrac{x_1 + x_2}{2}$ $y = \dfrac{y_1 + y_2}{2}$

share|cite|improve this answer

The midpoint formula

share|cite|improve this answer
Mr Anderson: Didn't I hear you say, "I'd have to comment..." a while ago? On the other hand: what is a tongue good for if you're unable to spea..k? Yes, I know you're Mr Smith, but I prefer to call you Anderson. – t.b. Jun 7 '11 at 15:36
@Theo: HAH! My (gr)avatar came about after a not-so-subtle rivalry popped up between me and another moderator ("johnny" - after johnny mnemonic) on - but apparently Mr. Smith doesn't prevail in the end /: – The Chaz 2.0 Jun 7 '11 at 15:40
:) That "tongue" should have been a "phone call"... sorry about that. – t.b. Jun 7 '11 at 15:42

Your Answer


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.