I'm facing the next problem from the book: A First Course in Real Analysis by Sterling Berberian in the page 64, ex 5.
If $A$ is a closed subset of $\mathbb{R}$, prove that each of the following sets is also closed. $-A= \{ -x : x\in A \}$, $B= \{ |x| : x\in A \}$ and $C= \{ x^2 : x\in A \}$
I am confident of my proof for the first set. However for the second set, I took a sequence $y_n\in B$ such that $y_n \rightarrow p\in R$. For $B$ to be closed I want to show that $p\in B$. They hint me, that I should make use of Weierstrass-Bolzano theorem. So since $y_n$ is convergent then it is bounded, plus $y_n=|x_n|$ for $x_n \in A$. So from here I want to take a subsequence $y_{n_{k}}=x_{n_{k}}\geq0$ that of course will be convergent to $p$.
Now, using absolute value definition, $$y_n=|x_n|= \begin{cases} x_n, & \text{if } x_n\geq 0 \\ -x_n, & \text{if } x_n<0 \end{cases}$$
So if I take the positive subsequence $y_{n_{k}}=x_{n_{k}}\geq 0, (\forall {n_{k}}\in \mathbb{N}) $, we'll have convergence to $p$ of a sequence of $A$ , so $p\in A$ ($A$ is closed) and therefore $|p|=p\in B$.
Can I get your opinion? I feel there is something flawed with this, and I can't find the argument as to why.
It is not correct. You can't say that $y_{n_k}=x_{n_k}$. Imagine, for instance, that each $x_n$ is negative.
However, since there are infinitely many natural numbers either $y_n=x_n$ infinitely many times or $y_n=-x_n$ infinitely many times. If, for intance, $y_n=x_n$ infinitely many times, them, since $\lim_{n\to\infty}y_n=p$, if $n_k$ is the $k$th natural such that $x_{n_k}\geqslant0$, $\lim_{k\to\infty}y_{n_k}=p$ and therefore $\lim_{k\to\infty}x_{n_k}=p$. Since $A$ is closed, $p\in A$ and so $p\in B$.
The case in which $y_n=-x_n$ infinitely many times is similar.