For a general finite Markov chain $(X_n)_{n\in\mathbb{N}_0}$ with state space $E$ and transition matrix $P=(p_{x,y})_{x,y\in E}$, not necessarily irreducible, we define the linear space of harmonic functions on $E$ by $$ \mathcal{H}(E)=\mathcal{H}(E,P):=\left\{h\colon E\to\mathbb{R}: h(x)=Ph(x):=\sum_{y\in E}p_{x,y}h(y)~\forall~x\in E\right\}. $$ Assume that the Markov chain has $m\in\mathbb{N}$ essential classes and denote them by $C_1,C_2,\ldots,C_m$.
Prove or disprove the following statements:
(i) If h is harmonic, then h is constant on each $C_i$.
(ii) For each function $g\colon\left\{1,2,\ldots,m\right\}\to\mathbb{R}$, there exists a unique function $h\in\mathcal{H}(E,P)$ so that $h(x)=g(i)$ for all $i\in \left\{1,2,.\ldots,m\right\}$ and $x\in C_i$.
Here is my proof of the first statement:
(i) Let $C_i$ be chosen arbitrarily. Consider $P_{|C_i}$, which is a transition matrix and irreducible. Furthermore it is $h\in\mathcal{H}(C_i,P_{|C_i})$. Show that $h$ is constant on $C_i$.
Let $M:=\max\left\{h(x): x\in C_i\right\}$ and choose $x_0\in C_i$ such that $h(x_0)=M$. Such a $x_0$ exists, because $C_i$ is finite. Since $h$ is harmonic, $h(y)\leqslant M$ for all $y\in C_i$ and $\sum_{y\in C_i}p_{x_0,y}=1$ it is $$ M=h(x_0)=\sum_{y\in C_i}p_{x_0,y}h(y)\leqslant M, $$ i.e. $h(y)=M$ for every $y\in C_i$ with $p_{x_0,y}>0$.
Now take an arbitrary $y\in C_i$. Since $P_{|C_i}$ is irreducible, there is a sequence $$ x_0,x_1,\ldots,x_n=y $$ such that $p_{x_i,x_{i+1}}>0$ for all $0\leqslant i\leqslant n-1$. Applying the recent result repeatedly, one gets $h(x_i)=M, 0\leqslant 1\leqslant n$, and therefore $h(y)=M$.
So on $C_i$ it is $h\equiv M$.
I think this should be ok?
Edit
(ii) I think I should read the task as $E=\bigcup_{i=1}^m C_i$.
Then my suggestion is the following:
Just set $$ h(x):=g(i)\text{ if }x\in C_i, $$ then this function $h$ is harmonic, since for any $x\in E$ there is exactly one $i\in\left\{1,2,\ldots,m\right\}$ with $x\in C_i$ and since $p_{x,y}=0$ for all $y\notin C_i$ it is $$ h(x)=g(i)=Ph(x)=\sum_{y\in E}p_{x,y}h(y)=\sum_{y\in C_i}p_{x,y}h(y)=g(i)\underbrace{\sum_{y\in C_i}p_{x,y}}_{=1}=g(i). $$
So it remains only to show the uniqueness.
To do consider a function $f$, being harmonic on $E$ and with the property that $$ f(x)=g(i)\text{ for all }i\in\left\{1,2,\ldots,m\right\}\text{ and }x\in C_i.~~~(*) $$ Let $x\in E$ be arbitrary. Then $x\in C_i$ for exactly one $i\in\left\{1,2,\ldots,m\right\}$ and, because of $(*)$ and because $f$ is harmonic, for any $n\geqslant 0$ it is $$ g(i)=f(x)=P^nf(x)=\sum_{y\in C_i}p_{x,y}^{(n)}f(y). $$ From this it follows that $f(y)=g(i)$ for all $y\in C_i$ with $p_{x,y}^{(n)}>0$.
Now, because $C_i$ is irreducible, for any $y\in C_i$ there indeed is a $n_y\geqslant 1$ such that $p_{x,y}^{(n_y)}>0$.
So $f(y)=g(i)=h(y)$ for all $y\in C_i$.
So on all $C_i$ the function $f$ is identical with $h$ and so on whole $E$ it is $f=h$.
Am I right with this proof?