Generalisations of the identity $\tan{\frac{3\pi}{11}}+4\sin{\frac{2\pi}{11}}=\sqrt{11}$
I recently came across this curious trigonometric sum:
$$\tan{\frac{3\pi}{11}}+4\sin{\frac{2\pi}{11}}=\sqrt{11}$$
which has a neat proof here: How to prove that: $\tan(3\pi/11) + 4\sin(2\pi/11) = \sqrt{11}$
For what values of $k$ does the following general identity have integer solutions for $a,b,x,y$?
$$a\tan{\frac{x\pi}{k}}+b\sin{\frac{y\pi}{k}}=\sqrt{k}$$
Here are a few thoughts :
Let $\zeta_n = e^{2i\pi/n}$ and $K_n = \Bbb Q(\zeta_n)$ the cyclotomic extension.
It is well-known that this extension is Galois and its Galois group is $\{\sigma_k :
\zeta_n \mapsto \zeta_n^k, k \in (\Bbb Z/n\Bbb Z)^*\}$.
$K_n$ contains $\cos(2\pi/n), i\sin(2\pi/n)$, and $i\tan(\pi/n)$.
Hence, $i(a\tan(x\pi/n)+b\sin(y\pi/n)) \in K_n \cap i \Bbb R$.
So first, it would be good to know when $\sqrt{-n} \in K_n$.
If $n$ is even, then $K_n$ never contains $\sqrt {\pm n}$ (you would need $K_{4n}$ for that).
If $n \equiv 1 \pmod 4$, then $K_n$ contains $\sqrt n$ and not $i$, so it doesn't contain $\sqrt{-n}$, and we can also stop.
If $n \equiv 3 \pmod 4$, then $K_n$ does contain $\sqrt {-n}$. Let $\chi_n : (\Bbb Z/n\Bbb Z)^* \to \{\pm 1\}$ be the character satisfying $\sigma_k(\sqrt{-n}) = \chi_n(k) \sqrt{-n}$, and $H_n = \ker \chi_n$.
We have $\Bbb Q(\sqrt{-n}) = K_n^{H_n}$, and the numbers of the form $a\sqrt{-n} \in K_n^{H_n}$ are the numbers $x \in K$ satisfying $\sigma_k(x) = \chi_n(k)x$. Since $\sigma_k(i\sin(x\pi/n)) = i\sin(kx\pi/n)$ and similarly with $\tan$, we want to find integers $a,b,x,y$ such that forall $k$ prime with $n$, $a\tan(kx\pi/n)+b\sin(2ky\pi/n) = \chi_n(k)(a\tan(x\pi/n)+b\sin(2y\pi/n))$.
It is enough to find one with $x=1$ and to include only a set of generators of $(\Bbb Z/n\Bbb Z)^*$ for $k$. After a bit of rewriting, we have to find an integer $y$ such that forall $k$ in a generating set, $\frac{\chi_n(k)\tan(\pi/n)-\tan(k\pi/n)}{\chi_n(k)\sin(2y\pi/n)-\sin(2ky\pi/n)} = -b/a \in \Bbb Q$
Forgetting that this rational has to be independant from $k$, checking that this is a rational is the same as checking that it is invariant by the $\sigma_k$, which means we should check that forall $k,k'$ in a generating set,
$(\chi_n(k)\tan(\pi/n) - \tan(k\pi/n))(\chi_n(k)\sin(2k'y\pi/n)-\sin(2kk'y\pi/n)) - (\chi_n(k)\tan(k'\pi/n) - \tan(k'k\pi/n))(\chi_n(k)\sin(2y\pi/n)-\sin(2ky\pi/n)) = 0$
For example with $n=11$, we can pick $k=k'=2$, we have $\chi_{11}(2) = -1$, and indeed $y=4$ or $y=7$ works.
For $n=7$, $3$ is a primitive root, and $y= 1$ works, which gives $-b/a = 4$, and finally we get $4\sin(2\pi/7) - \tan(\pi/7) = \sqrt 7$.
For $n=19$, $2$ is again a primitive root, and computing this expression for $y= 1 \ldots 18$, we don't find any zero, which shows that there is no such formula (neither for $n$ prime less than $700$, and probably never again)