Given an $N$-level quantum system with computational basis $\{|1\rangle ,|2\rangle , \cdots, |N\rangle \}$, if we perform an unitary operation $U$ on a computational basis state $\{|j\rangle \}$ and then measure the resulting system in computation basis, the probability to get a result $i$ is given by
$$\text{Tr} ( |i\rangle\langle i| U |j\rangle\langle j| U^{\dagger} ) = |U_{ij}|^2 $$
Therefore, if a computational step of a probabilistic classical algorithm has a transition matrix $(p_{ij}) $ where $p_{ij}$ is the probability for the $j^{th}$ state evolves into the $i^{th}$ state and there exists an unitary matrix $U$ such that
$$ p_{ij} = |U_{ij} |^2 , $$
for all $i,j \in \{1,2,\cdots,N\} $, this computational step can be easily simulated in quantum computers by unitary operation $U$ and measurement in computational basis.
However, not every transition matrix, i.e, column stochastic matrix, admits an unitary matrix of above property, as the counterexample $$\begin{pmatrix} 0 & 1/2 & 1/2 \\ 1/2 & 0 & 1/2 \\ 1/2 & 1/2 & 0 \end{pmatrix}.$$ suggested in https://mathoverflow.net/q/80259/ shows
It is claimed in my textbook that if we exploit an N level ancila system with initialized state, say, $|1\rangle$, conduct an unitary operation, perform a measurement and discard the ancilla system, we can simulate any computational step in probabilistic classical algorithm. That is, for any column stochastic matrix $(p_{ij})$, we can find an unitary operator $U$ on $\mathbb{C}^n \otimes \mathbb{C}^n $ such that $$p_{ij} = \text{Tr} ( ( |j1\rangle\langle j1| +|j2\rangle\langle j2| + \cdots + |jN \rangle\langle jN| ) U |i 1\rangle\langle i1 | U^{\dagger} ) $$ $$ = |\langle j1 | U | i1 \rangle |^2 + | \langle j2 | U | i1 \rangle |^2 + \cdots + |\langle jN | U | i1 \rangle|^2 $$
This seems a tricky, fairly nontrivial result. How can we construct such unitary $U$ from a transition matrix of above property?