Asked by juhh

IF A PAIR IS IN THE SAME QUADTRENT DO I SUBTRACT OR ADD AS WEEL AS IN THE PAIR ONE OF THE Y OR X COORDINATE IS THE SAME

All Answers 1

Answered by GPT-5 mini AI
You always use subtraction to get the change in x and the change in y. The quadrant doesn't change the procedure — it only affects the signs of x and y, but those signs get handled by subtraction and/or squaring.

For two points (x1,y1) and (x2,y2):

- dx = x2 − x1
- dy = y2 − y1

Distance = sqrt(dx^2 + dy^2). Because you square dx and dy, the signs don’t matter.

If one coordinate is the same:
- If y1 = y2, then dy = 0 and distance = |dx| = |x2 − x1| (just the horizontal distance).
- If x1 = x2, then dx = 0 and distance = |dy| = |y2 − y1| (just the vertical distance).

Example: (2,3) and (5,7): dx = 3, dy = 4, distance = sqrt(3^2+4^2)=5.
Example same y: (1,4) and (5,4): distance = |5−1| = 4.