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

I have a two points, $A(x_1,y_1)$ and $B(x_2,y_2)$. They are united with a line.

Now I have a 3rd and 4th point $C(x_3,y_3)$, $D(x_4,y_4)$. The line formed by CD is going to intercept AB in point $E(x_5,y_5)$.

I know everything except $y_3, y_4$ and $y_5$, also $x_3, x_4, x_5$ are equal.

How do I find that $y_3,y_4,y_5$? Is there a formula?


share|cite|improve this question
up vote 1 down vote accepted

Point $E=(x_5,y_5)$ is the intersection of the line $AB$ with the $CD$ (which we know to be perpendicular to the X-axis because $x_3=x_4$). So a formula for the line $AB$ is $$(x_1-x_2)y= (y_1-y_2)x + y_1(x_1-x_2) - x_1(y_1-y_2)$$

and so $$y_5= \frac{(y_1-y_2)x_5 + y_1(x_1-x_2) - x_1(y_1-y_2)}{x_1-x_2}$$

You can't find $y_3$ and $y_4$ because the only thing you know about points $C$ and $D$ is that they lie in the same vertical line and the construction does not change if you move them along that same line (try drawing it).

share|cite|improve this answer
This actually came from a drawing. I'll test it out later, thanks a lot for now. I was testing to see if I can make a line AB jump on a randomly generated line CD, sort of like in a platforming game, but on canvas and without using foreign libraries - I hit that bump. – Andrei Cristian Prodan Jan 15 '13 at 12:54

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.