[proofplan]
Both parts follow from the characterisation of open (respectively closed) sets in the subspace topology as intersections with ambient open (respectively closed) sets. In part 1, $B$ open in $A$ means $B = U \cap A$ for some $U$ open in $X$; since $A$ is itself open in $X$, the intersection $U \cap A$ is a finite intersection of open sets in $X$, hence open in $X$. Part 2 is the closed analogue: replace "open" with "closed" and "intersection" remains "intersection" (closed sets are closed under finite intersection).
[/proofplan]
[step:Prove that $B$ open in $A$ and $A$ open in $X$ implies $B$ open in $X$]
Since $B$ is open in the subspace topology on $A$, there exists $U \in \tau$ (i.e., $U$ open in $X$) with $B = U \cap A$. Since $A$ is open in $X$, both $U$ and $A$ belong to $\tau$. The topology $\tau$ is closed under finite intersections, so $B = U \cap A \in \tau$, meaning $B$ is open in $X$.
[guided]
The subspace topology on $A$ consists of all sets of the form $U \cap A$ where $U$ is open in $X$. Since $B$ is open in $A$, we can write $B = U \cap A$ for some $U \in \tau$.
Now we use the hypothesis that $A$ is itself open in $X$: $A \in \tau$. The set $B = U \cap A$ is therefore the intersection of two members of $\tau$. By the axioms of a topology, $\tau$ is closed under finite intersections, so $U \cap A \in \tau$. Hence $B$ is open in $X$.
Note where both hypotheses are consumed: "open in $A$" produces the representation $B = U \cap A$, and "$A$ open in $X$" ensures that $A \in \tau$ so that the intersection stays in $\tau$. Without the second hypothesis, $U \cap A$ need not be open in $X$ — for instance, $[0, 1)$ is open in $A = [0, 1]$ (as a subspace of $\mathbb{R}$) but is not open in $\mathbb{R}$.
[/guided]
[/step]
[step:Prove that $B$ closed in $A$ and $A$ closed in $X$ implies $B$ closed in $X$]
Since $B$ is closed in the subspace topology on $A$, there exists a closed set $F \subset X$ with $B = F \cap A$. (This is the closed-set characterisation of the subspace topology: a subset of $A$ is closed in $A$ if and only if it equals the intersection of $A$ with a closed set in $X$.) Since $A$ is closed in $X$, both $F$ and $A$ are closed in $X$. A finite intersection of closed sets is closed, so $B = F \cap A$ is closed in $X$.
[guided]
We first recall the closed-set characterisation of the subspace topology. A set $C \subset A$ is closed in $A$ if and only if $A \setminus C$ is open in $A$, which holds if and only if $A \setminus C = U \cap A$ for some open $U \in \tau$. Taking complements relative to $A$: $C = A \setminus (U \cap A) = A \cap (X \setminus U)$. Setting $F = X \setminus U$, which is closed in $X$, we obtain $C = F \cap A$. Conversely, if $C = F \cap A$ for some closed $F$ in $X$, then $A \setminus C = A \cap (X \setminus F)$ is the intersection of $A$ with the open set $X \setminus F$, hence open in $A$, so $C$ is closed in $A$.
Applying this to $B$: since $B$ is closed in $A$, there exists a closed set $F \subset X$ with $B = F \cap A$. Now $A$ is closed in $X$ by hypothesis, and $F$ is closed in $X$ by construction. Since finite intersections of closed sets are closed (the complement of $F \cap A$ is $(X \setminus F) \cup (X \setminus A)$, a union of two open sets, hence open), $B = F \cap A$ is closed in $X$.
As in part 1, both hypotheses are necessary. Without $A$ being closed in $X$, the intersection $F \cap A$ of a closed set with a non-closed set need not be closed. For example, $\{0\}$ is closed in $A = [0, 1)$ (as a subspace of $\mathbb{R}$), but $[0, 1)$ is not closed in $\mathbb{R}$; nonetheless $\{0\}$ is still closed in $\mathbb{R}$ in this case. A sharper example: $A = (0, 1)$ is not closed in $\mathbb{R}$, the set $B = (0, 1)$ is closed in $A$ (it equals $A$ itself), yet $B = (0, 1)$ is not closed in $\mathbb{R}$.
[/guided]
[/step]