# Symplectic block-diagonalization of a real symmetric Hamiltonian matrix

Given a $2n\times 2n$ real, symmetric, Hamiltonian matrix $W$ (anticommutes with the symplectic metric), is there an orthogonal, symplectic matrix $R$ such that $R^\top WR$ is block-diagonal?

Being symmetric, for sure one can diagonalize $W$ by an orthogonal matrix. However, we only want block-diagonalization. This relaxation may let me make $R$ symplectic. I am looking for an explicit construction of $R$ in terms of i.e., SVD's of $W$'s blocks.

Let $J$ be the symplectic form $$J= \left(\begin{array}{cc} 0&1\\\ -1&0 \end{array}\right).$$

Given that $W$ is symmetric ($W^\top=W$) and Hamiltonian ($WJ=-JW$), it has block form $$W=\left(\begin{array}{cc} x&y\\\ y&-x \end{array}\right)$$ with $x=x^\top$ and $y=y^\top$. $R$ can be parametrized as $$R=\left(\begin{array}{cc} c&s\\\ -s&c \end{array}\right)$$ both the symplectic and orthogonal conditions boil down to $cc^\top+ss^\top=I$ and $cs^\top-sc^\top=0$.

I am looking for $c$ and $s$ such that $$R^\top W R=D$$ where $$D=\left(\begin{array}{cc}d&0\\\ 0&-d \end{array}\right).$$

Hint: Writing $WR=RD$ yields equations \begin{align} xc-ys&=cd\\\ xs+yc&=-sd \end{align} Defining $t=sc^{-1}$ and equating the $d$'s in previous equations one can write (assuming $c$ is nonsingular!) $$t y t-tx-xt-y=0.$$ This is a particular form of the Riccati equation. It admits a "simple" solution if $y\geq0$ and $y+xy^{-1}x\geq0$ and from here one may be able to find a solution. Unfortunately I cannot assume these.

Note: Numerical tests suggest that this is always possible. Namely, for any $W$ that I generate, it seems that given the orthogonal diagonalization $W=O^\top D O$ there is always a permutation matrix $P$ such that $OP$ is symplectic. Furthermore, the resulting diagonalization is always strictly diagonal, not only block-diagonal.

Yes, you can always do this. The right way to understand this is to look at the complex symmetric matrix $X = x + i y$. You want to act on this by a complex matrix $C = c + is$ where $C$ is unitary, by the rule, $X\mapsto C^{T}XC$, and you want to know whether you can arrange that $C^{T}XC$ is a real, diagonal matrix.
You can do this, in two stages: First, look at the Hermitian symmetric matrix $H = {\bar X} X = {\bar H}^T$. When you act by $C$, the matrix $H$ will transform as $H\mapsto {\bar C}^{T}HC$. Thus, one can choose $C$ to that $H$ is diagonal and hence real. In particular, one is reduced to the case in which $X=x+iy$ satisfies $xy-yx=0$. Thus, $x$ and $y$ are commuting symmetric matrices and hence they can be simultaneously diagonalized by a real orthogonal matrix. Thus, you can now assume that $x$ and $y$ are diagonal.
Second, let $C$ be diagonal and unitary and let it act on a diagonal $X$ by $X\mapsto C^{T}XC$. Since the diagonal elements of $C$ are unit complex numbers, we can clearly choose them so that the entries of $C^{T}XC$ are real and nonnegative, which is what you wanted.