When is a non-symmetric matrix times a diagonal matrix symmetric? Take the square matrix $X$ with all positive entries and the diagonal matrix $Y$, with the constraint that the diagonal elements of $Y$ are all positive and sum to $1$; $\sum_{i}Y_{ii} = 1$.
What conditions are required of Y such that the following is true?
$$
YX = X^{\text{T}} Y
$$
We
have a condition that $\text{Rank}(X^{\text{T}}\oslash X) = 1$ ($\oslash$ is element-wise division), but its a little unwieldy so are looking for an explicit expression on Y
 A: Conclusion: Such a $Y$ necessarily exists. The vector $(Y_1,\dots,Y_n)$ should be proportional to a row of $X^T \oslash X$, which can be scaled so that its entries have sum $1$.

Justification:
Let column vectors $u,v$ be such that $X^T \oslash X = uv^T$. Note that
$$
X^T = \operatorname{diag}(u) X \operatorname{diag}(v),
$$
where $\operatorname{diag}(u)$ denotes the diagonal matrix whose entries are the entries of $u$. Let $y$ denote the vector consisting of the diagonal entries of $y$.
We have
$$
YX = X^TY \implies\\
\operatorname{diag}(y)X = \operatorname{diag}(u) X \operatorname{diag}(v) \operatorname{diag}(y) \implies\\
X = \operatorname{diag}(u \oslash y) X \operatorname{diag} (v \odot y),
$$
where $\odot$ denotes entrywise multiplication. The above equality can be rewritten as
$$
x_{ij} = \frac{u_i v_j y_i}{y_j}  x_{ij}, \quad i,j = 1,\dots, n \implies\\
\frac{u_iv_j y_i}{y_j} = 1, \quad i,j = 1,\dots, n \implies
$$
$$
\frac{y_j}{y_i} = u_iv_j, \quad i,j = 1,\dots,n. \tag{*}
$$
By setting $i = j$ in $(*)$, we see that we must have $u_iv_i = 1$ for all $i=1,\dots,n$. Equivalently, the diagonal entries of $X^T \oslash X$ must be all equal to $1$. This must hold because $X$ and $X^T$ have the same diagonal entries.
Once an entry $y_1$ is selected, the rest of the entries are determined by applying $(*)$ for $i=1$ to get
$$
y_i = u_1 v_j y_1, \quad i = 2,\dots,n.
$$
This solution is only compatible with $(*)$ if for all $i \neq j$ from $2$ to $n$, we have
$$
\frac {y_j}{y_i} = u_i v_j \iff \frac{v_j}{v_i} = u_i v_j \iff u_i v_i = 1,
$$
which we shown is the case.
For $i = 1,\dots,n$, we must also have
$$
\frac{y_1}{y_i} = u_i v_1 \iff \frac 1{u_1 v_i} = u_i v_1 \iff u_i v_i = \frac{1}{u_1v_1}, 
$$
which holds because $u_iv_i = u_1v_1 = 1$.
