Another way to write equation of the line passing through two points?











up vote
2
down vote

favorite












I am trying to write equation of the line passing through two points pA={1, -3} and pB={-33, -1} in the form x+17 y+50=0. I tried



{pA, pB} = {{1, -3}, {-33, -1}};
u = pB - pA;
m = {x, y};
v = m - pA;
d = Det[{u, v}];
w = {Coefficient[d, x], Coefficient[d, y]};
k = GCD[Coefficient[d, x], Coefficient[d, y]];
If[w[[1]] != 0, n = Sign[w[[1]]] w/k,
If[w[[2]] != 0, n = Sign[w[[2]]] w/k]];
TraditionalForm[Expand[n.v]] == 0


I got




x+17 y+50==0




Is there another way to write it?










share|improve this question
























  • Write or solve?
    – Kuba
    15 hours ago










  • @Kuba Write the equation of the line passing through two points.
    – minhthien_2016
    15 hours ago










  • You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
    – Kuba
    15 hours ago








  • 1




    Isn't 17 x-y-20==0 already in that form?
    – Kuba
    15 hours ago






  • 1




    You can multiply sides by a constant but I fail to see how it is a Mathematica question.
    – Kuba
    15 hours ago















up vote
2
down vote

favorite












I am trying to write equation of the line passing through two points pA={1, -3} and pB={-33, -1} in the form x+17 y+50=0. I tried



{pA, pB} = {{1, -3}, {-33, -1}};
u = pB - pA;
m = {x, y};
v = m - pA;
d = Det[{u, v}];
w = {Coefficient[d, x], Coefficient[d, y]};
k = GCD[Coefficient[d, x], Coefficient[d, y]];
If[w[[1]] != 0, n = Sign[w[[1]]] w/k,
If[w[[2]] != 0, n = Sign[w[[2]]] w/k]];
TraditionalForm[Expand[n.v]] == 0


I got




x+17 y+50==0




Is there another way to write it?










share|improve this question
























  • Write or solve?
    – Kuba
    15 hours ago










  • @Kuba Write the equation of the line passing through two points.
    – minhthien_2016
    15 hours ago










  • You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
    – Kuba
    15 hours ago








  • 1




    Isn't 17 x-y-20==0 already in that form?
    – Kuba
    15 hours ago






  • 1




    You can multiply sides by a constant but I fail to see how it is a Mathematica question.
    – Kuba
    15 hours ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am trying to write equation of the line passing through two points pA={1, -3} and pB={-33, -1} in the form x+17 y+50=0. I tried



{pA, pB} = {{1, -3}, {-33, -1}};
u = pB - pA;
m = {x, y};
v = m - pA;
d = Det[{u, v}];
w = {Coefficient[d, x], Coefficient[d, y]};
k = GCD[Coefficient[d, x], Coefficient[d, y]];
If[w[[1]] != 0, n = Sign[w[[1]]] w/k,
If[w[[2]] != 0, n = Sign[w[[2]]] w/k]];
TraditionalForm[Expand[n.v]] == 0


I got




x+17 y+50==0




Is there another way to write it?










share|improve this question















I am trying to write equation of the line passing through two points pA={1, -3} and pB={-33, -1} in the form x+17 y+50=0. I tried



{pA, pB} = {{1, -3}, {-33, -1}};
u = pB - pA;
m = {x, y};
v = m - pA;
d = Det[{u, v}];
w = {Coefficient[d, x], Coefficient[d, y]};
k = GCD[Coefficient[d, x], Coefficient[d, y]];
If[w[[1]] != 0, n = Sign[w[[1]]] w/k,
If[w[[2]] != 0, n = Sign[w[[2]]] w/k]];
TraditionalForm[Expand[n.v]] == 0


I got




x+17 y+50==0




Is there another way to write it?







output-formatting geometry






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago

























asked 15 hours ago









minhthien_2016

544310




544310












  • Write or solve?
    – Kuba
    15 hours ago










  • @Kuba Write the equation of the line passing through two points.
    – minhthien_2016
    15 hours ago










  • You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
    – Kuba
    15 hours ago








  • 1




    Isn't 17 x-y-20==0 already in that form?
    – Kuba
    15 hours ago






  • 1




    You can multiply sides by a constant but I fail to see how it is a Mathematica question.
    – Kuba
    15 hours ago


















  • Write or solve?
    – Kuba
    15 hours ago










  • @Kuba Write the equation of the line passing through two points.
    – minhthien_2016
    15 hours ago










  • You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
    – Kuba
    15 hours ago








  • 1




    Isn't 17 x-y-20==0 already in that form?
    – Kuba
    15 hours ago






  • 1




    You can multiply sides by a constant but I fail to see how it is a Mathematica question.
    – Kuba
    15 hours ago
















