# Constructing $g$-othogonal and symplectic basis of the vector space given a Lagrangian subspace.

Assume that for a vector space $$V$$ we are given a fixed symplectic form $$\omega$$ and a fixed inner product $$g$$. Given Lagrangian subspace $$\Lambda$$ such that $$g$$-orthogonal complement $$\Lambda^\perp$$ is also Lagrangian, construct a $$g$$-orthogonal and $$\omega$$-standard basis.

My construction: pick any orthogonal basis $$(e_1,\dots , e_n)$$ of $$\Lambda$$, and denote $$\Lambda_i$$ a subspace of $$\Lambda$$ spanned by $$(e_1,\dots, e_{i-1},e_{i+1},\dots,e_n)$$ (ie. span of all basis vectors except $$e_i$$). Then intersection of symplectic complement $$\Lambda_i^{\omega}$$ and $$\Lambda^{\perp}$$ is a one dimensional subspace, because $$\Lambda_i^{\omega}$$ is $$n+1$$ dim and contains $$\Lambda$$. Then by non-degeneracy there exists a vector $$f_i\in \Lambda_i^{\omega}\cap \Lambda^{\perp}$$ such that $$\omega(e_i,f_i)=1$$.

Note that $$\omega(e_i,f_j)=0$$ if $$i \neq j$$ and $$\omega(f_i,f_j)=0$$, hence $$(e_1,\dots,e_n,f_1,\dots,f_n)$$ gives a symplectic basis. Since $$f_i \in \Lambda^{\perp}$$ we have that $$g(e_i,f_j)=0$$, however I don't see how to prove that $$g(f_i,f_j)=0$$ for $$i\neq j$$. It seems to me that the choice of $$f_i$$ in this process is canonical so I don't see how I could change it to ensure orthogonality between $$f_i$$'s

Regarding your method: Notice that you constructed the basis $$\{f_1, \dots, f_n\}$$ of $$\Lambda^{\perp}$$ without ever using $$g|_{\Lambda^{\perp}}$$, hence you can freely change $$g$$ on $$\Lambda^{\perp}$$ to produce examples for which $$\{f_1, \dots, f_n\}$$ is not $$g$$-orthogonal. One could be tempted to apply a Gram-Schmidt process to $$\{f_1, \dots, f_n\}$$ to obtain a $$g$$-orthogonal basis, but this wouldn't give an overall $$\omega$$-symplectic basis.
Note that the process you described is not completely canonical, since you begin with an arbitrarily chosen $$g$$-orthogonal basis $$\{e_1, \dots, e_n\}$$ for $$\Lambda$$. The conclusion is thus that you should construct the bases $$\{e_1, \dots, e_n\}$$ and $$\{f_1, \dots, f_n\}$$ 'simultaneously'.
Start with $$g$$-orthonormal bases $$E' = \{e'_1, \dots, e'_n\}$$ of $$\Lambda$$ and $$F' = \{f'_1, \dots, f'_n\}$$ of $$\Lambda^{\perp}$$, thereby obtaining a $$g$$-orthonormal basis for $$V$$. With respect to this last basis, $$\omega$$ reads as the block matrix $$\left( \begin{array}{cc} 0 & M \\ -M^{T} & 0 \end{array} \right)$$ where $$M$$ is an invertible $$(n \times n)$$-matrix. (In fact, $$\omega$$ takes this form regardless of whether $$E'$$ and $$F'$$ are orthonormal or orthogonal, and any invertible matrix $$M$$ can appear here.) The goal is to change $$E'$$ and $$F'$$ within $$\Lambda$$ and $$\Lambda^{\perp}$$ respectively to obtain a merely $$g$$-orthogonal basis for $$V$$ with respect to which $$M$$ becomes $$Id$$. Now, we only have the liberty to transform $$E'$$ into a $$g$$-orthogonal basis $$E$$ for $$\Lambda$$, which is possible by acting via an automorphism $$P_{\Lambda} : \Lambda \to \Lambda$$ which is read (with respect to $$E'$$) as the matrix $$O_{\Lambda} D_{\Lambda}$$ where $$O_{\Lambda}$$ is orthogonal and $$D_{\Lambda}$$ is invertible diagonal. Similarly, we are allowed to change $$F'$$ into a $$g$$-orthonormal basis $$F$$ of $$\Lambda^{\perp}$$ via a map $$P_{\Lambda^{\perp}} = O_{\Lambda^{\perp}}D_{\Lambda^{\perp}}$$. Under this process, $$M$$ is changed into $$P_{\Lambda}^T M P_{\Lambda^{\perp}}$$, which we want to equal $$Id$$. This means we need to find $$O_{\Lambda}$$, $$D_{\Lambda}$$, $$O_{\Lambda^{\perp}}$$ and $$D_{\Lambda^{\perp}}$$ such that $$M = O_{\Lambda} D_{\Lambda}D_{\Lambda^{\perp}}^T O_{\Lambda^{\perp}}^T$$. The fact that $$M$$ can be expressed in this form follows from polar decomposition and spectral theorem.