3. Maths Lines

Lines

I am going to start this tutorial now, but I probably will not have time to finish it. But here goes…

Well, many years later, we may as well actually finish it properly 🙂

The equation of a line can be shown in a few different forms. The two I am going to look at here are the general form and the slope-intercept form.

General form: Ax + By = C
Slope-intercept form: y = mx + c

I find the slope-intercept form easiest to visualise, as it tells you straight out the slope of the line, m, and where the line crosses the Y axis, c.

Finding The Slope

Let us reuse this diagram:
Distance Formula Triangle

Now first we will look at the slope. The formula for the slope between 2 points is:

m = (y2 – y1) / (x2 – x1)

Simple enough. The one catch is a vertical line, where x2 – x1 = 0. A vertical line has an undefined slope, so you cannot put it into normal slope-intercept form.

Finding The Y Intercept

Now to find c, we use the equation:

y = mx + c

Substitute either one of your known points into the equation. Using point 2:

y2 = m * x2 + c

Then move m * x2 to the other side:

c = y2 – (m * x2)

Now that we have both c and m, we can determine the equation of our line by putting those values back into y = mx + c.

Converting To General Form

Now that we have our formula in slope-intercept form, what about converting that to the general form?

Start with:

y = mx + c

Move the X term to the left:

-mx + y = c

That is already in the form Ax + By = C, with A = -m, B = 1 and C = c. If you want integer coefficients you can multiply the whole equation by a common denominator.

There we go. It only took me a little longer than planned to finish this one…

Questions or corrections? If something doesn’t work or you spot something I’ve got wrong, leave a comment below. These tutorials have been around a long time, so useful corrections are always welcome!

  • March 25, 2010
  • 3