# Intersection Of Two Lines In 2D

). To find the Point where 2 lines intersect, is there any simpler method than this?

http://en.wikipedia.org/wiki/Line-line_intersection

For example could you use the equation of the line? (y = mx + b)

Another question: what would happen if I use Determinants for 2 lines that never intersect? (parallel lines). I think I should mention that I intend to do this calculation in a programming language (AS3).

I suppose that those determinants will return something along the lines of division by zero / +/- infinity for parallel lines. I didn't try it yet ::- D. Still trying to figure out the best way to get the intersection point. Determinants or... do you know another method?

-

well you probably want to include vertical lines, so you should have a system of the form $a_1x+b_1y=c_1, a_2x+b_2y=c_2$. if $a_1b_2-a_2b_1=0$ you have parallel (or identical) lines. else return the point of intersection, which is $$(x,y)=\Big(\frac{c_1b_2-b_1c_2}{a_1b_2-b_1a_2},\frac{a_1c_2-c_1a_2}{a_1b_2-b_1a_2}\Big).$$ for instance using cramer's rule. in general, you should take linear algebra at some point if you haven't. you will need it.

-
I took it 10 years ago but I forgot all of it laugh ::- D. – Axonn Mar 5 '11 at 18:10

What about a system of linear equations? Like \begin{aligned}y&=m_1x+b_1\\y&=m_2x+b_2\end{aligned} I actually thought you learn to do this kind of stuff at school... at least I did.

And determinants are just a result because you use an equation system. If there's no solution, you're right, the determinants get zero and if you have to divide it gets infinit at some point. But that could simply be checked with an if statement.

-
It's been a long time since school, heeheh ::- D. – Axonn Mar 5 '11 at 17:58
And using the system, how would I know if the lines intersect or not? – Axonn Mar 5 '11 at 18:09
As I said: if the determinant is zero, there's no solution, so they don't intersect. That's exactly if $m_1b_2-m_2b_1=0$. Actually the answer above is just the "explicit" solution using those determinants according to Cramer's rule. – user7832 Mar 6 '11 at 11:35