Problem: Let $T$ be a positive definite selfadjoint operator in an $n$-dimensional inner product space $H$. Find the maximum possible angle between a vector $v\neq 0$ and its image $Tv$, expressed in terms of the eigenvalues $\theta_0^2\geq\dots\geq\theta_{n-1}^2>0$ of $T$.

Solution:
We want to minimize $\cos(v,Tv)=\frac{\langle v,Tv \rangle}{\|v\|\|Tv\|}$, or equivalently, its square $\frac{\langle v,Tv\rangle^2}{\langle v,v\rangle\langle Tv,Tv\rangle}$.

Since the angle between any vector $v\neq 0$ and its image $Tv$ doesn't change if we rescale $v$, we can rescale at our wish. I choose to restrict to those $v$ such that the numerator $g(v)=\langle v,Tv\rangle$ equals 1, so now the problem is equivalent to minimizing the denominator $f(v)=\langle v,v\rangle\langle Tv,Tv\rangle$, and now there are no divisions bothering.

Critical points of this restricted function are given by the equation $df(v)=\lambda dg(v)$, where $\lambda\in\mathbb R$ is a Lagrange multiplier. We calculate

$dg(v)=\langle v,T-\rangle+\langle -,Tv\rangle=2\langle Tv,-\rangle$ and

$df(v)=2\langle v,-\rangle\langle Tv,v\rangle+2\langle v,v\rangle\langle Tv,T-\rangle=2\|Tv\|^2\langle v,-\rangle+2\|v\|^2\langle T^2v,-\rangle$.

The critical point equation can now be rewritten:

$\langle \|Tv\|^2v+\|v\|^2T^2v-\lambda Tv,-\rangle=0$

and this is true iff $\|Tv\|^2v+\|v\|^2T^2v-\lambda Tv=0$. So $v$, $Tv$, and $T^2v$ are linearly dependent when $v$ is a critical point. But we know by Vandermonde [...] that they would be independent if $v$ had nonzero projections in three eigenspaces.

So the critical points are found in the planes spanned by two eigenvectors, and then we must solve our problem for $n=2$, being only interesting the case in which the two eigenvalues are different, because otherwise $v$ will also be an eigenvector and then the angle will be zero.

Calculations seem to get a little nicer if we express $T=S^2$, by letting $S$ be the only positive selfadjoint square root of $T$, with eigenvalues $\theta_0\geq\dots\theta_{n-1}>0$. We then have $g(v)=\langle Sv,Sv\rangle=\|Sv\|^2$, and $f(v)=\|v\|^2\|S^2v\|^2$.

Also, the symmetry is greater if we work in terms of the variable $w=Sv$, so that $g=\|w\|^2$ and $f=\|S^{-1}w\|^2\|Sw\|^2$ (this is not very important). If we express $w=x v_i+ y v_j$, where $v_i$ and $v_j$ are eigenvectors of $S$ with eigenvalues $\theta_i$ and $\theta_j$ and $i>j$, the Lagrange multipliers equation can be solved after some calculations [...], finding four critical points $(x,y)=(\pm \sqrt{\frac 12},\pm \sqrt{\frac 12})$. The minimum cosine for $w$ in the plane spanned by $v_i$ and $v_j$ is then $\frac{\langle w,w\rangle}{\|S^-1w\|\|Sw\|}=\dots=\frac{\theta_i\theta_j}{2(\theta_i^2\theta_j^2)}=\frac 12 (\frac{\theta_i}{\theta_j}+\frac{\theta_j}{\theta_i})$.

Once the case $n=2$ is solved, we want to select the plane so that $(\frac{\theta_i}{\theta_j}+\frac{\theta_j}{\theta_i})$ is maximum. But the function $h(t)=t+t^{-1}$ increases in the interval $[1,+\infty)$, so the value $t=\frac{\theta_i}{\theta_j}$ should be chosen as large as possible by maximizing $\theta_i$ and minimizing $\theta_j$.

The dots "..." represent explanations that I'm omitting. Request further details as needed.

ADDED by request of the OP: The "Vandermonde principle" says that an $n\times n$ Vandermonde matrix with different rows is invertible. This implies that if a vector $v$ has nonzero components in the eigenspaces corresponding to three different eigenvalues $\lambda_0$, $\lambda_1$, $\lambda_2$, then $v$, $Tv$ and $T^2v$ are independent.

Proof: Write $v=v_0+v_1+v_2$ so that for each $0\leq i<3$ we have $v_i$ a nonzero eigenvector corresponding to eigenvalue $\lambda_i$. Then we also have

$Tv=\lambda_0v_0+\lambda_1v_1+\lambda_2v_2$ and

$T^2v=\lambda_0^2+\lambda_1^2v_2+\lambda_2^2v_2$.

Our vectors $v$, $Tv$ and $T^2v$ belong to the subspace $S$ with basis $B=(v_0,v_1,v_2)$. And the coordinates of $v$, $Tv$ and $T^2v$ in basis $B$ are

$[v]_B=\left(\begin{array}{c}1\\1\\1\end{array}\right)$

$[Tv]_B=\left(\begin{array}{c}\lambda_0\\ \lambda_1\\ \lambda_2\end{array}\right)$

$[T^2v]_B=\left(\begin{array}{c}\lambda_0^2\\ \lambda_1^2\\ \lambda_2^2\end{array}\right)$

These are the columns of a Vandermonde matrix, so they are linearly independent, and so must be the vectors $v$, $Tv$, $T^2v$.