Let $g_1, g_2 \in M_n(\mathbb{C})$ be two matrices in companion form and full rank ($c_0 \neq 0$). Consider for $X \in M_n(\mathbb{C})$ the matrix equation $g^t X \overline{g} = X$ for $g=g_1,g_2$. One notes, that according to this any solution $X$ of such an equation is of the form $X=(X_{ij})$ where the entries depend only on $i-j$. I now want to calculate the dimension of the space, which contains the solutions for this equation.
The Dimension of the space is equal to number of basis vectors. Lets consider for example the matrix space $M_n(\mathbb{C})$, one usually takes $E_{ij}$ as a basis. In general, an $n \times n$ matrix has two times $n(n−1)/2$ off-diagonal coefficients and $n$ diagonal coefficients. So the dimesnion in said example would be $ 2n(n−1)/2 + n = n^2$.
Regarding my question, i tried finding the dimension in a similar way, but i don´t really know how to get there, since this is a space of those "special" matrices which depend only on $i-j$. My guess is, since $X$ has $n$ columns for $j$ and $n$ rows for $i$ as well as one entry for $i=j$, the dimension is $2n-1$.
Edit:
Further examining the linked question, or to be more specific its answer, one sees that the entries of $X$ are in fact given by $$X_{ij} = X_{(i+1)(j+1)}.$$ So in particular, if you have the entry $X_{11}$ you also get the entire diagonal, similar if you have $X_{(i+1)j}$ or $X_{i(j+1)}$ resp. you get the cooresponding lower resp. upper diagonals. There are $n-1$ upper, lower diagonals each. So we get $$d + u + l = 1 + (n-1) + (n-1) = 2n-1$$ entries to consider. So the basis would be $\{E_{11}, \{E_{i1}\}_{i=2}^n, \{E_{1j}\}_{j=2}^n\}$ and the dimension is $2n-1$. So does this solve my question?
For almost all $g_1$ and $g_2$ the answer will always be the same, that is, the only $X$ satisfying the hypotheses is the zero matrix. In fact, if you write down the conditions, you will find that the $2n-1$ coefficient of the Toeplitz matrix $X$ are bound by $2n-1$ independent linear conditions.
For example, suppose that $n=2$ and $$ g = \begin{pmatrix}0&a\\1&b\end{pmatrix}\qquad X = \begin{pmatrix}x&z\\y&x\end{pmatrix}. $$ From $g^TX\overline g=X$ one can find the conditions $$ \begin{cases}bx-y+az = 0\\\overline b x + \overline a y -z =0 \\ (|a|^2+|b|^2-1)x + b\overline a y + a\overline bz = 0\end{cases} $$ that has a nonzero solution in $x,y,z$ only when the determinant of the linear system is zero, but the determinant is $$|b|^2(|a|^2+1) - (|a|^2-1)^2 + 2\Re(b^2\overline a) $$ that is almost never zero.