Clarify my query plz $A=\{n+1\mid n\in \mathbb{N}\}$ i.e. $A=\{2,3,\ldots\}$
$B=\{n+1/n\mid n\in A\}$ i.e. $B={2 \text{ whole } 1/2, 3\text{ whole } 1/3, \ldots}$
Obliviously $A \cap B = \phi$
$d(A,B)=\inf_{x\in A,y\in B} d(x,y)$
But my teacher says
$d(A,B)=\inf\{|x-y| : x\in A,y\in B\}$
$d(A,B)=\inf\{1/2,1/3,\ldots\}$
$d(A,B)=\inf\{1/n: n\in \mathbb{N}\}$. i.e $0$
He subtracted corresponding elements but according to me every element of $A$ should be subtracted from $B$ i.e
$d(A,B)=\inf\{1-1/n :n\in \mathbb{N}\}$ in general and in both cases and is zero so can anyone clearyfy that which one is correct
 A: You would subtract every element in $A$ from every element in $B$ to get the set of numbers whose infimum is taken.  However, if you include only a subset of those differences and get $0$ as the infimum of that subset, then $0$ must be the infimum of the whole set, since all members of that set of differences are non-negative.
A: The statement that
$$d(A,B)=\inf\{|x-y|:x\in A\text{ and }y\in B\}$$
is correct. After that matters get a bit complicated if you check everything carefully; your teacher is correct but has left out a few steps in the argument.
$$\begin{align*}
\{|x-y|:x\in A\text{ and }y\in B\}&=\left\{\left|n-\left(m+\frac1m\right)\right|:n,m\in A\right\}\\
&=\left\{\left|m-n+\frac1m\right|:n,m\in A\right\}\;,
\end{align*}\tag{1}$$
and
$$\left|m-n+\frac1m\right|=\begin{cases}
m-n+\frac1m,&\text{if }m\ge n\\
n-m-\frac1m,&\text{if }m<n\;.
\end{cases}$$
For a given $n\in A$, the smallest possible value of $m-n+\frac1m$ is $\frac1n$, when $m=n$, because when $m>n$ the expression is always greater than $1$. The smallest possible value of $n-m-\frac1m$ for $m<n$ occurs when $m=n-1$, in which case $n-m-\frac1m=1-\frac1m$. Since $m$ is required to be in $A$, $m\ge 2$, the smallest value of this expression is $\frac12$, which is already one of the numbers $\frac1n$ from the case $m\ge n$. We needn’t consider any other members of the set $(1)$, because they’re all at least as large as some $\frac1n$ with $n\in A$, and we can therefore say that
$$d(A,B)=\inf\left\{\frac1n:n\in A\right\}=0\;.$$
