A set $A \subseteq \mathbb{R}$ is closed if and only if every convergent sequence in $\mathbb{R}$ completely contained in $A$ has its limit in $A$
Real analysis is a topic I'm unfamiliar with and I'm confused on how to write proofs on them.
In order to prove that:
A set $A \subseteq \mathbb{R}$ is closed (1) $\iff$ Every convergent sequence in $\mathbb{R}$ completely contained in A has its limit in A (2)
The definition of closed I am using is that if A is closed, then $\mathbb{R} \setminus A $ is open (i.e. $\mathbb{R} \setminus A \in \tau$.
I realize that I have to prove both directions.
First, in order to prove that (1) $\implies$ (2):
Let $A \subseteq \mathbb{R}$ be a closed set and let $(x_{n})_{n \in \mathbb{N}}$ be a sequence of reals with $x_{n} \in A$ for every $n \in \mathbb{N}$ converging to $x_{\infty} \in \mathbb{R}$.
From here, I'm not sure on how to continue writing the proof. I am trying to ultimately prove that $x_{\infty} \in A$.
To prove an if and only if, we need to prove the $\implies$ direction and the $\impliedby$ direction.
For the $\implies$ direction, suppose $A \subseteq \mathbb{R}$ is closed.
We want to prove then that if $\{ x_{n} \}_{n = 1}^{\infty}$ is a sequence of real numbers in $A$ that converges, then its limit is in $A$. If we call $x$ the limit of this sequence (i.e., $\lim x_n = x$), then by definition of convergence, given $\epsilon > 0$, there exists an $N$ such that if $n \geq N$ then $d(x_{n}, x) < \epsilon$ (alternatively, for all $n \geq N$, $x_{n} \in B(x, \epsilon)$).
To show that every convergent sequence contained in $A$ has its limit in $A$, suppose by contradiction that there is a convergent sequence $\{ x_{n} \}_{n = 1}^{\infty}$ in $A$, but its limit, $x$, is in $\mathbb{R} \setminus A$. Since $A$ is closed, $\mathbb{R} \setminus A$ is open. Since $x \in \mathbb{R} \setminus A$, and the set is open, we know by definition of open that $\exists \epsilon > 0$ such that $B(x, \epsilon) \subseteq \mathbb{R} \setminus A$. So we found a ball around $x$ entirely contained in $\mathbb{R} \setminus A$. But by definition of a convergent sequence, $\exists N$ such that for all $n \geq N$, $x_{n} \in B(x, \epsilon)$. So there is a point in the sequence after which all terms are in $B(x, \epsilon)$. But $B(x, \epsilon) \subseteq \mathbb{R} \setminus A$. Which means there are points of the sequence in $\mathbb{R} \setminus A$. This contradicts the assumption that the sequence was entirely contained in $A$. Thus, every convergent real sequence contained in $A$ has its limit in $A$, as desired.
Hopefully you should now have some idea on how to prove the other direction. Just remember your definitions.
Definition. A set $A \subset \Bbb R$ is closed if $A$ contains all of its limits.
Definition. A point $p \in \Bbb R$ is a limit of $A \subset \Bbb R$ if there exists a sequence $(p_n)$ and $n\in\Bbb N \implies p_n \in A$ and $p_n \to p$. If this is the case, we say $p \in \lim A.$
$(\impliedby)$ Suppose for the sake of contradiction that every convergent sequence in $\Bbb R$ completely contained in $A$ has its limit in $A$, and yet $A$ is not closed. Since $A$ is not closed, there exists $p \in \lim A$ such that there exists a sequence $(p_n)$ and $n \in \Bbb N \implies p_n \in A$, $p_n \to p$ and yet $p \notin A$. This is a contradiction.