A useful way to analyze large products in cases like this is to take logarithms, which
causes them to become sums. Thus, let us build a graph G with a node for each stock, and
a dire(-ted edge (i,j) for each pair of stocks. We put a Cost of - log rij on edge (i,j).
New, a trading cycle C in G is an opportunity cycle if and only if
H nj > 1,
in other words, taking logarithms of both sides, if and only if
Z log Tw > 0,
or
E -logra, < 0.
Thus, a trading cycle C7 in G is an opportunity cycle if and only if it is a negative cycle.
Hence we can use our polynomial-time algorithm for negative-cycle detection to determine
whether an opportunity Cycle exists.