Let $X=\{z \in \mathbb C:1\leq|z|\leq2\}\text{ and } f(z)=z,z\in X.$ Let $A$ be the smallest closed subalgebra of $C(X)$ generated by $1$ and $f,$ and $B$ be the smallest closed subalgebra of $C(X)$ generated by $f$ and $\frac 1f.$ Determine the spectra $\sigma_A(f)$ and $\sigma_B(f).$ What happens if $X$ is a circle?
My attempt: Clearly, $\sigma_{C(X)}(f)=X$ and $A\subseteq B \subseteq C(X).$ So $X \subseteq \sigma_B(f)\subseteq \sigma_A(f).$
Now, $A=\{p(f):p\text{ is a polynomial}\}.$ Therefore, $\dfrac{1}{\lambda-f}\not \in A$ for all $\lambda \in \mathbb C.$ So, $\lambda-f$ is not invertible in $A$ for all $\lambda \in \mathbb C.$ This implies $\sigma_A(f)=\mathbb C.$
Similarly $B$ is the set of all polynomials in $f$ and $\frac 1f.$ Therefore, $\dfrac{1}{\lambda-f} \in B$ for all $\lambda \in \mathbb C\setminus X.$ So, $\lambda-f$ is not invertible in $B$ if and only if $\lambda \in X.$ This implies $\sigma_B(f)=X.$
My questions: $1.$ Is the above solution correct? $2.$ What happens if $X$ is a circle. I don't see how anything would change.
Note: This question has previously been asked here and here. However, my question is not a duplicate since it shows my attempt and I want to know if my solution is correct.