Given $X=0 \cup \{1/n\}$. We can show that it is a compact Hausdorff space. Now take $M_n$ to be the matrix algebra. I am confusing on showing that both $C(X, M_2)$ and $B=\{f \in C(X, M_2)$ where $f(0)$ is diagonal$\}$ are $C^*$-algebras and finding the two-sided closed ideals with respect to each other.
I am trying to define the norm $||f||:=sup||f(x)||$ for all $x\in X$ in which the right-hand side norm is just the operator norm defined for matrix algebra, for $f(x)$ is some matrices in $M_2$. So when calculating the operator norm, does it just mean to find the largest eigenvalue? Also take the $f^*(x)=\bar{f(x)}$, could anybody tell me how to move on for showing these two spaces are $C^*$-algebra? I understand we need to check the conditions for *-algebra, but what is the difference between these two examples?
I'll be assuming that your set is $X=\{0\}\cup\{1/n: n\in \mathbb N\}$ (or did you really wanted $X$ with two points?)
The operator norm of a matrix is the largest eigenvalue only if the matrix is positive (or some special selfadjoint cases). In general, the operator norm of a matrix is the largest singular value.
Completeness: if $\{f_k\}$ is a Cauchy sequence, it follows that $\{f_k(x)\}$ is Cauchy in $M_2$ for each $x$. So convergent (because $M_2$ is complete) and there exists $f(x)=\lim f_k(x)$. A typical $\varepsilon$ argument shows that $f$ is continuous. For $B$ the argument is the same, and if $f_k(0)$ is diagonal for all $k$, then $f(0)$ is diagonal.
As $B\subset C(X,M_2)$ and closed, all you need to do is show that it is a $*$-algebra.
The norm you defined is a norm, just using that the operator norm is a norm. Indeed, you have $$ \|f+g\|=\sup\{\|f(x)+g(x)\|:\ x\in X\}. $$ As $\|f(x)+g(x)\|\leq \|f(x)\|+\|g(x)\|\leq\|f\|+\|g\|$, the triangle inequality is proven. If $\|f\|=0$, then $f=0$ by definition of function. And $\|\lambda f\|=|\lambda|\,\|f\|$ again follows from the fact that the operator norm is a norm.
The C$^*$-identity: I assume that the adjoint you want is $f^*(x)=f(x)^*$. Then $$ \|f^*f\|=\sup\{\|f^*(x)f(x)\|:\ x\in X\}=\sup\{\|f(x)\|^2:\ x\in X\}=\|f\|^2. $$ As for the ideals, since $M_2$ is simple, it is not hard to show in general that the (closed) ideals of $C(X,M_2)$ are of the form $$\tag{*}I_Y=\{f\in C(X,M_2):\ f|_Y=0\},$$ where $Y\subset X$ is closed. The closed subsets of $X$ are those that
are finite; or,
are infinite and contain $0$
So any such $Y$ gives rise to an ideal of $C(X,M_2)$ via $(*)$.
As for ideals of $B$, note that if $J\subset B$ is an ideal, then for each $x\in X$, $$J_x=\{f(x):\ f\in J\}$$ is an ideal of $M_2$. As the latter is simple, either $J_x=0$ or $J_x=M_2$. And $J_0$ is an ideal of $M_2$ that consists of diagonal matrices, so $J_0=0$. If $Y=\{x:\ J_x=0\}$, then $Y$ is closed (using the continuity of the functions), $0\in Y$, and $$\tag{**} J=\{f\in B:\ f|_Y=0\}. $$ Indeed, the argument above showed that the inclusion $\subset$ holds. For the reverse inclusion, see the argument here.