# Thread: A hint, but no answer please!

1. ## A hint, but no answer please!

Ok, this is probably a really easy problem, but I've been trying for 2.5 days to work on it, with no luck. Any hints would be helpful, but no answers, please.

"Given threee points (x1, y1), (x2, y2), and (x3, y3), write a program to check if all the three points fall on one straight line."

My math skills are lacking in this area, so even if I were to just do it mathematically without a computer, I would just physically plot the points and see if they fell on the same line. I know these equations, but I don't know how to fit them in to this problem:

y=mx+b

(y2-y1)/(x2-x1)

My only idea is to figure out some type of relationship that exists between (x1,y1) and (x2, y2) and see if the same relationship exists between those and (x3, y3), but I'm not sure how to go about doing that. Thanks, y'all!

2. I don't know how much of a hint I can give, since "m = (y2-y1)/(x2-x1)" is in fact the answer to the problem.

3. Consider that only points on a line satisfy the equation of a line. And this equation might help (highlight if you get stuck. y - y1 = m(x - x1))

4. lol! yr 10 maths!

you cannot check one point at a time, you have to check x then y and if both of them check out then the point is on the line.

you do this by : (i hope you meant no C answers)

substituting y for 0 (in y=mx+b) and if m*the gradient of the line + the y intercept = 0 then you check by subbing x for 0 and if y = b (m*the gradient of the line[x] = 0) then you have your self a point on the line!

Popular pages Recent additions