Let $D$ be a $n \times n$ ** diagonal** matrix with both positive and negative (but all non-zero) entries. Let $J = sign(D)$ be the matrix of $1$s and $-1$s representing the signs of the entries of $D$. Suppose there are two

**subspaces of $\mathbb{R}^n$, with bases given by the columns of matrices $X$ and $Y$ respectively, that together span $\mathbb{R}^n$. In other words $X^T Y = 0$, and $\begin{bmatrix} X & Y \end{bmatrix}$ is an $n \times n$ full rank matrix (the number of columns of $X$ and $Y$ don't have to be equal).**

*orthogonal*If we are given that $D$ is positive definite on $X$ and negative definite on $Y$, can we say anything about the definiteness of the sign matrix $J$ on $X$ and $Y$? More concretely, is the following statement true?

$X^T D X \succ 0$ and $Y^T D Y \prec 0 \implies$ $X^T J X \succ 0$ and $Y^T J Y \prec 0$.

I can prove that this is true for $n = 2$ (i.e. when $X$ and $Y$ are both $2 \times 1$). But I have no idea how to prove that this is true in general, or even an intuition for why it should be. But I've performed enough simulations to convince myself that it is true. Note that both conditions on $X$ and $Y$ (orthogonality and spanning of $\mathbb{R}^n$) are needed for this result to hold.

Any help here would be highly appreciated!