The function would be f(x) = 40x + 4.
It's plus 4 because it starts counting after the 4 kilometers already happened.
It's 40x because that's the rate of change (km/h) and the x represents the hours.
f(x) basically means y, but in functions you use f(x).
Hope this helps :)