I am terrible at writing proofs so I was wondering if someone could help me check if I am right or heading in the right direction.
Problem
Consider an irreducible Markov chain with finitely many states. Prove that if $g: S \rightarrow \mathbb{R}$ is a function such that $$ g(i) p_{i j}=g(j) p_{j i}, \quad \forall i, j \in S $$ then $g=c \pi$ where $c$ is a constant and $\pi$ is a stationary distribution.
My attempt
Reffering to the notes of by Takis Konstantopoulos, p.59:
The detailed balance equations of an markov chain is equivalent to forming ratio a ratio of $\frac{p_{i j}}{p_{j i}}=\frac{g(j)}{g(i)}$ Therefore, multiplying by $g(i)$ and summing over $j$ we find $$ g(i)=\sum_{j \in S} g(j) p_{j i} $$
Hence, the function $g$ satisfies the balance equation and shows that the chain is reversible. This implies that:
$$ g(i) p_{i j}=\pi(j) p_{j i} $$
$$ g(i)=\pi(j) \frac{p_{j i}}{p_{i j}} => g = \pi * c $$ where $c = \frac{p_{j i}}{p_{i j}} $