Let $\phi: A \to B$ be a ring homomorphism with $\phi(1_A)=1_B$. Let $\mathrm{Spec}(A)$ denote the set of all prime ideals of $A$. Let $f \in A$.
Consider the associated map $\phi^* = \mathrm{Spec}(\phi): \mathrm{Spec}(B) \to \mathrm{Spec}(A)$.
I have tried to show that
(a) $\mathrm{Im}(\phi^*) \subset V(f) \iff \phi(f) $ is nilpotent
(b) $\mathrm{Im}(\phi^*) \cap V(f) = \emptyset \iff \phi(f) $ is unit
I proved only if parts of statements of (a) & (b). But I couldn't write a valid argument for if parts. Any help or hint will be appreciated.
Note: For $x \in X=\mathrm{Spec}(A)$, we shall write an ideal with $j_x$. Then $$V(f)= \{x \in X : f \in j_x\} = \{x \in X : j_x \supset (f) \}.$$
Recall that the nilradical (the set of all nilpotent elements) is the intersection of all prime ideals of the ring: $\DeclareMathOperator{\Nil}{Nil} \DeclareMathOperator{\p}{\mathfrak{p}} \DeclareMathOperator{\Spec}{Spec} \DeclareMathOperator{\img}{img} \newcommand{\V}{\mathbb{V}} \Nil(B) = \bigcap_{\p \in \Spec(B)} \p$. Then \begin{align*} \varphi(f) \in \Nil(B) &\iff \forall \p \in \Spec(B), \varphi(f) \in \p\\ &\iff \forall \p \in \Spec(B), \, f \in \varphi^{-1}(\p) = \varphi^*(\p)\\ &\iff \forall \p \in \Spec(B), \varphi^*(\p) \in \V(f)\\ &\iff \img(\varphi^*) \subseteq \V(f) \, . \end{align*}
See if you can figure out part (b) now. It should follow similarly from the observation that $\varphi(f)$ is a unit iff $\varphi(f) \notin \p$ for all $\p \in \Spec(B)$.