Given the below chart, we need to figure out the equation for the line. We will use the piecewise method, where we split the line into chunks & define each part of the line using the formula y – y1 = m(x – x1) where:
In this example, the graph has been split into three sections. The co-ordinates for section 1 are (0,0) and (1,1). We can therefore define this part of the slope as: y – 0 = 1( x – 0) where we have taken y to be 0 from the coordinates (0,0) and x as 0 from (0,0). This formula can be simplified to y = x.
The second line takes the coordinates (1,1) and (2,0). Hence, the formula is y -1 = -1(x-1). This can be further simplified by subtracting the 1 from the y-side of the equation to create y = -x + 2. M is calculated as x change divided by y change.
Finally, we have the flat part of the graph. Here the formula is simply y = 0. We can now stitch all of these formulas together to make our piecewise formula. Below, you can see that we have defined each of the equations we’ve created above & given them a domain (when they are applicable). So:
Note: make sure you don’t have any overlapping functions. i.e. if one is <=1 then the next piecewise function cannot be >=1, it must be simply >. Otherwise it can result in 2 values for y.
In the below, we have two co-ordinates (4,2) and (6,3). We need to figure out, based on this information, what the piecewise formula for the line is. We start, by calculating the slope, which is x change divided by y change. Which we simplify out to be 1/2.
So, we now have y – 2 = 1/2(x – 4), where 2 is the y value for the first co-ordinate we were given and 4 is the value for x. We can simplify this out as below to y = 1/2(x).
In the below example, we already know the slope of the line & we know one of the points on the graph. So the formula is simply a case of replacing a few numbers to create y – 2 = -2/3(x-7).
In our final example, we have been given 2 points on the graph. From here, we calculate the change (slope) and then plug the numbers into the formula as below: