# Wondering how these two sets are countably infinite

We have $$A = \mathbb{R}$$ and $$B = \{x|x \in \mathbb{R} \land \exists y (y\in \mathbb{Z} \land |x-y| < \frac{1}{2})\}$$

How is $$A-B$$ countably infinite?

I know the definition of set minus is $$A \cap \overline{B}$$, but I don't know how to translate $$B$$ and to see if this is a countable set.

• Consider - what real numbers are not in $B$? Argue that it is those that are precisely between the integers, i.e. numbers of the form $n + 1/2$ for $n \in \Bbb Z$. That set is countable. – Eevee Trainer 2 days ago
• don't we have $A-B=\{\ldots, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, \ldots\}$? – angryavian 2 days ago
• How do you get all of this multiples of halves? I thought when $x-y < 1/2$ right? So, how do we get a half? – DippyDog 2 days ago
• $|x-y|<1/2\iff x\in(y-1/2,y+1/2)$ and thus $B=\{x\in\Bbb R|\exists y\in\Bbb Z(x\in(y-1/2,y+1/2))\}$. Now letting $\{y\}$ denote the fractional part of $y\in\Bbb R,\{x\}<1/2\iff\lfloor x\rfloor\le x<\lfloor x\rfloor+1/2$ and $\{x\}>1/2\iff\lceil x\rceil-1/2<x<\lceil x\rceil$. Thus the only real $x$ which do not belong to $B$ are those which have $\{x\}=1/2$ i.e. $A-B=\{z+1/2:z\in\Bbb Z\}$. – Shubham Johri 2 days ago
• I'm not sure how to say this in formal terms, but a rough argument can go like this: The real numbers x not in B must make $|x-y| \geq 1/2$ for any integer $y$. But if $|x-y|$ is strictly greater than 1/2, there exists some integer $y'$ that makes $|x-y'| < 1/2$. So the complement of B contains only real numbers $x$ such that $|x - y| = 1/2$ for any integer $y$ – c1620 2 days ago

$$A-B=\{z+\frac{1}{2}\mid z \in \Bbb Z\}$$ so it is in bijection with $$\Bbb Z$$.
If $$x$$ is a real and its fractional part is $$< \frac12$$ then $$\lfloor x \rfloor$$ witnesses that $$x \in B$$, so $$x \notin A-B$$. If the fractional part is $$>\frac12$$ then $$\lceil x \rceil$$ witnesses that $$x \in B$$ and also $$x \notin A-B$$ so the only reals in this difference are those with exactly fractional part $$\frac12$$, i.e. the set on the right hand side.
$$|x-y|<1/2\iff x\in(y-1/2,y+1/2)$$ and thus $$B$$ contains all intervals of the form $$(y-1/2,y+1/2),y\in\Bbb Z$$. The only real numbers not in $$B$$ are of the form $$y+1/2,y\in\Bbb Z$$ and thus $$A-B=\{y+1/2:y\in\Bbb Z\}$$ is countably infinite since $$\Bbb Z$$ is countably infinite.