Three-term recurrence for $A$-orthogonal vectors obtained by Gram-Schmidt procedure. I would be glad for any help on how to approach the following problem.
Let $A$ be a positive definite $n\times n$ real matrix, $p_0 \in \mathbb{R^n}$.
Put $p_i = A^ip_0$.
Let $d_i$ be $A$-orthogonal vectors obtained by Gram-Schmidt procedure from $p_i.$
Show that $d_i$ can be obtained using three-term recurrence, that is $d_{i+1}$ can be obtained from $Ad_i, d_i$ and $d_{i-1}.$
 A: If the matrix is positive definite then it's symmetric. So we know that $A^{T} = A$. For a general matrix the process is called the Arnoldi iteration. Given a set of vectors $\{ p_{1}, p_{2}, \cdots p_{k}\}$  then we know the Gram-Schmidt procedure computes an orthonormal basis $\{ d_{1}, d_{2}, \cdots , d_{k} $} so that for all $ j \leq k$ we know
$$ \text{Span}( p_{1},p_{2}, \cdots p_{k}) = \text{Span}(d_{1}, d_{2}, \cdots d_{k}) $$
If you try to compute the set $\{p , Ap , A^{2}p ,\cdots  \}$ you'll note that it will be close to linearly dependent so it won't be numerically stable. Since the span of $\{d_1, d_2, \cdots d_{k-1}\}$ is equal to the span of $\{ p, Ap , \cdots , A^{k-2}p \}$ then $d_{k-1}$ can be written as a linear combination of $\{ p, Ap , \cdots , A^{k-2}p \}$. That is there exists coefficients $c_i$ such that (Note I'm going to use the indexing you have so $p_0$ is there instead.
$$ d_{k-1}  = c_1 p_0 + c_2Ap_0 + \cdots + c_k A^{k-2} p_0$$
Then if we multiply by $A$ we have
$$ Ad_{k-1}  = c_1 A p_0 + c_2 A^{2}p_0 + \cdots + c_k A^{k-1} p_0$$
Now since each of $\{ p_0 ,Ap_0, \cdots ,A^{k-2} p_0 \} $ are in the span of $\{d_1, d_2, \cdots d_{k-1} \}$ they will disappear when we orthogonalize $Ad_{k-1}$ against them. We get an kth term recurrence relation from this
$$ AD_{k} =  D_k H_k  + h_{k+1, k} d_k \xi_k^{T} $$
Where $D_k = [d_1, d_2, \cdots , d_k]$ is the $ n \times k$ matrix with columns $\{ d_1, d_2, \cdots d_k \}$ and $H_k$ is a $k \times k$ Upper Hessenberg matrix and $\xi_{k}^{T} = [0, \cdots , 0, 1]^{T}$ is the k-th unit vector.
When $A$ is symmetric then $D_k^{T}AD_k  = H_k$ is also symmetric (instead of Upper Hessenberg). An upper Hessenberg matrix a upper Triangular matrix but with non-zero entries on the sub-diagonal. In this case if it's symmetric then it's tridiagonal. This gives us the 3-term recurrence relation. Then the $d_j$ orthogonal vector satisfies
$$ Ad_j = \beta_{j-1}d_{j-1}  + \alpha_{j}d_{j} + \beta_{j}d_{j+1} $$
this gives the matrix equation
$$ AD_k = D_k T_k + \beta d_{k+1}\xi_{k}^{T} $$
Where $T$ is the tridiagonal matrix formed from these coefficients at the kth step
$$ T = \begin{bmatrix} 
\alpha_1 & \beta_2 &  &  &  & 0\\ 
\beta_2 & \alpha_2 & \beta_3  &  &  \\ 
 & \beta_3 & \alpha_3  &  \ddots & \\ 
  &  & \ddots & \ddots  &  \beta_{m-1} &  \\ 
 &  &  & \beta_{m-1}  &  \alpha_{m-1}  &  \beta_{m}   \\ 
 0 &  &  &   &  \beta_{m}  &  \alpha_{m}   \\  \end{bmatrix}  $$
