Given $n\times n$ diagonal matrix $A=[a_i]$. Denote column vector of ones by $\textbf{1}$.
Calculate $\textbf{1}^\mathsf{T}ARA\textbf{1}$, if $R$ has row and column sums $1$.
My attempt: Denote elements of $R$ by $r_{ij}$, then \begin{align} \textbf{1}^\mathsf{T}ARA\textbf{1}&=\sum_{i=1}^na_i^2r_{ii}+2\sum_{1\leq i,j\leq n\\i\neq j}a_ia_jr_{ij} \\ &\\ \end{align}
I am having difficulty to use the fact that $R$ has column and row sums equal to $1$, so that the expression can be further simplified. $R$ here is a relative gain array matrix, so it has additional nice math properties.