General topological space $2$. 1. Let $A\subset X$ be a closed set of a topological space $X$. Let $B \subset A$ be a subset of $A$. prove that $B$ is closed as a subset of $A$, if and only if $B$ is closed as a subset of $X$.
What I have done is that if $B$ is closed in $A,B$ should be the form of $A\cap C$ where $C$ is closed in $X$... ( I don't know whether this is true or not..) anyway, then, $A$ and $C$ is all closed in $X$. Hence, $B$ also should be closed in $X$. I think this is just stupid way. I don't know how to prove solve this problem.
2. If we omit the assumption that $A$ is closed, show that previous exercise is false.
What I have done is that if I let $X=R$ and $A=(0,1)\cup(2,3)$ in $R$, although the interval $B=(0,\frac{1}{2}]$ is a subset of $A$ and closed in $A$, it is not closed in $X$. and I don't know the opposite way.
please help me.

You're right about the first part, though you did only one part. Indeed if $B$ is closed in $A$, $B = A \cap C$ for some closed set $C$ of $X$, and so $B$ is a finite intersection of closed sets in $X$, hence closed in $X$.
The second part is easier still: if $B$ is closed in $X$, what closed set $C$ of $X$ could you find such that $B = A \cap C$? This would show $B$ is closed in $A$ as well.
Your $B$ example for (2) seems fine: $B$ is closed in $A$ (write out why!), but $B$ is not closed in $X$ (also, give the reason why). It suffices to do this, this already shows that the first exercise fails (there is no equivalence between being closed in $A$ and closed in $X$, and this you have shown).
