Skip navigation

If you have 2 points, for example:

P( 2, 1 ); Q( 5, 7 )

You can find the linear equation of the line that passes through those points in the form:

Ax + By + C = 0

in one step by simply using the formula:

(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

OR, we can write this as (easier to read!)
(py – qy)x + (qx – px)y + (pxqy – qxpy) = 0

Let’s try it:

Take Point1=( 2, 1 )
Take Point2=( 5, 7 )

Find the LINEAR EQUATION of the line that passes through the points (2,1) and (5,7). Your answer must be in the form of Ax + By + C = 0.

Using the equation:
(y1 – y2)x + (x2 – x1)y + (x1y2 – x2y1) = 0

We’ll just plug numbers in:
(1 – 7)x + (5 – 2)y + ( (2 x 7) – (5 x 1) ) = 0
-6x + 3y + (14 – 5) = 0
-6x + 3y + 9 = 0

Factoring a -3 out:
-3( 2x – y – 3 ) = 0

Dividing both sides by -3:
2x – y – 3 = 0

And that’s the answer.

That’s hella shorter than having to go through and do it using y = mx + b, and its a systematic way to do it in a computer in case m is infinity.

Formula from Peter Shirley’s CG book

45 Comments

    • Bree
    • Posted September 18, 2008 at 5:01 pm
    • Permalink

    ive been given the following question :

    the general equation of a straight line is ax+by+c=0.
    Find the gradient of the line and the y intercept.

    but i have been given no cooridinets to input into the equation so how am i supposed to work it out?

    • kalyna
    • Posted September 29, 2008 at 9:29 pm
    • Permalink

    im thinking that since there are no coordinates to put in, the teacher wants just the letter and variable. If you switch this equation into “y=mx+b”, then it would look like “By=Ax+C”. So Ax is the slope, and C is the y-intercept. Thats how we learned it the other day.

    • lorin
    • Posted October 27, 2008 at 9:44 pm
    • Permalink

    you can also use:

    y-y1= ((y2-y1)/(x2-x1))*(x-x1)

    it is much easier !!

    • Mitch
    • Posted November 12, 2008 at 7:59 am
    • Permalink

    lorin, expand that out and see what you get :P

    • Krystal
    • Posted November 12, 2008 at 11:38 pm
    • Permalink

    this is a math project i don’t know how to do it.

    The simplest mathematical model to use to represent a set of real-life data is the line. The number of married couples in the United States in 1996 was 53.6 million. In 2002, the number of married couples grew to 56.7 million.

    a. Write a linear equation that gives the number of married couples in terms of the year. Let x represent the year with x=6 corresponding to 1996.
    b. What is the slope of the line.
    c.What does the slope of the line tell you about the married couples in the united states.

    Please help Thank you so much.

    • Anonymous
    • Posted December 2, 2008 at 2:11 am
    • Permalink

    What if the equation doesn’t have a LCD, then what do you do?

    • mich
    • Posted February 9, 2009 at 9:30 am
    • Permalink

    thanks, you were a huge help

    • sailesh
    • Posted March 4, 2009 at 3:58 pm
    • Permalink

    it dosent mentions about what the parameteres A B and C stands for.not so helpful for a new man who starts to learn this

    • Kasia
    • Posted March 21, 2009 at 10:03 pm
    • Permalink

    Hey.It doesn t work all the time cuz we can`t always factor ;P!Example:L(-1,-3) and M(4,7)

    • buenom
    • Posted April 14, 2009 at 8:59 pm
    • Permalink

    If you can demonstrate it…I mean I can…okay,sorry for this unneccesary comment.

    • Anonymous
    • Posted June 9, 2009 at 9:41 am
    • Permalink

    thank u po

    • Kinvaris
    • Posted November 15, 2009 at 1:28 pm
    • Permalink

    You could use this too..
    P( 2, 1 ); Q( 5, 7 )

    Rc y2-y1/x2-x1= m
    Rc 7-1/5-2= 6/3= 2
    Rc= m
    Rc= 2

    y-y1=m(x-x1)

    y-1=2(x-2)
    y-1=2x-4
    y=2x-4+1
    y=2x-3 (y=mx+q)

    so -2x+1y+3=0 (ax+by+c=0)

    I think this is a little bit shorter :P

    I go a little bit further but i can’t tell this in english.

    -2x+1y+3=0

    The x = -2x+1*0+3=0
    -2x+3=0
    -2x=-3
    x=-3+2
    x=-1

    The y = -2*0+1y+3=0
    y+3=0
    y=-3

    If you have this formula: x=p not this one y=mx+q then you have no y
    if you have y=0x+q then you have no x
    then you write impossible

    Greetz Kinvaris

    • Agnel C J Kurian
    • Posted November 19, 2009 at 10:57 am
    • Permalink

    Thanks… but how does it work?

    I have co-ordinates for P and Q.

    AX + BY + C = 0 passing through both P and Q implies that:
    A * P.X + B * P.Y + C = 0 and
    A * Q.X + B * Q.Y + C = 0

    That’s two equations!! And three unknowns!!! How do we solve this?

    I’m sure it works. I wanted to know how it works.

    • Kim
    • Posted February 1, 2010 at 1:51 am
    • Permalink

    thank you so much! this really helped out a lot :)

    • Anonymous
    • Posted May 13, 2010 at 4:28 am
    • Permalink

    Ax+By+C=0!!

    • unknown127
    • Posted July 30, 2010 at 3:57 am
    • Permalink

    ok so we got this big packet that we have to finish by the end of the week…ok so iv’e got everything except for one question…i cant turn mx + b =y form into ax + by = c formm…pleese help…!!!!

    • Gavin
    • Posted September 14, 2010 at 3:27 am
    • Permalink

    It’s Ax + By = C not something something something c = 0.
    F**ing morons.

  1. Hey Gavin,

    Just move the C to the left side.

    • Anonymous
    • Posted September 22, 2010 at 4:13 pm
    • Permalink

    im still stuck on this…
    A straight line passes through (2,1) and (5,7). Find its equation in the form ax+by+c=0

    i can get up to y2-y1/x2-x1 which is
    7-1/5-2 which is 6/3 and i know u leave it there. now what do i do!!

    • Math tutor
    • Posted January 29, 2011 at 7:07 pm
    • Permalink

    I can plug in this formula in some of my problems and i get the numbers but they are the wrong signs, as far as neg or pos. So you need negs in the front of the ( for each. Thanks please make the corrections so you dont throw others off as you did me.

  2. @Math tutor just multiply both sides by (-1).

    • Shannon
    • Posted February 2, 2011 at 3:24 am
    • Permalink

    What? Where did you get -3 from..?

  3. On the 2nd last step, I just noticed that 3, is the biggest number I can evenly factor out of -6x + 3y + 9, and I used (-3) because I wanted the x factor to be +2, not -2.

    In the last step, as a general rule you can multiply both sides of an equation by any number you want. Could have been 9000 if you want.

    So on the LEFT, that (-3) in front, gets divided by (-3), leaving just 1 in front of that bracket on the LEFT side. On the RIGHT side, 0 divided by -3 is still 0.

    • Aref
    • Posted January 24, 2012 at 11:12 pm
    • Permalink

    Hi Buddy,
    Can you help me with this question please? I am stuffed!

    http://gis.stackexchange.com/questions/19235/find-point-c-by-having-two-points-such-as-a-and-b

    • Anonymous
    • Posted February 15, 2012 at 5:25 am
    • Permalink

    wew ang baba naman ng mga rason niyo!!!!!

    • Joseph
    • Posted March 3, 2012 at 9:37 am
    • Permalink

    Mathematics are at times complicated, for weak BRAINS…

    But for Math Wizards, It’s just a piece of cake!!!

    ~iGothic

  4. grangrfazsbgr sf<3 fatalloveee<3333

    • Anonymous
    • Posted May 28, 2012 at 10:15 pm
    • Permalink

    wow how gay is this i have been lookin all over for this and there it is simple and easy

    • Anonymous
    • Posted May 28, 2012 at 10:41 pm
    • Permalink

    what if you have negitive numbers in the points idk how to figure it out
    please help!!!!!!!!!!!!!!!!

  5. nka2long to, sobra!! ^_^ all of u, do u understand what i said?

  6. :P

    • Anonymous
    • Posted August 27, 2012 at 3:50 pm
    • Permalink

    Why don’t you demonstrate the proof of the formula? You only give the formula, why don’t you tell us how you got it?

    • mike
    • Posted September 25, 2012 at 12:10 am
    • Permalink

    Thanks

  7. y-y1=m(x-x1)

  8. ax+3y+5=0 and 4x-y-9=0 equal lines Count a

    • Aniqa
    • Posted November 1, 2013 at 10:17 pm
    • Permalink

    can someone please tell me when we use AB = √(x2-x1)^2 + (y2-y1)^2 (that’s all under one root btw) and give an example?
    cheers

    • Anonymous
    • Posted February 3, 2014 at 1:36 pm
    • Permalink

    The explanation is actually wrong you should divide both sides to cancel out A

    • Needy Student
    • Posted March 13, 2016 at 12:27 pm
    • Permalink

    Hi, when putting an answer in the form ax + by + c = 0, are there always two possible answers?
    e.g. an answer could be 5x – 4y – 6 = 0, but could I also give -5x + 4y + 6 = 0 as an answer?

    Thank you for your help!

  9. Best way to solve this problem is by Using Formula for 2 points Y-Y1/Y1-Y2 = X-X1/X1-X2

    Two points are (2,1) and (5,7) i.e (X1,Y1) and (X2,Y2) Respectively

    Substitute as Y-1/1-7 = X-2/2-5 ie Y-1/(-6) = X-2/(-3)

    Cross Multiplying we end up as follows

    -3Y+3 = -6X+12
    -3Y = -6X+9
    Y = 2X+3

    • Anonymous
    • Posted July 26, 2017 at 3:02 am
    • Permalink

    What if my c is on the other side of the = sign (AX+BY=C), Would I do the opposite with the factoring on the C side than I would do on the equation side?

    • Anonymous
    • Posted July 26, 2017 at 3:49 am
    • Permalink

    I answered my own question. Yes you would

    • Tristen
    • Posted August 23, 2018 at 12:50 am
    • Permalink

    What is an=x+7bc_ac=2x+4

    • Sarah
    • Posted August 30, 2018 at 7:47 pm
    • Permalink

    Such an easy explanation compared to what im given in class. Super helpful!

    • Maaz
    • Posted May 30, 2021 at 7:57 am
    • Permalink

    Thank you for teaching me an entire Mathematics topic in 5 minutes!

    • Anonymous
    • Posted October 19, 2023 at 1:10 pm
    • Permalink

    Thanks i have a test in like 5 minutes


One Trackback/Pingback

  1. […] This is a bit of linear algebra derived from the general equation for a line. […]

Leave a comment