0
$\begingroup$

I wanted to derive the formula to give the point of intersection of two lines, each defined by a pair of points. I got the wrong answer and cannot find the error. Which drives me crazy. I don't how how it could be more straightforward. I can get the answer off Wikipedia but I want to know what I did wrong.

I started by constraining the point of intersection $p$ to be colinear with both pairs ($a$ and $b$, $c$ and $d$).

Equating the slopes: $\dfrac{p_y - a_y}{p_x - a_x} = \dfrac{b_y - a_y}{b_x - a_x}$ and $\dfrac{p_y - c_y}{p_x - c_x} = \dfrac{d_y - c_y}{d_x - c_x}$

Solving for $p_y$: $p_y = \dfrac{b_y - a_y}{b_x - a_x}(p_x - a_x) + a_y$ and $p_y = \dfrac{d_y - c_y}{d_x - c_x}(p_x - c_x) + c_y$

Equating the two expressions and solving for $p_x$:

$\dfrac{b_y - a_y}{b_x - a_x}(p_x - a_x) + a_y = \dfrac{d_y - c_y}{d_x - c_x}(p_x - c_x) + c_y$ $p_x\left(\dfrac{b_y - a_y}{b_x - a_x}-\dfrac{d_y - c_y}{d_x - c_x}\right) = a_x\dfrac{b_y - a_y}{b_x - a_x} - a_y - c_x\dfrac{d_y - c_y}{d_x - c_x} + c_y$ $p_x = \dfrac{a_x\dfrac{b_y - a_y}{b_x - a_x} - a_y - c_x\dfrac{d_y - c_y}{d_x - c_x} + c_y}{\dfrac{b_y - a_y}{b_x - a_x}-\dfrac{d_y - c_y}{d_x - c_x}}$

This result for $p_x$ did not give me the expected values for the point of intersection in my graphing software. Wikipedia has:

$p_x = \dfrac{(a_xb_y - a_yb_x)(c_x - d_x) - (a_x - b_x)(c_xd_y - c_yd_x)}{(a_x - b_x)(c_y - d_y) - (a_y - b_y)(c_x - d_x)}$

Rearranged to highlight the differences:

$p_x = \dfrac{\dfrac{c_xd_y - c_yd_x}{d_x - c_x} - \dfrac{a_xb_y - a_yb_x}{b_x - a_x}}{\dfrac{b_y - a_y}{b_x - a_x} - \dfrac{d_y - c_y}{d_x - c_x}}$

While that expression was derived from determinants, I'd really appreciate knowing where I went wrong the way I was doing it.

  • 0
    Oh, I understand. But apparently I was wrong about being wrong. How's that for embarrassing?2011-10-07

1 Answers 1

1

Actually the solutions for $p_x$ you found does agree with that of wikipedia, because

$ \begin{multline} \left(a_x\dfrac{b_y - a_y}{b_x - a_x} - a_y\right) - \left(c_x\dfrac{d_y - c_y}{d_x - c_x} - c_y\right) =\\ \left( \dfrac{a_x(b_y - a_y)-a_y(b_x-a_x)}{b_x - a_x} \right) - \left( \dfrac{c_x(d_y - c_y)-c_y(d_x-c_x)}{d_x - c_x} \right) = \\ \left( \dfrac{a_x b_y -a_y b_x}{b_x - a_x} \right) - \left( \dfrac{c_x d_y -c_y d_x}{d_x - c_x} \right) \end{multline}$

Also in Mathematica:

enter image description here