The initial fee of $50 is essentially the y intercept because this is the value when x = 0 (x is the number of labor-hours). So b = 50.
The slope is m = 30 because each increase of 1 hour leads to the cost bumping up by 30 dollars. In other words, slope = rise/run = (change in cost)/(change in hours) = 30/1
So we plug m = 30 and b = 50 into the y = mx+b formula to get y = 30x+50
Replace y with f(x) to get f(x) = 30x+50
The linear function for the cost is f(x) = 30x+50
Note: Some books may use other letters (instead of x and f(x)), but the idea is still the same
Once you know the cost function, you replace x with 4.5 to find the amount it will cost to have a painter work for 4.5 hours.
f(x) = 30x+50
f(4.5) = 30*4.5+50
f(4.5) = 135+50
f(4.5) = 185
It will cost 185 dollars to have the painter work for 4.5 hours