Let $U\subseteq X\times Y$. Show that $\pi_X(U)$ is open in X and $\pi_Y(U)$ is open in Y $\Rightarrow$ U is open does not hold I have to do this exercise:
Let X and Y be topological spaces and equip $X \times Y$ with the product topology. Define $\pi_X: X \times Y \to X$ by $\pi_X((x,y))=x$, and $\pi_Y:X \times Y\to Y$ by $\pi_Y((x,y))=y$
I have shown that doe every open set $U\subseteq X \times Y$ $\pi_X(U)$ is open in X, and $\pi_Y(U)$ is open in Y, but now I have to show that the opposite does not hold with a counterexample. i.e I have to show that for a subset $Z\subseteq X \times Y$ it will hold that $\pi_X(Z)$ is open in X, and $\pi_Y(Z)$ is open in Y, but Z will not be open in $X \times Y$ with respect to the product topology.
I have found an example for this, where I let $X =\mathbb{R}$, and $Y=\mathbb{R}$, and I let $Z=\{(x,y)|\frac{1}{2}\leq \|(x,y)\|<1\}$. Intuitively I can see that $\pi_X(Z)=(-1,1)$, and $\pi_Y(Z)=(-1,1)$, but I have to show it, because then I will have that $\pi_X(Z)$ and $\pi_Y(Z)$ is open, and I am a little confused on how to do that, and furthermore I can intuitively see that Z is not open in $X\times Y$ wrt. the product topology, but I am a little confused about how to do that.
 A: Notation. To avoid confusion,  $(b,c)$ will denote an open real interval and $<b,c>$ will denote an ordered pair.
The "canonical" base (basis) for the product topology on $\Bbb R^2$ is $$B=\{I\times J: I,J\in T_{\Bbb R}\}$$ where $T_{\Bbb R}$ is the topology on $\Bbb R.$
Consider any $<x,y>\in V$ where $V$ is open in $\Bbb R^2$. We have $<x,y>\in I\times J\subset V$ for some $I\times J\in B.$ Now since the set of bounded open real intervals is a base for $T_{\Bbb R},$ there exist positive $r,r'$ with $(x-r, x+r)\subset I$ and $(y-r',y+r')\subset J.$ So  $$<x,y>\in (x-r,x+r)\times (y-r',y+r')\subset I\times J\subset V.$$
In your example, $<1/2,0>\in Z.$ Consider any open  $V$  such that $<1/2,0>\in V$. We have $(1/2-r,1/2+r)\times (-r',r')\subset V$ for some positive $r,r'.$  But now if $s=\min (1/4, r/2,r'/2)$ then $<1/2-s,0>\in V$ but $\|<1/2-s,0>\|=1/2-s<1/2.$ So $<1/2-s,0>$ is in $V,$ but not in $Z,$ so $\neg (V\subset Z).$ Therefore $Z$ is not open.
Remark. We can also do the above paragraph by contradiction: Suppose $Z$ is open. Then in the above paragraph, put $V=Z.$ We get $<1/2-s,0>\in V\setminus Z=Z\setminus Z,$ which is absurd.
Note. In general if $T_x,T_Y$ are topologies on $X,Y$ respectively, and if $B_X, B_Y$ are bases for $T_x,T_Y$ respectively, then $\{b\times b': b\in B_X\land b'\in B_Y\}$ is a base for $X\times Y.$ In particular,  if $C$ is the set of bounded open real intervals then $\{b\times b':b,b'\in C\}$ is a base for $\Bbb R^2$.... It is often convenient to work with bases rather than with the entire topologies.
A: A few of the commenters have suggested simpler counter-example than the one that you found. But I think it's still worth it to see how one would show that your own counter-example is actually a legit counterexample.
So let $X = \mathbb{R}, Y = \mathbb{R}$ and $Z = \{(x,y): \frac{1}{2} \leq ||(x,y)|| < 1\}$.
To show that $\pi_X(Z) = (-1,1)$ we do what we often do when showing equalities of two sets, namely we will show $\pi_X(Z) \subseteq (-1,1)$ and $(-1,1) \subseteq \pi_X(Z)$.
Let $(x,y) \in Z$. If $|x| \geq 1$ would be true, then $||(x,y)|| \geq 1$, but this is not possible since $(x,y) \in Z$. Therefore $|x| < 1$, i.e., $\pi_X((x,y)) = x \in (-1,1)$.
For the other direction, let $x \in (-1,1)$, define $y = 0 $ if $ \frac{1}{2} \leq |x| < 1$, $y = \sqrt{\frac{1}{4} - x^2}$ else. (Maybe there is a more clever way to define $y$. The idea is that you just construct it so that $(x,y) \in Z$...). Now you can check that indeed $(x,y) \in Z$, so $x \in \pi_X(Z)$.
The case for $\pi_Y$ is exactly the same.
Finally, to check that $Z$ is not open you can look for a point in $Z$ that has no open neighborhood in $Z$. Good candidates will be points $(x,y)$ such that $||(x,y)|| = 1/2$.
