Show that a representative function on a profinite group factor through a surjection Let $G$ be a compact group. A representative function $f\in\mathcal{C}(G,\mathbb{K})$ is a function such that $\dim\left(\operatorname{span}\left(Gf\right)\right)< \infty$. 
Remark that the representative functions form a subalgebra of $\mathcal{C}(G,\mathbb{K})$.
I'm following the book "The Structure of Compact Groups" by Hofmann&Morris on this subject.
I would like to be able to show that that a representative function 
$f$ 
on a profinite group 
$G$ 
factors as 
$f=f\circ \pi$ 
where 
$\pi:G\rightarrow H$ 
is a surjection onto a finite group.
My goal would be to use this in order to find the set of the representative functions from $\mathbb{Z}_p$ to $\mathbb{K}$, denoted $R(\mathbb{Z}_p,\mathbb{K})$ for $\mathbb{K}=\mathbb{C}$ and $\mathbb{K}=\mathbb{R}$.
Yet I have no clue about how I could do this, I'm pretty new to profinite stuff and I can't "see" anything.
 A: Okay, now this is a messy attempt of an answer.
First note the fact that for $G$ a profinite group and $N$ a closed normal subgroup of $G$, $G/N$ is a totally disconnected compact group (actually it is also profinite with the quotient topology). 
Now, since $f$ is a representative function, there is a finite dimensional "matrix" representation $\rho : G \to GL(n,K)$ such that $\rho \mapsto (a_{jk}(\rho))_{jk=1,...,n}$. (Well... I'm not so sure about this step.) 
Let's set $H=\ker(\rho)$, it is a closed (preimage of $\{1\}$) normal (since it's $\ker$) subgroup of $G$, so by our above stated fact, $G/H$ is compact and totally disconnected. Note then that $f$ factors through the quotient  such that $G/H \cong \rho(G)$.
Now, since every representation of a compact group on a finite dimensional $K$-vector space may be assumed to be unitary, by Weyl's trick, (right?) we can assume $\rho$ to be unitary, so $Im(\rho) \subset U(n)$ if $K=C$ or $Im(\rho)\subset O(n)$ if $K=R$ and so $\rho(G)$ is totally disconnected and closed on a Hausdorff space, hence it is compact. (I'm not sure : is it necessary to show this?)
But both $U$ and $O$ are compact Lie groups, so $\rho(G)$ is a compact Lie group, and since it is totally disconnected it has to be finite. (A totally disconnected compact group is a compact Lie group if and only if it is finite.)
Hence $f$ factors through $G/H\cong Im(\rho)$ which is finite.
Now, to conclude with what I wanted to show : 
$\mathbb{Z}_p$ is a profinite group, we look at its non-trivial closed normal subgroups. It has the form $p^m\mathbb{Z}_p, m\in \mathbb{N}$ and we have the following isomorphism :
$$ \mathbb{Z}/p^m\mathbb{Z} \to\mathbb{Z}_p/p^m\mathbb{Z}_p $$ such that
 $$ \sum_{i < n} a_ip^i \!\!\!\!\!\!\!\mod(p^n) \mapsto \sum_{i<n} a_ip^i \!\!\!\!\!\!\!\mod(p^n\mathbb{Z}_p) $$ And by the previous proof, we know that any  $f\in R(\mathbb{Z}_p,K)$ factorizes as $\tilde{f}\circ\pi$ for a $\pi : \mathbb{Z}_p\to  \mathbb{Z}/p^m\mathbb{Z} $ and $f: \mathbb{Z}/p^m\mathbb{Z} \to K$ continuous, so $$ R(\mathbb{Z}_p,K) = \{\tilde{f}\circ \pi_m \mid\ \pi_m:\mathbb{Z}_p\to  \mathbb{Z}/p^m\mathbb{Z}, m\in \mathbb{N}, f\in C(\mathbb{Z}/p^m\mathbb{Z},K)\}$$ 
