Results 1 to 13 of 13

Math Help - Intersection of two lines - simultaneous equations problem

  1. #1
    Newbie
    Joined
    Apr 2011
    Posts
    8

    Intersection of two lines - simultaneous equations problem

    Hi,

    I'm currently teaching myself a lot of math while working through a book on maths and physics for game programmers. I've had to start from scratch and currently have worked through from linear algebra, trig and now vectors. I'm afraid the book that I have skirts over a lot of detail, which I'm not happy with, so I often have to trawl the Internet for further explanation.

    I've hit on a problem that I can't find the answer for so hopefully someone on this forum could point me in the right direction?

    So, I'm going through the chapter on vectors and looking at using algebra with vectors to calculate where 2 lines intersect. There a four position vectors (a,b,c,d) of the four points A, B, C, D. These are drawn in a figure, where a line from A to B crosses over a line from C to D. The book lists two linear simultaneous equations for solving the problem:

    1. t(b1 - a1) + s(c1 - d1) = c1 - a1
    2. t(b2 - a2) + s(c2 - d2) = c2 - a2

    For the life of me, I can't solve these equations. I don't have to, but I'd like to as I want to know why it works.

    Can anyone help me get started, I can solve t for equation 1 and then substitute t in equation 2 to try and solve s, but then I'm stuck!

    Thanks in advance for anyone who can help.

    GM
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,404
    Thanks
    1293
    Quote Originally Posted by GamerMath View Post
    Hi,

    I'm currently teaching myself a lot of math while working through a book on maths and physics for game programmers. I've had to start from scratch and currently have worked through from linear algebra, trig and now vectors. I'm afraid the book that I have skirts over a lot of detail, which I'm not happy with, so I often have to trawl the Internet for further explanation.

    I've hit on a problem that I can't find the answer for so hopefully someone on this forum could point me in the right direction?

    So, I'm going through the chapter on vectors and looking at using algebra with vectors to calculate where 2 lines intersect. There a four position vectors (a,b,c,d) of the four points A, B, C, D. These are drawn in a figure, where a line from A to B crosses over a line from C to D. The book lists two linear simultaneous equations for solving the problem:

    1. t(b1 - a1) + s(c1 - d1) = c1 - a1
    2. t(b2 - a2) + s(c2 - d2) = c2 - a2

    For the life of me, I can't solve these equations. I don't have to, but I'd like to as I want to know why it works.

    Can anyone help me get started, I can solve t for equation 1 and then substitute t in equation 2 to try and solve s, but then I'm stuck!

    Thanks in advance for anyone who can help.

    GM
    The substitution method should work, but the elimination method is more commonly used.

    Say you want to eliminate the \displaystyle t values - you need to multiply all of equation 1 by \displaystyle (b_2 - a_2) and multiply all of equation 2 by \displaystyle (b_1 - a_1). This will make the coefficients of \displaystyle t equal, and you should then be able to eliminate \displaystyle t and solve for \displaystyle s. Then solve for \displaystyle t.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2011
    Posts
    8
    Quote Originally Posted by Prove It View Post
    The substitution method should work, but the elimination method is more commonly used.

    Say you want to eliminate the \displaystyle t values - you need to multiply all of equation 1 by \displaystyle (b_2 - a_2) and multiply all of equation 2 by \displaystyle (b_1 - a_1). This will make the coefficients of \displaystyle t equal, and you should then be able to eliminate \displaystyle t and solve for \displaystyle s. Then solve for \displaystyle t.
    Hey, thanks for taking the time to answer this. I'm a bit closer now, but not quite there, due to being a bit of a newb at linear algebra.

    So the equations become:

    1.) t(b1 - a1)(b2 - a2) + s(c1 - d1)(b2 - a2) = c1 - a1(b2 - a2)
    2.) t(b2 - a2)(b1 - a1) + s(c1 - d1)(b1 - a1) = c2 - a2(b1 - a1)

    I then try to subtract 2 from 1 and can see that t's are eliminated to get:

    s(c1 - d1)(b2 - a2) - s(c1 - d1)(b1 - a1) = c1 - a1(b2 - a2) - c2 - a2(b1 - a1)

    It's the next bit where I come unstuck. I end up with

    s + s = c1 - a1(b2 - a2) - c2 - a2(b1 - a1) / (c1 - d1)(b2 - a2) + (c1 - d1)(b1 - a1)

    Any more hints much appreciated

    GM
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,404
    Thanks
    1293
    Quote Originally Posted by GamerMath View Post
    Hey, thanks for taking the time to answer this. I'm a bit closer now, but not quite there, due to being a bit of a newb at linear algebra.

    So the equations become:

    1.) t(b1 - a1)(b2 - a2) + s(c1 - d1)(b2 - a2) = (c1 - a1)(b2 - a2)
    2.) t(b2 - a2)(b1 - a1) + s(c1 - d1)(b1 - a1) = (c2 - a2)(b1 - a1)

    I then try to subtract 2 from 1 and can see that t's are eliminated to get:

    s(c1 - d1)(b2 - a2) - s(c1 - d1)(b1 - a1) = (c1 - a1)(b2 - a2) - (c2 - a2)(b1 - a1)
    Correct up to here with the necessary brackets. Now you need to expand all the brackets, so that you can collect the like terms of s.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    Dec 2009
    Posts
    226
    Could you factor the right-hand side like so

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right]

    and then divide by the equation by second factor? Or will you eventually have to expand anyway?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Apr 2011
    Posts
    8
    Quote Originally Posted by Prove It View Post
    Correct up to here with the necessary brackets. Now you need to expand all the brackets, so that you can collect the like terms of s.
    I'm probably doing something horribly wrong here. When I expand the brackets I get:

    sc1b1 - sc1a2 - sd1b2 + sd1a2 - sc1b1 - sc1a1 - sd1b1 + sd1a1 =
    c1b2 - c1a2 - a1b2 + a1a2 - c2b1 -c2a1 - a2b1 +a2a1

    Anywhere near? No wonder the author of my book didn't show how to solve them!
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,404
    Thanks
    1293
    Looks fine so far, so now you'll see there's a common factor of \displaystyle s on the LHS...
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Apr 2011
    Posts
    8
    Quote Originally Posted by Prove It View Post
    Looks fine so far, so now you'll see there's a common factor of \displaystyle s on the LHS...
    Thanks for the clue, but I think I need another one
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Member
    Joined
    Dec 2009
    Posts
    226
    Starting here

    s(c_1 - d_1)(b_2 - a_2) - s(c_1 - d_1)(b_1 - a_1) = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    notice the common factor of s of both terms on the right hand side.

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Does that make sense? If not, then try the following simpler example:

    sa + sb = s(a + b)

    Once you are comfortable with the previous steps, let's return the following equation:

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Divide both sides of the equation by (c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1) to solve the equation in terms of \displaystyle s.

    s = \dfrac{(c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)}{(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)}

    I don't know if expanding the terms in the numerator and denominator would simplify the solution, so I would leave the solution as is.
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,404
    Thanks
    1293
    Quote Originally Posted by NOX Andrew View Post
    Starting here

    s(c_1 - d_1)(b_2 - a_2) - s(c_1 - d_1)(b_1 - a_1) = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    notice the common factor of s of both terms on the right hand side.

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Does that make sense? If not, then try the following simpler example:

    sa + sb = s(a + b)

    Once you are comfortable with the previous steps, let's return the following equation:

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Divide both sides of the equation by (c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1) to solve the equation in terms of \displaystyle s.

    s = \dfrac{(c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)}{(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)}

    I don't know if expanding the terms in the numerator and denominator would simplify the solution, so I would leave the solution as is.
    I only suggested expanding everything so that only the important common factor would stand out...
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Junior Member
    Joined
    Nov 2009
    Posts
    33
    Two lines never intersect unless different slope unless indefinite number of solutions.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Newbie
    Joined
    Apr 2011
    Posts
    8
    Quote Originally Posted by NOX Andrew View Post
    Starting here

    s(c_1 - d_1)(b_2 - a_2) - s(c_1 - d_1)(b_1 - a_1) = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    notice the common factor of s of both terms on the right hand side.

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Does that make sense? If not, then try the following simpler example:

    sa + sb = s(a + b)

    Once you are comfortable with the previous steps, let's return the following equation:

    s\left[(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)\right] = (c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)

    Divide both sides of the equation by (c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1) to solve the equation in terms of \displaystyle s.

    s = \dfrac{(c_1 - a_1)(b_2 - a_2) - (c_2 - a_2)(b_1 - a_1)}{(c_1 - d_1)(b_2 - a_2) - (c_1 - d_1)(b_1 - a_1)}

    I don't know if expanding the terms in the numerator and denominator would simplify the solution, so I would leave the solution as is.
    Thanks for this. I can see exactly why it works now. As I said, I'm a newbie. I've covered factoring expressions, but couldn't see the wood for the trees with this one even though I was being pointed towards it!
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Newbie
    Joined
    Apr 2011
    Posts
    8
    Quote Originally Posted by Prove It View Post
    I only suggested expanding everything so that only the important common factor would stand out...
    Thanks for your help. I can see exactly why you did it now!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. simultaneous equations problem
    Posted in the Pre-Calculus Forum
    Replies: 5
    Last Post: January 27th 2010, 03:34 AM
  2. Replies: 1
    Last Post: October 7th 2008, 07:48 PM
  3. problem simultaneous equations
    Posted in the Math Topics Forum
    Replies: 4
    Last Post: June 30th 2008, 12:17 AM
  4. Intersection of Lines problem
    Posted in the Calculus Forum
    Replies: 1
    Last Post: June 3rd 2008, 12:49 AM
  5. Replies: 3
    Last Post: April 23rd 2008, 08:24 PM

Search Tags


/mathhelpforum @mathhelpforum