I'm assuming your teacher meant to say "line segment AB" and not "line segment AD". Point D is not given at all. If that assumption holds up, then you can proceed with the rest of the solution below. If not, then you'll have to talk to your teacher. I think its a typo but its possible that there's more context somewhere that I'm not seeing (a diagram maybe?)
---------------------------------------
We're given the two points (2,7) and (5,1). The first thing we need to do is find the slope of the line through those points. Lets assign them to be equal to (x1,y1) and (x2,y2), so,
(x1,y1) = (2,7) and (x2,y2) = (5,1)
which further breaks down into these four items:
x1=2
y1=7
x2=5
y2=1
Plug each of those into the slope formula and simplify
m = (y2 - y1)/(x2 - x1)
m = (1 - 7)/(5 - 2)
m = (-6)/(3)
m = -2
The slope is -2. We'll use this to find the y intercept. We'll also use one of the points given to us, say the point (2,7)
(x,y) = (2,7) ---> x = 2 and y = 7
Plug m = -2, x = 2, and y = 7 into the equation below and solve for b
y = m*x + b
7 = -2*2 + b
7 = -4 + b
7 + 4 = -4 + b + 4
11 = b
b = 11
So we figured out that m = -2 is the slope and b = 11 is the y intercept
Therefore, the equation y = mx+b turns into y = -2x+11
Final Answer: y = -2x+11
-------------------------------------------------
Checking the answer:
plug in x = 2 and we get...
y = -2*x + 11
y = -2*2 + 11
y = -4 + 11
y = 7
so that proves (x,y) = (2,7) is on the line y = -2x+11
Plug in x = 5 and we get...
y = -2*x + 11
y = -2*5 + 11
y = -10 + 11
y = 1
so that proves (x,y) = (5,1) is on the line y = -2x+11
Both points are on the same line y = -2x+11 so the answer is confirmed