# Equation of a straight line tutorial

This page focuses on using the formula y=mx+c to find the equation of a straight line. If you would like to revise or practice please visit the Equation of line Quiz Generator and practice to improve your skills for exams.Detailed solutions are provided for incorrect response. You can also vist the equation of a straight line calculator here

### Assumption

It is assumed the you know how to calculate gradient. If you have no knowledge about gradient then you need to visit the gradient tutorial here.

### Formula of the Equation of a straight line

Given any 2 points $(x_1,y_1)$ and $(x_2,y_2)$, the equation of a straight line is found by applying the following formula: $$y=mx+c$$ Where: $m$ is the gradient and $c$ is the y intercept

y-intercept is the point where the line cuts the y-axis. On the graph shown above, the line cuts the y-axis when y=4. Therefore the y intercept is 4 and thus the value of c is 4.

### Calculating the equation of a line given points and the y intercept

Example: Calculate the equation of a line passing through the points (-8,0) and (6,7) as shown in the above diagram.
Solution: We use the formula of a straight line equation $y=mx+c$: We only need to calculate the values of m and c and the substitute into the formula $y=mx+c$.
1. #### Step 1: Calculating the y intercept, c

In this case there is no need to calculate c, the value of c is easly determined from the graph. c is the y-intercept. Therefore c=4
2. #### Step 2: Finding the gradient m

The formula for gradient is \begin{align} m&= \frac{y_2-y_1}{x_2-x_1}\end{align} Let us now apply substitution where $x_1=-8$ and $y_1 =0$ ; $x_2=6$ and $y_2=7$ \begin{align} m &= \frac{y_2-y_1}{x_2-x_1} \\ &=\frac{7-0}{6--8} \\ &=\frac{7}{14} \\ &= \frac{1}{2} \end{align} Thus the gradient is $\frac{1}{2}$
3. #### Step 3:Substitution

Now that we have found that $c=4$ and $m=\frac{1}{2}$ , the equation of a stright line is: \begin{align} y&=mx+c \\ y&=\frac{1}{2}x+4\end{align}

### Calculating the equation of a line given points only

Example: Calculate the equation of a line passing through the points (-8,0) and (6,7)
Solution: We use the formula of a straight line equation $y=mx+c$: We only need to calculate the values of m and c and the substitute into the formula $y=mx+c$.
1. #### Step 1: Start by finding the gradient m

The formula for gradient is \begin{align} m&= \frac{y_2-y_1}{x_2-x_1}\end{align} Let us now apply substitution where $x_1=-8$ and $y_1 =0$ ; $x_2=6$ and $y_2=7$ \begin{align} m &= \frac{y_2-y_1}{x_2-x_1} \\ &=\frac{7-0}{6--8} \\ &=\frac{7}{14} \\ &= \frac{1}{2} \end{align} Thus the gradient is $\frac{1}{2}$
2. #### Step 2: Calculating the y intercept, c

since $m= \frac{1}{2}$ . It means we now have \begin{align} y&=mx+c \\ y&=\frac{1}{2}x+c\end{align} We are only left with c. To find the value of c, we take the x and y values from one of the given points (-8,0) and (6,7) and substitute into $y=\frac{1}{2}x+c$. Let us choose the point (-8,0).
As shown on the graphics above, $x=-8 \text{ and } y=0$ \begin{align} y&=\frac{1}{2}x+c \\ 0&=\frac{1}{2}(-8)+c \\ 0&=-4+c \\ 4&=c \\ c&=4 \end{align} Thus the equation of the straight line is $y=\frac{1}{2}x+4$

## Equation of a straight line Practice

If you would like to practice and gain more experience on calculating the Equation of a straight line given 2 points, then you can visit the Equation of a straight line Quiz Generator . You will have plenty of revision and fun. There will be infinite number of questions. Detailed solutions for incorrect response are provided. Go to the Equation of a straight line quiz generator now and start revising. If you would like to verify your homework or assignment then you can visit the Equation of a straight line Calculator here . The Equation of a straight line calculator provides detailed solution when 2 coordinates are entered. It can be used as a home work helper.