Given real vectors $v$ and $r$ of the same size, what are the following? 


1. $\inf\{v'R^{-1}v ~ \colon ~ R>0 \, , \, \text{diag}(R)= r\}$
2. $\sup\{v'Rv ~ \colon ~ R>0\, , \, \text{diag}(R)= r\}$


Note: $R > 0$ denotes positive definiteness, $x'$ denotes transpose, $\text{diag}(R)$ is the vector of the diagonal entries of matrix $R$.



Extremal Covariance Duality
First, let us answer question 2. Write $R=Q'Q$, where $Q=[q\_1,\dots,q\_n]$, a square matrix with columns $q\_1,\dots,q\_n$. Let $v\_i$ and $r\_i$ denote the coordinates of the vectors $v$ and $r$. Then the problem can be rewritten as follows: maximize $\|Qv\|=\|\sum\_i v\_iq\_i\|$ given $\|q\_i\|^2=r\_i$ for all $i$. Clearly, $\|Qv\|\le\sum\_i |v\_i|\,\|q\_i\|=\sum\_i|v\_i|\,\sqrt{r\_i}$. On the other hand,
$\|Qv\|=\sum\_i\|v\_i\|\,\sqrt{r\_i}$ and $\|q\_i\|^2=r\_i$ for all $i$ if $q\_i=(\text{sgn}\,v\_i)\sqrt{r\_i}u$ for all $i$, where $u$ is any unit vector, and $\text{sgn}\,v$ is defined as $1$ if $v\ge0$ and as $-1$ if $v<0$. So,
\begin{align}
 \sup\{v'Rv\colon R>0, \text{diag}(R)= r\} 
 &=\sup\{\|Qv\|\colon Q=[q\_1,\dots,q\_n], \|q\_i\|^2=r\_i\ \forall i\}^2 \\ 
 &=\Big(\sum\_i|v\_i|\,\sqrt{r\_i}\Big)^2. 
\end{align}


Now let us answer question 1. Again, write $R=Q'Q$, where $Q=[q\_1,\dots,q\_n]$. Then $v'R^{-1}v=a'a=\|a\|^2$, where $a:=(Q')^{-1}v$, so that $Q'a=v$ or, equivalently, $a\cdot q\_i=v\_i$ for all $i$, where $\cdot$ denotes the dot product. Then the problem can be rewritten as follows: minimize $\|a\|^2$ given that $a\cdot q\_i=v\_i$ and $\|q\_i\|^2=r\_i$ for all $i$. Introducing vectors $u\_i:=q\_i/\sqrt{r\_i}$, let us further rewrite the problem as this: 
$$\text{minimize $\|a\|^2$ given the conditions $a\cdot u\_i=s\_i$ and $\|u\_i\|=1$ for all $i$, }$$
where $s\_i:=v\_i/\sqrt{r\_i}$. 
Under these conditions, for each $i$ we have $\|a\|^2\ge(a\cdot u\_i)^2=s\_i^2$ and hence $\|a\|^2\ge\max\_i s\_i^2=:s^2$. Without loss of generality, $s^2=s\_1^2$, so that $s\_i^2\le s\_1^2=s^2$ for all $i$. 
On the other hand, take any unit vector $u\_1$ and let $a=s\_1u\_1$, so that condition $a\cdot u\_1=s\_1$ holds. Clearly, $\{a\cdot u\colon\|u\|=1\}=\{s\_1u\_1\cdot u\colon\|u\|=1\}=[-|s\_1|,|s\_1|]$. Since $s\_i\in[-|s\_1|,|s\_1|]$ for all $i$, it follows that for each $i=2,\dots,n$ there is a unit vector $u\_i$ such that condition $a\cdot u\_i=s\_i$ holds. Also, then we have $\|a\|^2=s\_1^2\|u\_1\|^2=s\_1^2=s^2$. Thus, 
\begin{align}
 &\inf\{v'R^{-1}v\colon R>0, \text{diag}(R)= r\} \\ 
 &=\inf\{\|a\|^2\colon \text{ $a\cdot u\_i=s\_i$ and $\|u\_i\|=1$ for all $i$}\} \\ 
 &=s^2=\max\_i s\_i^2=\max\_i (v\_i^2/r\_i). 
\end{align}


