If points f and g are symmetric with respect to the line y=x, then the line connecting f and g is perpendicular to y=x, and f and g are equidistant from y=x.
This problem could be solved graphically by graphing y=x and (8,-1). With a ruler, measure the perpendicular distance from y=x of (8,-1), and then plot point g that distance from y=x in the opposite direction. Read the coordinates of point g from the graph.
Alternatively, calculate the distance from y=x of (8,-1). As before, this distance is perpendicular to y=x and is measured along the line y= -x + b, where b is the vertical intercept of this line. What is b? y = -x + b must be satisfied by (8,-1): -1 = -8 + b, or b = 7. Then the line thru (8,-1) perpendicular to y=x is y = -x + 7. Where does this line intersect y = x?
y = x = y = -x + 7, or 2x = 7, or x = 3.5. Since y=x, the point of intersection of y=x and y= -x + 7 is (3.5, 3.5).
Use the distance formula to determine the distance between (3.5, 3.5) and (8, -1). This produces the answer to this question.