Results 1 to 14 of 14
Like Tree5Thanks
  • 1 Post By romsek
  • 1 Post By HallsofIvy
  • 1 Post By Idea
  • 1 Post By Idea
  • 1 Post By Idea

Thread: algebra nightmare

  1. #1
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    algebra nightmare

    Hi folks,


    I am trying to prove that the minimum distance d, between a line L1, $ax + by + c = 0$ and a point $A(x_{1}, y_{1})$ is given by the expression:


    $d = \dfrac{ax_{1} + by_{1} + c}{\sqrt{a^2 + b^2}}$ .......................(1)


    I have already worked out that the distance $d = |\vec{AB}|$ where


    $\vec{AB} = (b \lambda - x_{1})i - (\dfrac{c}{b} + a \lambda - y_{1})j$


    and


    $\lambda = \dfrac{b^2 x_{1} - aby_{1} - ac}{b(a^2 + b^2)}$


    The solution should be straightforward. Substitute $\lambda$ into $\vec{AB}$ and calculate $|\vec{AB}|$.

    The problem is the algebra! I end up with so many terms and they don't cancel or resolve to equation 1.

    It's a big ask to expect anyone to type in the answer but a few hints would be great.
    Last edited by s_ingram; Nov 5th 2017 at 06:40 AM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Jun 2013
    From
    Lebanon
    Posts
    742
    Thanks
    341

    Re: algebra nightmare

    Quote Originally Posted by s_ingram View Post
    Hi folks,


    I am trying to prove that the minimum distance d, between a line L1, $ax + by + c = 0$ and a point $A(x_{1}, y_{1})$ is given by the expression:


    $d = \dfrac{ax_{1} + by_{1} + c}{\sqrt{a^2 + b^2}}$ .......................(1)


    I have already worked out that the distance $d = |\vec{AB}|$ where


    $\vec{AB} = (b \lambda - x_{1})i - (\dfrac{c}{b} + a \lambda - y_{1})j$


    and


    $\lambda = \dfrac{b^2 x_{1} - aby_{1} - ac}{b(a^2 + b^2)}$


    The solution should be straightforward. Substitute $\lambda$ into $\vec{AB}$ and calculate $|\vec{AB}|$.

    The problem is the algebra! I end up with so many terms and they don't cancel or resolve to equation 1.

    It's a big ask to expect anyone to type in the answer but a few hints would be great.
    Substitute \lambda into $AB$ and calculate does not give the correct answer
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    The value of $\lambda$ provided is the value you get by evaluating the scalar product of $\vec{AB}$ and the vector parallel to the line L1 i.e. $bi - aj$ i.e. that value of $\lambda$ that defines a point on L1 that is perpendicular to the point A. Are you saying that this approach is incorrect?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Super Member
    Joined
    Jun 2013
    From
    Lebanon
    Posts
    742
    Thanks
    341

    Re: algebra nightmare

    The approach is fine.
    I assume $B$ is the point on $L_1$ such that $AB$ is perpendicular to $L_1$
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    Exactly.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor
    Joined
    Nov 2013
    From
    California
    Posts
    5,880
    Thanks
    2473

    Re: algebra nightmare

    Quote Originally Posted by s_ingram View Post
    Exactly.
    the squared distance is a parabola with the min distance at it's vertex.

    you have the vector $\left(x,~-\dfrac{a x + c}{b}\right)$, and the point $(x_1, y_1)$

    The squared distance is

    $\left( x - x_1\right)^2 + \left(-\dfrac{a x + c}{b}-y_1\right)^2$

    if you expand all this out, and collect like powers of $x$ you obtain

    $\left(\dfrac{a^2}{b^2}+1\right)x^2 +\left(\dfrac{2 a c}{b^2}+\dfrac{2 a y_1}{b}-2 x_1\right)x + \left(\dfrac{c^2}{b^2}+\dfrac{2 c y_1}{b}+x_1^2+y_1^2\right)$

    and normalizing and simplifying gets you

    $\Large \left(\frac{a^2}{b^2}+1\right) \left(x^2 + \left(\frac{2 \left(a \left(b y_1+c\right)-b^2 x_1\right)}{a^2+b^2}\right)x + \left(\frac{b^2 x_1^2+\left(b y_1+c\right)^2}{a^2+b^2}\right)\right)$

    and the vertex is at $-\dfrac 1 2$ the coefficient of the $x$ term, i.e.

    $\Large x_{min} = -\left(\frac{ \left(a \left(b y_1+c\right)-b^2 x_1\right)}{a^2+b^2}\right)$

    The point of least distance squared is identical to the point of least distance so this $x_{min}$ is the value you are after. Now just do the final chug to get the $y$ value from the definition of your line.
    Thanks from s_ingram
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    Thanks Romsek, this is certainly another way of doing the problem (and the parabola is a nice insight) but you have lost me on the vertex is half the coefficient of the x term. Why is that?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor

    Joined
    Apr 2005
    Posts
    19,415
    Thanks
    2889

    Re: algebra nightmare

    "Completing the square". y= (x- a)^2= x^2- 2ax+ a^2 is a parabola having vertex at (a, 0) so u= x^2- 2ax+ a^2+ b^2 is a parabola having vertex at (a, b). The x-coordinate is half of 2a, the coefficient of x.
    Thanks from s_ingram
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Super Member
    Joined
    Jun 2013
    From
    Lebanon
    Posts
    742
    Thanks
    341

    Re: algebra nightmare

    Quote Originally Posted by s_ingram View Post
    The value of $\lambda$ provided is the value you get by evaluating the scalar product of $\vec{AB}$ and the vector parallel to the line L1 i.e. $bi - aj$ i.e. that value of $\lambda$ that defines a point on L1 that is perpendicular to the point A. Are you saying that this approach is incorrect?
    we could say that AB is parallel to the vector (a,b) rather than saying it is perpendicular to (-b,a) so we get

    $\text{AB}=\left(x_2-x_1,y_2-y_1\right)= \mu (a,b)$ for some $\mu$ where $B\left(x_2,y_2\right)$

    Then solve the system

    $|\text{AB}|=|\mu |\sqrt{a^2+b^2}$

    and

    $a x_2+b y_2+c=0$

    giving the result

    $d=\frac{\left|a x_1+b y_1+c\right|}{\sqrt{a^2+b^2}}$
    Last edited by Idea; Nov 6th 2017 at 04:07 AM.
    Thanks from s_ingram
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    Very neat. You guys have all got great ways of solving this problem and this has been very helpful, so many thanks.
    But my original question was about solving the algebraic nightmare that arose from trying to solve the problem in the way that was originally posed.
    So, for a line $\vec{r} = \left( \begin{array}{c} 0 \\ -c/b \end{array} \right) + \lambda \left( \begin{array}{c} b \\ -a \end{array} \right)$ and a point $A (x_{1}, y_{1})$
    I got the value of lambda required (see above) and the question said, and hence show that d = equation 1 from above. I am still left with my algebraic nightmare.
    Last edited by s_ingram; Nov 6th 2017 at 06:10 AM.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Super Member
    Joined
    Jun 2013
    From
    Lebanon
    Posts
    742
    Thanks
    341

    Re: algebra nightmare

    I replaced \lambda in AB as you indicated in your original post and this is what I got

    \frac{c^2+2 a c x_1+a^2 x_1^2-2 b c y_1-2 a b x_1 y_1+4 a^2 y_1^2+b^2 y_1^2}{a^2+b^2}

    We are supposed to get this

    \frac{c^2+2 a c x_1+a^2 x_1^2+2 b c y_1+2 a b x_1 y_1+b^2 y_1^2}{a^2+b^2}

    which when factored gives

    \frac{\left(a x_1+b y_1+c\right){}^2}{a^2+b^2}
    and that is the correct answer

    I presume that there is an error in your calculations of AB and/or \lambda

    and that is the source of the nightmare

    I think we can sort this out if you tell us how you got AB and \lambda

    EDIT: in the expression for AB you should have +y_1 and not -y_1

    Note: (1) Don't forget the absolute value in your final answer

    (2) Case b=0 should be considered separately
    Last edited by Idea; Nov 6th 2017 at 07:04 AM.
    Thanks from s_ingram
    Follow Math Help Forum on Facebook and Google+

  12. #12
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    Idea, thanks for this.

    I used the value of $\vec{AB}$ in the original post and took $\vec{AB}. \vec{m} = 0$ where $\vec{m}$ is the gradient vector bi - aj for a positive gradient. This gave a value for $\lambda$ that was provided in the question exactly as quoted in the original post. So, if there is an error it will be in AB, although AB was validated by giving the correct value of $\lambda$!
    My problem is that $\vec{AB}$ of the form: si - tj and $|AB| = \sqrt{s^2 + t^2}$ the t term is $-( \dfrac{c}{b} + \dfrac{ab^2x_{1} - a^2by_{1} - a^2c}{b(a^2 + b^2)} - \dfrac{y_{1}}{1} )$ and when I square it the number of terms takes off.
    Last edited by s_ingram; Nov 6th 2017 at 08:25 AM.
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Super Member
    Joined
    Jun 2013
    From
    Lebanon
    Posts
    742
    Thanks
    341

    Re: algebra nightmare

    see my previous post. I added something

    If you change the -y_1 to +y_1 it works.

    AB=\left\{\left(b \lambda  -x_1\right),-\left(\frac{c}{b}+a \lambda +y_1\right)\right\}

    You do get a huge expression but it is a perfect square.

    \lambda =\frac{b^2x_1-a b y_1-a c}{b\left(a^2+b^2\right)} is OK
    Thanks from s_ingram
    Follow Math Help Forum on Facebook and Google+

  14. #14
    Member
    Joined
    May 2009
    Posts
    178
    Thanks
    2

    Re: algebra nightmare

    many thanks Idea! You are perfectly right, I see I dropped a sign.
    Now the fun starts. To verify the whole thing, but you have been great. When I saw the expression getting so large, I was convinced I was on the wrong track completely. Now you have confirmed that this is the way to go, so I will slog through it.
    Great!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. A statistical nightmare
    Posted in the Advanced Statistics Forum
    Replies: 0
    Last Post: Sep 16th 2009, 07:50 PM
  2. Integrals Nightmare
    Posted in the Calculus Forum
    Replies: 10
    Last Post: Oct 16th 2008, 10:01 AM
  3. Double Pendulum Nightmare
    Posted in the Calculus Forum
    Replies: 1
    Last Post: Sep 17th 2008, 06:10 AM
  4. nightmare integral
    Posted in the Calculus Forum
    Replies: 1
    Last Post: Apr 19th 2008, 07:05 PM
  5. foil nightmare within mods
    Posted in the Advanced Algebra Forum
    Replies: 3
    Last Post: Sep 26th 2007, 12:04 PM

/mathhelpforum @mathhelpforum