The graph shows the amount of money paid when purchasing bags of candy at the zoo:

A graph is shown. The x-axis is labeled from 0 to 9. The y-axis is labeled from 0 to 10. The four points shown on the graph are ordered pairs 0, 0 and 1, 2 and 2, 4 and 3, 6. These points are joined by a line. The label on the x-axis is Bags of candy. The title on the y-axis is Total cost in dollars.

Write an equation to represent the relationship between the total cost (y) and the number of bags of candy (x).

Group of answer choices

y = one-half x

y = 3x

y = 2x

y = one-third x

Since the points on the graph form a straight line, we can determine the equation of the line using the slope-intercept form, which is y = mx + b.

To find the equation, we need to determine the slope (m) and the y-intercept (b).

We can use two points on the line to calculate the slope:
(0, 0) and (3, 6)

m = (y2 - y1)/(x2 - x1)
m = (6 - 0)/(3 - 0)
m = 6/3
m = 2

Now that we have the slope, we can substitute it into the slope-intercept form equation:

y = mx + b
2 = 2x + b

To find the y-intercept (b), we can substitute one of the points on the line into the equation. Let's use (0, 0):

0 = 2(0) + b
0 = 0 + b
b = 0

Now we have the value for b, we can write the final equation:

y = 2x + 0

Simplifying the equation, we get:

y = 2x

Therefore, the equation that represents the relationship between the total cost (y) and the number of bags of candy (x) is y = 2x.