Use the following general equation of a line which passes through the point (xo,yo):
y - yo = m(x - xo)
where m is the slope of the line and can be calculated by using the following formula:
where (x1,y1) and (x2,y2) are any two points on the line.
Based on the given graph, you can use (x1,y1) = (0,0) and (x2,y2) = (1,4) to calculate the slope m:
Now, replace (xo,yo) = (0,0) and m=4 into the general equation and solve for y:
y - 0 = 4(x - 0)
y = 4x
Hence, the cost y and the number of bags x can be related with the equation y = 4x