How do you find the dimension of the symplectic group $\operatorname{Sp}(2n,\mathbb{R})$?
$\operatorname{Sp}(2n,\mathbb{R})\subset \operatorname{Gl}(2n,\mathbb{R})$ is the group of invertible matrices $A$ such that $\omega = A^T\omega A$, where $$\omega = \bigg(\array{0 & \mathit{Id}_n\\ -\mathit{Id}_n & 0}\bigg)$$
I have tried to find the dimension of this group by dividing a matrix $A$ in four blocks, $$A = \bigg(\array{X & Y\\ Z & W}\bigg)$$ and use the defining property to put conditions on the blocks. I find the equations $X^TZ = Z^TX$, $Y^TW = W^TY$ and $Y^TZ - W^TX = \mathit{Id}_n$. The first two are obviously independent, and I think they put $2n^2$ restrictions on the group, but how should I go about the third one?