The equation for the function is 
Explanation:
The equation for the function that passes through the points
and 
The equation of the line that passes through the points
and
is given by

where m is the slope and it can be determined using the formula,

Substituting the values of x and y in the slope formula, we have,

Simplifying, we get,

Thus, the slope is m=1.
Substituting the values in the equation
, we have,

Multiplying the terms within the bracket,

Adding
on both sides of the equation,

Thus, the equation for the function is 