Write or solve?
– Kuba
15 hours ago




Write or solve?
– Kuba
15 hours ago












@Kuba Write the equation of the line passing through two points.
– minhthien_2016
15 hours ago




@Kuba Write the equation of the line passing through two points.
– minhthien_2016
15 hours ago












You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
– Kuba
15 hours ago






You can move y on the other side of ==. This fits it, doesn't it? Or are you asking about different representations of line equation, isn't it a maths question then? Sorry, just trying to get the point.
– Kuba
15 hours ago






1




1




Isn't 17 x-y-20==0 already in that form?
– Kuba
15 hours ago




Isn't 17 x-y-20==0 already in that form?
– Kuba
15 hours ago




1




1




You can multiply sides by a constant but I fail to see how it is a Mathematica question.
– Kuba
15 hours ago




You can multiply sides by a constant but I fail to see how it is a Mathematica question.
– Kuba
15 hours ago










5 Answers
5






active

oldest

votes

















up vote
6
down vote



accepted










Simplify[y - InterpolatingPolynomial[{pA, pB}, x] == 0]



50 + x + 17 y == 0




Also



Simplify[y - a x - b == 0 /. First@Solve[a # + b == #2 & @@@ {pA, pB}, {a, b}]]



50 + x + 17 y == 0




And



Simplify @ Rationalize[y - Fit[{pA, pB}, {x, 1}, x] == 0]



50 + x + 17 y == 0







share|improve this answer






























    up vote
    4
    down vote













    You may do as follows. Let us look for the equation in the form ax+by==1, where the parameters a and b are to be found.This will substitute the coordinates of the points pA and pB into this equations, thus, forming two equations with respect to a and b and solves the system:



    eq = a*#[[1]] + b*#[[2]] == 1 &;
    eq1=eq /@ {{1, -3}, {-33, -1}}

    (* {a - 3 b == 1, -33 a - b == 1} *)


    This will substitute the solution into the linear equation already in coordinates x and y:



    eq[{x, y}] /. sol

    (* -(x/50) - (17 y)/50 == 1 *)


    This will plot the solution:



    Show[{
    ContourPlot[-(x/50) - (17 y)/50 == 1, {x, -34, 2}, {y, -4, 0}],
    Graphics[{Red, PointSize[0.015], Point[#] & /@ {{1, -3}, {-33, -1}}}]
    }]


    yielding the following plot:



    enter image description here



    The original points are shown in red.



    This is one of several possible ways.



    Have fun!






    share|improve this answer




























      up vote
      4
      down vote













      The equation of a planar line going through two points $ P_1(x_1,y_1) $ and $ P_2(x_2,y_2) $ (e.g. cf this for reference) is



      $$
      begin{vmatrix}
      x & y\
      x_2-x_1 & y_2-y_1
      end{vmatrix}
      =
      begin{vmatrix}
      x_1 & y_1\
      x_2 & y_2
      end{vmatrix}.
      $$



      So there is the piece of codes below:



      Clear[eq, pts]
      eq = Simplify[Det[{{x, y}, -Subtract @@ #}] == Det[#]] &;
      pts = {{1, -3}, {-33, -1}};
      eq[pts]



      50 + x + 17 y == 0





      Or



      eq2 = Simplify[Det[{-1, 1} Differences[Prepend[#, {x, y}]]] == 0] &;





      share|improve this answer























      • If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
        – minhthien_2016
        12 hours ago












      • @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
        – Αλέξανδρος Ζεγγ
        11 hours ago










      • Thank you very much.
        – minhthien_2016
        10 hours ago


















      up vote
      4
      down vote













      With RegionMember:



      Simplify[RegionMember[InfiniteLine[{{1, -3}, {-33, -1}}], {x, y}], 
      Element[x | y, Reals]]



      50 + x + 17 y == 0







      share|improve this answer




























        up vote
        2
        down vote













        Knowing that the coefficients are components of a vector perpendicular to the difference of the two points, I think the most convenient command to obtain the equation is



        perp = Cross[pB - pA];
        perp.{x, y} == perp.pA // Simplify



        50 + x + 17 y == 0




        The last step before Simplify is



        -2 x - 34 y == 100


        so you can see that the simplification brought all terms to one side, factored out the greatest common divisor and fixed the signs.



        To Mathematica the sums "50 + x + 17y" and "x + 17y + 50" are exactly the same expression, but if you want to order linear terms before constants in the displayed form, you may consider using TraditionalForm (with the added benefit of using a "normal" equality sign while remaining copy-and-pastable):



        % // TraditionalForm



        $x+17 y+50=0$







        share|improve this answer





















        • Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
          – The Vee
          10 hours ago











        Your Answer





        StackExchange.ifUsing("editor", function () {
        return StackExchange.using("mathjaxEditing", function () {
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        });
        });
        }, "mathjax-editing");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "387"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














         

        draft saved


        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186285%2fanother-way-to-write-equation-of-the-line-passing-through-two-points%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        6
        down vote



        accepted










        Simplify[y - InterpolatingPolynomial[{pA, pB}, x] == 0]



        50 + x + 17 y == 0




        Also



        Simplify[y - a x - b == 0 /. First@Solve[a # + b == #2 & @@@ {pA, pB}, {a, b}]]



        50 + x + 17 y == 0




        And



        Simplify @ Rationalize[y - Fit[{pA, pB}, {x, 1}, x] == 0]



        50 + x + 17 y == 0







        share|improve this answer



























          up vote
          6
          down vote



          accepted










          Simplify[y - InterpolatingPolynomial[{pA, pB}, x] == 0]



          50 + x + 17 y == 0




          Also



          Simplify[y - a x - b == 0 /. First@Solve[a # + b == #2 & @@@ {pA, pB}, {a, b}]]



          50 + x + 17 y == 0




          And



          Simplify @ Rationalize[y - Fit[{pA, pB}, {x, 1}, x] == 0]



          50 + x + 17 y == 0







          share|improve this answer

























            up vote
            6
            down vote



            accepted







            up vote
            6
            down vote



            accepted






            Simplify[y - InterpolatingPolynomial[{pA, pB}, x] == 0]



            50 + x + 17 y == 0




            Also



            Simplify[y - a x - b == 0 /. First@Solve[a # + b == #2 & @@@ {pA, pB}, {a, b}]]



            50 + x + 17 y == 0




            And



            Simplify @ Rationalize[y - Fit[{pA, pB}, {x, 1}, x] == 0]



            50 + x + 17 y == 0







            share|improve this answer














            Simplify[y - InterpolatingPolynomial[{pA, pB}, x] == 0]



            50 + x + 17 y == 0




            Also



            Simplify[y - a x - b == 0 /. First@Solve[a # + b == #2 & @@@ {pA, pB}, {a, b}]]



            50 + x + 17 y == 0




            And



            Simplify @ Rationalize[y - Fit[{pA, pB}, {x, 1}, x] == 0]



            50 + x + 17 y == 0








            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 14 hours ago

























            answered 15 hours ago









            kglr

            171k8194399




            171k8194399






















                up vote
                4
                down vote













                You may do as follows. Let us look for the equation in the form ax+by==1, where the parameters a and b are to be found.This will substitute the coordinates of the points pA and pB into this equations, thus, forming two equations with respect to a and b and solves the system:



                eq = a*#[[1]] + b*#[[2]] == 1 &;
                eq1=eq /@ {{1, -3}, {-33, -1}}

                (* {a - 3 b == 1, -33 a - b == 1} *)


                This will substitute the solution into the linear equation already in coordinates x and y:



                eq[{x, y}] /. sol

                (* -(x/50) - (17 y)/50 == 1 *)


                This will plot the solution:



                Show[{
                ContourPlot[-(x/50) - (17 y)/50 == 1, {x, -34, 2}, {y, -4, 0}],
                Graphics[{Red, PointSize[0.015], Point[#] & /@ {{1, -3}, {-33, -1}}}]
                }]


                yielding the following plot:



                enter image description here



                The original points are shown in red.



                This is one of several possible ways.



                Have fun!






                share|improve this answer

























                  up vote
                  4
                  down vote













                  You may do as follows. Let us look for the equation in the form ax+by==1, where the parameters a and b are to be found.This will substitute the coordinates of the points pA and pB into this equations, thus, forming two equations with respect to a and b and solves the system:



                  eq = a*#[[1]] + b*#[[2]] == 1 &;
                  eq1=eq /@ {{1, -3}, {-33, -1}}

                  (* {a - 3 b == 1, -33 a - b == 1} *)


                  This will substitute the solution into the linear equation already in coordinates x and y:



                  eq[{x, y}] /. sol

                  (* -(x/50) - (17 y)/50 == 1 *)


                  This will plot the solution:



                  Show[{
                  ContourPlot[-(x/50) - (17 y)/50 == 1, {x, -34, 2}, {y, -4, 0}],
                  Graphics[{Red, PointSize[0.015], Point[#] & /@ {{1, -3}, {-33, -1}}}]
                  }]


                  yielding the following plot:



                  enter image description here



                  The original points are shown in red.



                  This is one of several possible ways.



                  Have fun!






                  share|improve this answer























                    up vote
                    4
                    down vote










                    up vote
                    4
                    down vote









                    You may do as follows. Let us look for the equation in the form ax+by==1, where the parameters a and b are to be found.This will substitute the coordinates of the points pA and pB into this equations, thus, forming two equations with respect to a and b and solves the system:



                    eq = a*#[[1]] + b*#[[2]] == 1 &;
                    eq1=eq /@ {{1, -3}, {-33, -1}}

                    (* {a - 3 b == 1, -33 a - b == 1} *)


                    This will substitute the solution into the linear equation already in coordinates x and y:



                    eq[{x, y}] /. sol

                    (* -(x/50) - (17 y)/50 == 1 *)


                    This will plot the solution:



                    Show[{
                    ContourPlot[-(x/50) - (17 y)/50 == 1, {x, -34, 2}, {y, -4, 0}],
                    Graphics[{Red, PointSize[0.015], Point[#] & /@ {{1, -3}, {-33, -1}}}]
                    }]


                    yielding the following plot:



                    enter image description here



                    The original points are shown in red.



                    This is one of several possible ways.



                    Have fun!






                    share|improve this answer












                    You may do as follows. Let us look for the equation in the form ax+by==1, where the parameters a and b are to be found.This will substitute the coordinates of the points pA and pB into this equations, thus, forming two equations with respect to a and b and solves the system:



                    eq = a*#[[1]] + b*#[[2]] == 1 &;
                    eq1=eq /@ {{1, -3}, {-33, -1}}

                    (* {a - 3 b == 1, -33 a - b == 1} *)


                    This will substitute the solution into the linear equation already in coordinates x and y:



                    eq[{x, y}] /. sol

                    (* -(x/50) - (17 y)/50 == 1 *)


                    This will plot the solution:



                    Show[{
                    ContourPlot[-(x/50) - (17 y)/50 == 1, {x, -34, 2}, {y, -4, 0}],
                    Graphics[{Red, PointSize[0.015], Point[#] & /@ {{1, -3}, {-33, -1}}}]
                    }]


                    yielding the following plot:



                    enter image description here



                    The original points are shown in red.



                    This is one of several possible ways.



                    Have fun!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 15 hours ago









                    Alexei Boulbitch

                    21.1k2369




                    21.1k2369






















                        up vote
                        4
                        down vote













                        The equation of a planar line going through two points $ P_1(x_1,y_1) $ and $ P_2(x_2,y_2) $ (e.g. cf this for reference) is



                        $$
                        begin{vmatrix}
                        x & y\
                        x_2-x_1 & y_2-y_1
                        end{vmatrix}
                        =
                        begin{vmatrix}
                        x_1 & y_1\
                        x_2 & y_2
                        end{vmatrix}.
                        $$



                        So there is the piece of codes below:



                        Clear[eq, pts]
                        eq = Simplify[Det[{{x, y}, -Subtract @@ #}] == Det[#]] &;
                        pts = {{1, -3}, {-33, -1}};
                        eq[pts]



                        50 + x + 17 y == 0





                        Or



                        eq2 = Simplify[Det[{-1, 1} Differences[Prepend[#, {x, y}]]] == 0] &;





                        share|improve this answer























                        • If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                          – minhthien_2016
                          12 hours ago












                        • @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                          – Αλέξανδρος Ζεγγ
                          11 hours ago










                        • Thank you very much.
                          – minhthien_2016
                          10 hours ago















                        up vote
                        4
                        down vote













                        The equation of a planar line going through two points $ P_1(x_1,y_1) $ and $ P_2(x_2,y_2) $ (e.g. cf this for reference) is



                        $$
                        begin{vmatrix}
                        x & y\
                        x_2-x_1 & y_2-y_1
                        end{vmatrix}
                        =
                        begin{vmatrix}
                        x_1 & y_1\
                        x_2 & y_2
                        end{vmatrix}.
                        $$



                        So there is the piece of codes below:



                        Clear[eq, pts]
                        eq = Simplify[Det[{{x, y}, -Subtract @@ #}] == Det[#]] &;
                        pts = {{1, -3}, {-33, -1}};
                        eq[pts]



                        50 + x + 17 y == 0





                        Or



                        eq2 = Simplify[Det[{-1, 1} Differences[Prepend[#, {x, y}]]] == 0] &;





                        share|improve this answer























                        • If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                          – minhthien_2016
                          12 hours ago












                        • @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                          – Αλέξανδρος Ζεγγ
                          11 hours ago










                        • Thank you very much.
                          – minhthien_2016
                          10 hours ago













                        up vote
                        4
                        down vote










                        up vote
                        4
                        down vote









                        The equation of a planar line going through two points $ P_1(x_1,y_1) $ and $ P_2(x_2,y_2) $ (e.g. cf this for reference) is



                        $$
                        begin{vmatrix}
                        x & y\
                        x_2-x_1 & y_2-y_1
                        end{vmatrix}
                        =
                        begin{vmatrix}
                        x_1 & y_1\
                        x_2 & y_2
                        end{vmatrix}.
                        $$



                        So there is the piece of codes below:



                        Clear[eq, pts]
                        eq = Simplify[Det[{{x, y}, -Subtract @@ #}] == Det[#]] &;
                        pts = {{1, -3}, {-33, -1}};
                        eq[pts]



                        50 + x + 17 y == 0





                        Or



                        eq2 = Simplify[Det[{-1, 1} Differences[Prepend[#, {x, y}]]] == 0] &;





                        share|improve this answer














                        The equation of a planar line going through two points $ P_1(x_1,y_1) $ and $ P_2(x_2,y_2) $ (e.g. cf this for reference) is



                        $$
                        begin{vmatrix}
                        x & y\
                        x_2-x_1 & y_2-y_1
                        end{vmatrix}
                        =
                        begin{vmatrix}
                        x_1 & y_1\
                        x_2 & y_2
                        end{vmatrix}.
                        $$



                        So there is the piece of codes below:



                        Clear[eq, pts]
                        eq = Simplify[Det[{{x, y}, -Subtract @@ #}] == Det[#]] &;
                        pts = {{1, -3}, {-33, -1}};
                        eq[pts]



                        50 + x + 17 y == 0





                        Or



                        eq2 = Simplify[Det[{-1, 1} Differences[Prepend[#, {x, y}]]] == 0] &;






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 14 hours ago

























                        answered 15 hours ago









                        Αλέξανδρος Ζεγγ

                        3,4631927




                        3,4631927












                        • If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                          – minhthien_2016
                          12 hours ago












                        • @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                          – Αλέξανδρος Ζεγγ
                          11 hours ago










                        • Thank you very much.
                          – minhthien_2016
                          10 hours ago


















                        • If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                          – minhthien_2016
                          12 hours ago












                        • @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                          – Αλέξανδρος Ζεγγ
                          11 hours ago










                        • Thank you very much.
                          – minhthien_2016
                          10 hours ago
















                        If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                        – minhthien_2016
                        12 hours ago






                        If pts = {{1, -3}, {-33, 150}} How can I get the form 9 x+2 y-3=0 . Your code ouput 9 x+2 y==3 Allways in the form a x + b y + c==0, a>0, if a=0, then b >0`.
                        – minhthien_2016
                        12 hours ago














                        @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                        – Αλέξανδρος Ζεγγ
                        11 hours ago




                        @minhthien_2016 Sort of eq[pts] /. a_ == b_ :> a - b == 0, though I think it just a minor issue.
                        – Αλέξανδρος Ζεγγ
                        11 hours ago












                        Thank you very much.
                        – minhthien_2016
                        10 hours ago




                        Thank you very much.
                        – minhthien_2016
                        10 hours ago










                        up vote
                        4
                        down vote













                        With RegionMember:



                        Simplify[RegionMember[InfiniteLine[{{1, -3}, {-33, -1}}], {x, y}], 
                        Element[x | y, Reals]]



                        50 + x + 17 y == 0







                        share|improve this answer

























                          up vote
                          4
                          down vote













                          With RegionMember:



                          Simplify[RegionMember[InfiniteLine[{{1, -3}, {-33, -1}}], {x, y}], 
                          Element[x | y, Reals]]



                          50 + x + 17 y == 0







                          share|improve this answer























                            up vote
                            4
                            down vote










                            up vote
                            4
                            down vote









                            With RegionMember:



                            Simplify[RegionMember[InfiniteLine[{{1, -3}, {-33, -1}}], {x, y}], 
                            Element[x | y, Reals]]



                            50 + x + 17 y == 0







                            share|improve this answer












                            With RegionMember:



                            Simplify[RegionMember[InfiniteLine[{{1, -3}, {-33, -1}}], {x, y}], 
                            Element[x | y, Reals]]



                            50 + x + 17 y == 0








                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 10 hours ago









                            halmir

                            10.1k2443




                            10.1k2443






















                                up vote
                                2
                                down vote













                                Knowing that the coefficients are components of a vector perpendicular to the difference of the two points, I think the most convenient command to obtain the equation is



                                perp = Cross[pB - pA];
                                perp.{x, y} == perp.pA // Simplify



                                50 + x + 17 y == 0




                                The last step before Simplify is



                                -2 x - 34 y == 100


                                so you can see that the simplification brought all terms to one side, factored out the greatest common divisor and fixed the signs.



                                To Mathematica the sums "50 + x + 17y" and "x + 17y + 50" are exactly the same expression, but if you want to order linear terms before constants in the displayed form, you may consider using TraditionalForm (with the added benefit of using a "normal" equality sign while remaining copy-and-pastable):



                                % // TraditionalForm



                                $x+17 y+50=0$







                                share|improve this answer





















                                • Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                  – The Vee
                                  10 hours ago















                                up vote
                                2
                                down vote













                                Knowing that the coefficients are components of a vector perpendicular to the difference of the two points, I think the most convenient command to obtain the equation is



                                perp = Cross[pB - pA];
                                perp.{x, y} == perp.pA // Simplify



                                50 + x + 17 y == 0




                                The last step before Simplify is



                                -2 x - 34 y == 100


                                so you can see that the simplification brought all terms to one side, factored out the greatest common divisor and fixed the signs.



                                To Mathematica the sums "50 + x + 17y" and "x + 17y + 50" are exactly the same expression, but if you want to order linear terms before constants in the displayed form, you may consider using TraditionalForm (with the added benefit of using a "normal" equality sign while remaining copy-and-pastable):



                                % // TraditionalForm



                                $x+17 y+50=0$







                                share|improve this answer





















                                • Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                  – The Vee
                                  10 hours ago













                                up vote
                                2
                                down vote










                                up vote
                                2
                                down vote









                                Knowing that the coefficients are components of a vector perpendicular to the difference of the two points, I think the most convenient command to obtain the equation is



                                perp = Cross[pB - pA];
                                perp.{x, y} == perp.pA // Simplify



                                50 + x + 17 y == 0




                                The last step before Simplify is



                                -2 x - 34 y == 100


                                so you can see that the simplification brought all terms to one side, factored out the greatest common divisor and fixed the signs.



                                To Mathematica the sums "50 + x + 17y" and "x + 17y + 50" are exactly the same expression, but if you want to order linear terms before constants in the displayed form, you may consider using TraditionalForm (with the added benefit of using a "normal" equality sign while remaining copy-and-pastable):



                                % // TraditionalForm



                                $x+17 y+50=0$







                                share|improve this answer












                                Knowing that the coefficients are components of a vector perpendicular to the difference of the two points, I think the most convenient command to obtain the equation is



                                perp = Cross[pB - pA];
                                perp.{x, y} == perp.pA // Simplify



                                50 + x + 17 y == 0




                                The last step before Simplify is



                                -2 x - 34 y == 100


                                so you can see that the simplification brought all terms to one side, factored out the greatest common divisor and fixed the signs.



                                To Mathematica the sums "50 + x + 17y" and "x + 17y + 50" are exactly the same expression, but if you want to order linear terms before constants in the displayed form, you may consider using TraditionalForm (with the added benefit of using a "normal" equality sign while remaining copy-and-pastable):



                                % // TraditionalForm



                                $x+17 y+50=0$








                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered 10 hours ago









                                The Vee

                                1,393916




                                1,393916












                                • Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                  – The Vee
                                  10 hours ago


















                                • Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                  – The Vee
                                  10 hours ago
















                                Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                – The Vee
                                10 hours ago




                                Ad sign of the x coefficient: I don't know of any trick simpler than multiply the result by –1 if you don't like it.
                                – The Vee
                                10 hours ago


















                                 

                                draft saved


                                draft discarded



















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186285%2fanother-way-to-write-equation-of-the-line-passing-through-two-points%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                'app-layout' is not a known element: how to share Component with different Modules

                                android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

                                WPF add header to Image with URL pettitions [duplicate]