I'm trying to show that a preference relation $\succsim$ is continuous if and only if the upper and lower contour sets are closed.
The direction $\Rightarrow$, i.e. continuity implies the upper and lower contour sets are closed, is trivial, but I'm really struggling to show the other direction. Here is my attempt so far:
Assume that all upper and lower contour sets are closed. Let $x^n$ be a sequence converging to $x$, $y^n$ a sequence converging to $y$ with $x^n \succsim y^n$ for each $n$. Suppose, for a contradiction, that we do not have $x \succsim y$, i.e. $y$ is not contained in $L(x)$, the lower contour set of $x$.
Since $L(x)$ is closed, we have $\bar{L(x)} = L(x)$ and so this means there exists an $\varepsilon>0$ such that $B(y,\varepsilon)\subset X \setminus L(x)$. $y^n \rightarrow y$ so there exists an $N$ such that $y^n\in B(y,\varepsilon)$ for all $n\geq N$. Then I don't know how to proceed.
Note: We have also been given an alternative definition of continuity, which states that if $x^n \rightarrow x$ and $x^n \succsim y$ for each $n$ then $x \succsim y$. It is clear that this is follows from the first definition, but I don't know if the other direction is true. I'm also unsure how this definition would imply closedness of the lower contour sets (the closedness of the upper contour sets is clear).
As you have argued, if the claim is false, then $y^{n} \succ x$ for all but finitely many $n$. Analogously, because $U(y)$ is closed, $y \succ x^{n}$ for all but finitely many $n$. Therefore, for all $n$ larger than some $n_{0}$, we have $y \succ x^{n} \succeq y^{n} \succ x$. In particular, $y \succ y^{n_{0}} \succ x$.
See if you can finish the proof from here by using the fact that the upper and lower contour sets of $y^{n_{0}}$ are closed. (Just to be sure, there is no special reason for using $y^{n_{0}}$ instead of $x^{n_{0}}$ to complete the proof. The argument given below only requires that there be some point $z$ in $X$ that satisfies $y \succ z \succ x$.)
Using closedness of the upper and lower contour sets again, we infer that there is an open neighborhood $O_{y}$ of $y$ contained in $X \setminus L(y^{n_{0}})$, and an open neighborhood $O_{x}$ of $x$ contained in $X \setminus U(y^{n_{0}})$. Since the two sequences are assumed to converge to $x$ and $y$ respectively, there exists a number $n_{1}$ such that for all $n$ greater than $n_{1}$, \begin{align*} y^{n} \in O_{y} \subseteq X \setminus L(y^{n_{0}}) \quad \text{and}\quad x^{n} \in O_{x} \subseteq X \setminus U(y^{n_{0}}). \end{align*} But now we have reached a contradiction, since $y^{n} \succ y^{n_{0}} \succ x^{n}$ is impossible if $x^{n} \succeq y^{n}$ for all $n$.
The second definition does not imply the first. For a counterexample, let the relation to be such that it is represented by a function $f$ which is upper-semicontinuous, but not lower-semicontinuous. For instance, let $X = [0, 1]$ and let $f\colon[0, 1]\to\mathbb{R}$ be the function $$ f(x) = \begin{cases} -x \quad \text{, if $x \in [0, 1/2)$},\\ 1 + x \quad \text{, else}. \end{cases} $$ Then $x^{n} \succeq y$ and $x^{n} \to y$ imply $x \succeq y$ since $f$ is upper-semicontinuous. On the other hand, the lower contour sets are not closed. To see this, note that $0 \succeq 1/2 - 1 / n$ for every $n$ since $f(0) \geq f(1/2 - 1/n)$. However, $1/2 \succ 0$ since $f(1/2) > f(0)$.