# Find the slope intercept equation of a line

Let’s say we have been given two points of a line. One is (1,2) and the other is (3,5). Using this & the formula y = mx + b, we can define the equation for the line.

First, we need to calculate m (the slope). We do this by taking y change divided by x change. This gives us 3/2. We can then inject this into the formula to make y = 3/2 x  + b

To calculate b, we can flip the formula around (by subtracting b from the right & then subtracting y from the left. This creates b = 3/2 x + y

We can then insert the coordinates that we already know. So 2 from (1,2) = 3/2(1) + b. We now multiply by 2 to get rid of that denominator. To give us 4 = 3 + 2b. From this, we know that b = 1/2.

### Example 2:

Here, we are given 2 pieces of information: a single point & the slope of the line. We can simply inject these into the y = mx + b formula as below.

### Example 3:

In the next example, it’s not to simple. We only have two points, so we need to use the piecewise formula & then simplify it to the y = mx + b formula.