How many points with integer coordinates lie on at least one of these paths?

363 Views Asked by At

A bug travels in the coordinate plane, moving only along the lines that are parallel to the $x$-axis or $y$-axis. Let $A = (-3, 2)$ and $B = (3, -2)$. Consider all possible paths of the bug from $A$ to $B$ of length at most $20$. How many points with integer coordinates lie on at least one of these paths?


2

There are 2 best solutions below

0
On BEST ANSWER

All coordinates on or within the outer border of points shown below, could be reached. I make it $195$ coordinates.

enter image description here

0
On

In fact, this question deals with a discrete equivalent of the interior of an ellipse

$$E_k \ = \ \{X \ | \ d(X,A)+d(X,B) \le k \}$$

with focii $A$ and $B$ for the so-called $1$-norm distance:

$$d(A,B)=|x_A-x_B|+|y_A-y_B|$$

(in the framework of discrete issues, one find expression "taxi-distance" or "Manhattan distance"):

Here is a plot of the boundaries of different such ellipses for increasing values of $k$ with an alternation of blue and red colors :

enter image description here

Here is the Matlab program with which I have obtained the above figure:

dm=@(a,b,x,y)(abs(a-x)+abs(b-y)); % Manhattan distance
Ax=-3;Ay=2;Bx=3;By=-2; ù foci
for X=-10:10
  for Y=-10:10;
      c=dm(X,Y,Ax,Ay)+dm(X,Y,Bx,By);
      col='r';
      if mod(c/2,2)==1
          col='b';
      end;
      if (X==Ax && Y==Ay)||(X==Bx && Y==By)
          col='g'; % foci colored green
      end;
      plot(X,Y,'o','color',col,'MarkerEdgeColor',col,...
      'MarkerFaceColor',col,'MarkerSize',10);
   end;
end