Source : Alan F. Karr (Probability), p.$96$, problem $3.10.(b)$
MY SOLUTION :
Suppose $B \subset \mathbb{R}$ such that $P\left\{Y \in B\right\}=1$. We want to show that $B$ is singleton. First of all $B \neq \phi$ since $g(0) \in B$. Assume, for sake of contradiction, $B$ is not singleton. Let $A \subset B$ such that $P\left\{Y \in A\right\}>0$ and $P\left\{Y \in B \setminus A\right\}>0$. Such a set $A$ can always be constructed because of the assumption. Note that
$$P\left\{X \in g^{-1}(A), Y \in A^c\right\} = 0 \neq P\left\{X \in g^{-1}(A)\right\} \cdot P\left\{Y \in B \setminus A\right\}$$
Both the terms in the right side are strictly positive by assumption $(P\left\{X \in g^{-1}(A)\right\}=P\left\{Y \in A\right\}>0)$. Hence, $X$ and $Y$ are not independent. Thus, we have arrived at a contradiction.
Please verify whether or not my solution is technically okay and if it can be improved in any regards. Thanks in advance.

For any measurable set $B$, we have $$P(Y \in B) = P(\{Y \in B\} \cap \{X \in g^{-1}(B)\}) = P(Y \in B) P(X \in g^{-1}(B)) = P(Y \in B)^2,$$ so $P(Y \in B) \in \{0,1\}$, regardless of what $B$ is. Now consider $B$ of the form $(-\infty, y]$.