How to show that $f(0) = 0$? I'm stuck on an exercise, I tried few things but I really do know know what is the way to proceed.

Be $A\subset \mathbb{R}$ defined as $$A = \left\{ (-1)^n \frac{n}{2n^2+3};\ n\in\mathbb{N}\right\}$$


and be $f:\mathbb{R}\to\mathbb{R}$ such that $$xf(x) = 0\qquad \forall x \in A$$


*

*if $f$ is continuous, show that $f(0) = 0$. Propose then a function $f$ that satisfies the above condition and such that $f(0) \neq 0$.

First of all, I do not know if I have to consider $\mathbb{N}$ containing $0$ or not. I think not, because otherwise I would not know what the boundary of $A$ is, since if $0\in\mathbb{N}$ then for $n = 0$ the first element is zero, but it's also zero when $n\to +\infty$.
Onthe contrary if $0\not\in\mathbb{N}$ then the first element is $-\frac{1}{5}$, and then I have $\partial A = \left(-\frac{1}{5}, 0\right)$.
I don't really know if this helps me...
I have no information on $f(x)$ if not its continuity, so I may state that $f(x)$ is continuous on $\partial A$ but $0\not\in A$, so how to show $f(0) = 0$?
Also for the second part I thought about some discontinuous function like $f(x) = 1$ for $x = 0$ but I think it's wrong.
I don't understand.
 A: Chose a sequence $a_n\in A$ with $\lim_{n \to \infty}a_n=0.$ Then $a_nf(a_n)=0$ and thus $f(a_n)=0$ since we can divide by $a_n\neq 0.$ Finally, if $f(x)$ is continuous, then
$$
0=\lim_{n \to \infty}f(a_n)=f(\lim_{n \to \infty}a_n)=f(0).
$$
A: First, note that for each $x \in A$ we have $x \neq 0$, hence the fact that
$$xf(x) = 0$$ implies that $f(x) = 0.$
Suppose $f$ is continuous. If we have a sequence $x_{1}, x_{2}, \ldots$ of elements in $A$ converging to $0$, then $f(x_{1}), f(x_{2}), \ldots$ converges to $f(0)$. We know that $f(x_{1}), f(x_{2}), \ldots$ are all zero by the above argument, so $f(0)$ must be zero.
Therefore, it suffices to find a sequence $x_{1}, x_{2}, \ldots$ of elements in $A$ converging to $0$. I leave this to you.
Your idea for the second part is right: just take $f(x)$ to be a function which is zero for all $x \neq 0$ and is $1$ for $x = 0.$ Then certainly $xf(x) = 0$ for all $x \in A$, but $f(0) = 1 \neq 0.$
A: The problem throws a couple of complications your way as red herrings. First, the particular definition of $A$ is more or less irrelevant. The important parts are $0\notin A$ and $0\in\partial A$. Second, since $0\notin A$, the requirement on $f$ is equivalent to $f(x)=0$ for all $x\in A$.
Assume $f(0)=a\neq0$. Pick $\varepsilon=\frac{|a|}2$, and use $(-\delta,\delta)\cap A\neq\varnothing$ to show $f$ is necessarily discontinuous. By contraposition, if $f$ is continuous we have $f(0)=0$.
As for the concrete discontinuous example, the way I read your attempt, it seems to be just right. You just have to write it down in a way that doesn't require interpretation. Something like
$$
f(x)=\cases{1&if $x=0$\\0&otherwise}
$$
