Let $P$ be a stochastic matrix on a finite set $I$. Show that a distribution $\pi$ is invariant for $P$ if and only if $\pi(I-P+A)=a$, where $A=(a_{ij}:i,j\in I)$ with $a_{ij}=1$ for all $i$ and $j$, and $a=(a_i:i\in I)$ with $a_i=1$ for all $i$. Deduce that if $P$ is irreducible then $I-P+A$ is invertible.
My efforts:
$\pi(I-P+A)=a\iff\pi-\pi P+\pi A=a\iff\pi=\pi P$.
I have no idea about the invertible part.
Theorem Every irreducible Markov chain with a finite state space is positive recurrent and thus has a stationary distribution (unique probability solution to $\pi=\pi P$).
Let $Q=I-P+A$. Then $Q^Tx=a^T$ has a unique solution $\pi^T$. So $Q^T$ is invertible.