We first take the slope of the line as m = (y2 - y1) / (x2 - x1), and let point 1 be (0, 20) and point 2 be (400, 40).
m = (40 - 20) / (400 - 0) = 20 / 400 = 0.05
In slope-intercept form: y = mx + b
y = 0.05x + b
b is the y-intercept, which we know from the given point of (0, 20) to be b = 20.
So the function is y = 0.05x + 20, or C(t) = 0.05t + 20, where t is time in minutes and C(t) is the cost.