# 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 $c$are 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 $y$correspond 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 lin**e *$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.*

*a)* $y=6$ | *b)* $y=4x-3$ | *c) *$y=-7x$ | *d) *$x=0$ | *e) *$y=x+2$ |

*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 $y$terms. 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: *$\underline4$

*c: *$\underline{-7}$

*e: $\underline{1}$*

*Note:** In line e, you don't need to write the *$1$* ahead of the *$x$* - it is implied.*