Equation of a straight line: y=mx+c
In a nutshell
The equation y=mx+c gives a straight line on a coordinate grid, where m and care constants. It is the equation for almost any straight line, the exception being vertical lines, which have equations of the form x=d where d is a constant (the x-intercept).
The components of the equation y=mx+c
m is the value of the gradient of the straight line and c is the y-intercept. x and ycorrespond to coordinates of points on the line. For any point (x,y) on the line, multiplying the x-coordinate by m and adding c, gives the y-coordinate. If this doesn't work, then the point you are using is not actually on the line.
Example 1
Consider the equation of the line below. Does the point (−1,−5) sit on this line?
y=3x−2
Insert the x-coordinate −1 into the equation of the line to see if the equation then gives the corresponding y-coordinate:
y=3x−2=3(−1)−2=−3−2=−5
This is the correct y-value, therefore:
(−1,−5) does sit on the line y=3x−2
Example 2
Consider the line with equation below. Does the point (4,9) sit on this line?
y=3x−2
Insert the x-coordinate into the equation of the line. If it gives the y-coordinate, then the point is on the line, if it doesn't, then it is not.
y=3x−2=3(4)−2=12−2=10
This is not 9, so:
(4,9) is not on the line y=3x−2
Note: Point (4,10) is, however, on the line.
Different types of lines
Diagonal lines
Diagonal lines have the equation y=mx+c where m is the gradient and c is the y-intercept.
Horizontal lines
Horizontal lines have a gradient of 0, so such a line is just y=c. This is still technically in the form y=mx+c, but m is equal to 0.
Vertical lines
Vertical lines don't use the y=mx+c equation. You cannot give m a value for a vertical line since it is essentially infinity; there is also no value for c. Instead, a vertical line has the equation x=d where d is the x-intercept.
Example 3
By looking at the following equations of lines, decide which are horizontal, which are vertical and which are diagonal.
Diagonal lines have equations of the form y=mx+c where m is not zero. Horizontal lines have equations of the form y=c and vertical lines have equations of the form x=d. Importantly, c and d are constants, so do not include any x or yterms. Thus:
Diagonal lines: b, c and e
Horizontal lines: a
Vertical lines: d
Example 4
For each of the diagonal lines in the example above, what is the gradient?
The gradient is m, which is the number that sits before the x. The gradients are as follows:
b: 4
c: −7
e: 1
Note: In line e, you don't need to write the 1 ahead of the x - it is implied.