As Sergei Ivanov pointed out in his first comment, it is necessary and sufficient, to solve your (ii) and (iii), to have $$ \sum_{i = 1}^{n} x_i = \sum_{i=1}^{n} y_i \; \; .$$ If this is true then take $ M = \sum_{i = 1}^{n} x_i = \sum_{i=1}^{n} y_i \; \; . $ The most natural solution to (ii) and (iii) is the rank-one matrix $C^0$ given by $$ c_{ij}^{0} = \frac{x_i y_j}{M} $$ Now, there is a kernel involved next of dimension $(n-1)^2,$ these being matrices $F$ satisfying $F 1 = 0$ and $F^t 1 = 0.$ One may specify any entries desired in the upper left square $n-1$ by $n-1$ block of $F$, then fill in the final column and row. Any solution of (ii) and (iii) must be of the form $$ C^0 + F \; \; .$$ Progress: for your purpose it is better to specify the matrix $F$ as shown below for $n=4,$ the other entries of $F$ are forced by the condition that all row sums and all column sums are zero. $$ F = \left( \begin{array}{cccc} & r & s & t \\\ & & u & v \\\ a & & & w \\\ b & c & & \end{array} \right). $$ As a result, $C^0 + F$ can be arranged to have all zeroes above the diagonal, then zeroes below a single layer alongside the main diagonal. The result is slightly better than what is called tridiagonal in that the entries above the diagonal are also 0. http://en.wikipedia.org/wiki/Tridiagonal_matrix Finally, having arranged $$ C^0 + F = \left( \begin{array}{cccc} a & 0 & 0 & 0 \\\ r & b & 0 & 0 \\\ 0 & s & c & 0 \\\ 0 & 0 & t & d \end{array} \right) $$ if in addition $x = y$ then it follows from (ii) and (iii) that $C^0 + F$ is actually diagonal. Done.