TITLE: Matrix of cosecants appearing in equivariant index computations
QUESTION [9 upvotes]: In a computation of characters of certain representations of finite cyclic groups which appear as equivariant indices of Dirac operators (using the Atiyah-Bott fixed point formula, cf. [1, Theorem 8.35]), the following elementary problem emerged.

Question 1
Let $d > 2$ be an integer and set $n = \lceil\frac{d}{2}\rceil -1$.
For $k \in \{1, \dotsc, n\}$ with $\gcd(k,d)=1$, we set
$$
  v_k = \begin{pmatrix} \csc^2(\frac{k \pi}{d})& \csc^2(\frac{2k \pi}{d}) &\cdots&\csc^2(\frac{n k\pi}{d}) \end{pmatrix} \in \mathbb{R}^n,
$$
where $\csc x = \frac{1}{\sin x}$ denotes the cosecant.
If $\gcd(k,d) \neq 1$, we let $v_k = (0\ \cdots\ 1\ \cdots 0)$ be the standard basis vector with entry $1$ at the $k$-th position.
Question: Do the vectors $v_1, \dots, v_n$ generate the vector space $\mathbb{R}^n$?

As this appears somewhat intimidating at first glance, let us simplify it to the case where $d$ is an odd prime number.
Then it reads as follows:

Question 2
Let $p$ be an odd prime number.
Question: Is the following $\frac{p-1}{2} \times \frac{p-1}{2}$-matrix invertible?
$$M_p =
\begin{pmatrix}
\csc^2(\frac{\pi}{p}) & \csc^2(\frac{2\pi}{p}) &\cdots & \csc^2(\frac{(p-1)\pi}{2p}) \\
\csc^2(\frac{2\pi}{p}) & \csc^2(\frac{4\pi}{p}) &\cdots & \csc^2(\frac{2(p-1)\pi}{2p}) \\
\vdots & \vdots & \ddots & \vdots\\
\csc^2(\frac{(p-1)\pi}{2p}) & \csc^2(\frac{2(p-1)\pi}{2p}) &\cdots & \csc^2(\frac{(p-1)^2\pi}{4p}) 
\end{pmatrix} 
$$

Discussion
The questions appears to be of a number-theoretic nature. Potentially relevant formulas involving the cosecant appear for instance in Cauchy's elementary solution to the classical Basel problem.
Moreover, numerical experiments suggest that

Question 1 has an affirmative answer at least for $d \leq 200$.
The determinant of the matrix in Question 2 is an integer times $\frac{1}{\sqrt{p}}$ if $p \equiv 1 \mod 4$, and an integer otherwise.
This suggests a relation to quadratic reciprocity.

Spotting a concrete formula for the determinants from numerical computations is difficult, however, because the numbers grow very rapidly.
But in [2, Lemma 3.1], the formula
$$
\prod_{j=1}^{\lfloor\frac{d}{2}\rfloor} \sin(\frac{j \pi}{d}) = \frac{\sqrt{d}}{2^{\frac{d-1}{2}}}
$$
is provided which is reminiscent of our numerical observations.
A more complicated formula involving quadratic reciprocity is provided in [2, Lemma 3.2].
All of this makes it plausible that it should be possible to derive a concrete formula for the determinants of the relevant matrices appearing in Question 1 and 2, but it remained elusive to me so far.

References
[1] Atiyah, Michael F.; Bott, Raoul, A Lefschetz fixed point formula for elliptic complexes. II: Applications, Ann. Math. (2) 88, 451-491 (1968). ZBL0167.21703.
[2] Miatello, Roberto J.; Podestá, Ricardo A., Eta invariants and class numbers, Pure Appl. Math. Q. 5, No. 2, 729-753 (2009). ZBL1183.58021.

REPLY [4 votes]: As suggested in the comment of JP McCarthy, the Gershgorin circle theorem indeed leads to a solution:
Each row of the matrix $M_p$ is just a permutation of the first row and the entry $\csc^2(\frac{\pi}{p})$ occurs precisely once in each column.
So we can permute the rows of $M_p$ to ensure that the entry $\csc^2(\frac{\pi}{p})$ appears on each diagonal position of the matrix.
Denote the resulting matrix by $\tilde{M}_p$.
Next, we apply Gershgorin to $\tilde{M}_p$ to show that it is invertible.
For this, it suffices to show that in each row the sum of the absolute values of the non-diagonal entries is strictly smaller than the absolute value of the diagonal entry.
But since each row is just a permutation of the same vector of positive numbers and we have arranged the diagonal position, this just amounts to
$$\sum_{l=2}^{n} \csc^2 \left( \frac{l \pi}{p} \right) < \csc^2\left(\frac{\pi}{p} \right),$$
where $n = \frac{p-1}{2}$.
To prove the latter, we use the formula
$$\sum_{l=1}^{d-1} \csc^2\left(\frac{l \pi}{d}\right) = \frac{d^2-1}{3},$$
which holds for any $d \in \mathbb{N}$, see the previously mentioned Wikipedia entry on the Basel problem or this Math Stack Exchange question.
From this, we conclude
\begin{align}\sum_{l=2}^n \csc^2\left(\frac{l \pi}{p} \right) &= \frac{p^2-1}{6} - \csc^2\left(\frac{\pi}{p}\right) \\
&<\frac{p^2}{6} - \csc^2\left(\frac{\pi}{p}\right)\\
&< 2 \frac{p^2}{\pi^2} - \csc^2\left(\frac{\pi}{p}\right)\\
&\leq 2 \csc^2\left(\frac{\pi}{p}\right)- \csc^2\left(\frac{\pi}{p}\right) = \csc^2\left(\frac{\pi}{p}\right), \end{align}
where we used
$ \frac{\pi^2}{2} < 6 $ for the second inequality and $\frac{1}{x^2} \leq \csc^2(x)$ for the third inequality.
This is what we needed to prove via Gershgorin that $\tilde{M}_p$ is invertible.
Hence also $M_p$ is invertible. 
This answers Question 2 affirmatively.
The same argument also applies to Question 1. Just put the $v_k$ as row vectors into a matrix and reorder it in the same way as before putting $\csc^2(\pi/d)$ in the diagonal position whenever the row index $k$ has $\gcd(k, d)=1$.
The additional unit vectors can also be appropriately reordered so that they do not disturb the Gershgorin argument.
We have also written up the detailed argument for this on p.12-13 of arXiv:1712.03722v2.