1
$\begingroup$

This is the question I am trying to solve. I do not need any code examples just help on mathematics.

Suppose two line segments intersect. The two endpoints for the first line segment are $(x_1, y_1)$ and $(x_2, y_2)$ and for the second line segment are $(x_3, y_3)$ and $(x_4, y_4)$. Write a program that prompts the user to enter these four endpoints and displays the intersecting point. (Hint: Use the LinearEquation class from the preceding exercise.)

For the program to work I have to convert the endpoints of the lines into $a$, $b$, $c$, $d$, $e$, and $f$ so I can use the quadratic equation: $$x = \frac{(ed - bf)}{(ad - bc)} \\ \text{ } \\ y = \frac{(af - ec)}{(ad - bc)}$$

I cannot for the life of me through use of Google and such figure out how to convert the endpoints of each line into the variables I need for that equation. I have the class LinearEquation to use I just need to figure out how to solve for the variables in it. Any help would be greatly appreciated. This is not homework by the way, I have been self teaching myself Java so I don't have many resources. Thanks ahead of time!

P.S. I do not need any code examples. I am just really looking for someone to point me in the right direction on the mathematics behind how to do this. I have been looking for too long with no real answer.

  • 0
    I've changed [tag:algebra] tag to [tag:algebra-precalculus], since we don't use algebra tag anymore, see [meta](http://meta.math.stackexchange.com/questions/473/the-use-of-the-algebra-tag/3081#3081) for details.2012-08-26

2 Answers 2