The function can be split in 2 straight lines: the first one from x = 2 to the left, and the other one from the same point to the right.
Now, a straight line equation is of the form
Where a is the slope and m is the y-intercept.
"Left" line:
- m (y-intercept):
To find it we need to see where the line cross (intercepts) the y-axis. From the figure we can see that m = -2.
- a (slope):
To calculate the slope, we can use the following equation:
Where, chossing 2 points in the line, we have:
Look that for x we have to move to the right. Let's see a drawing:
In our case, we can take the points (0, -2) and (2, 4), so, we have:
So, we have the equation for the "left" line:
-"Right" line:
- m (y-intercept):
In this case we can not see where the line cross (intercepts) the y-axis. Let's leave this for latter.
- a (slope):
As we did before, we can pick to points on the line, like (3, 1) and (2, 4).
- m (y-intercept) continues:
We now know that the equation for this line is:
To find m, we can pick one single point and solve for that variable. For example, taking the point (2,4), we have:
And so, for the right line, we have:
Finally, the equation of the function can be written as:
Now, the domain of the function is the set of points (or numbers) for which the function has values. The set of departure. In this case, all the numbers can be "trasnformed" or mapped with this function, so the domain is all the numbers, the set of real numbers, R: