Lets $p$ be a distribution on a finite sample space with $n$ points. I wish to find a transition matrix that is invariant with respect to $p$, that is $$p^T T = p^T$$.
The problem is clearly underspecified since the number of variables ($n^2$) will always be greater (except when $n=2$) than the number of constraints ($2n$).
I was wondering if there any way to characterize the subset of solutions that have $p$ as the stationary distribution as well (and not just invariant with respect to $p$).
A Markov chain with a finite state space has a unique stationary distribution if and only if it has exactly one closed communicating class; see e.g. these notes and Wikipedia.