# How can I get mathematica to prove $\sum_{k=0}^{n-1}\tan\left(\theta+\frac{k\pi}{n}\right)=−n\cot\left(\frac{n\pi}{2}+n\theta\right)$?

How can I get Mathematica to prove $$\sum_{k=0}^{n-1}\tan\left(\theta+\frac{k\pi}{n}\right)=−n\cot\left(\frac{n\pi}{2}+n\theta\right)$$ (1)?

Sum[Tan[T + (k \[Pi])/m], {k, 0, m - 1}]


*see proof of (1) and slight variation here.

• "Solve" as in find the values of some variable? If it's an identity, you already have a proof, so what's the point? Can you clarify what you want? Commented Jan 22, 2022 at 22:40
• To add the the comment by @MichaelE2, if you try SumConvergence[Tan[T + (k \[Pi])/n], k] it yields False. Is it possible that there assumption for some quantities that you forgot to mention?
– user49048
Commented Jan 22, 2022 at 22:54
• In any case, just to get you started you can try the following: test1[n_] := Sum[Tan[T + (k \[Pi])/n], {k, 0, n - 1}] test2[n_] := -n Cot[(n \[Pi])/2 + n T]  and then check Table[test1[n], {n, 1, 2}] - Table[test2[n], {n, 1, 2}] // TrigExpand which gives {0, 0} and higher specific values for n which give {0, 0,0,...,0,0,....0}.
– user49048
Commented Jan 22, 2022 at 22:55
• One way is :Integrate[Sum[D[Tan[\[Theta] + k*Pi/n], \[Theta]], {k, 0, n - 1}], \[Theta]] // ExpandAll Commented Jan 23, 2022 at 11:12
• In this case integrational constans is zero. This is not always true. Commented Jan 23, 2022 at 11:24

This can be done with Mathematica as follows. First, on the domain of the function of \[Theta] defined by Sum[Tan[\[Theta] + k*Pi/n], {k, 0, n - 1}] + n*Cot[n*Pi/2 + n*\[Theta]] its derivative equals zero as the result of

FullSimplify[D[Sum[Tan[\[Theta] + k*Pi/n], {k, 0, n - 1}] +
n*Cot[n*Pi/2 + n*\[Theta]], \[Theta]], Assumptions -> n \[Element] PositiveIntegers]


0

assures us. Second, let us determine

FunctionDomain[n*Cot[n*Pi/2 + n*\[Theta]], \[Theta]]


NotElement[((n*Pi)/2 + n*\[Theta])/Pi, Integers]

and

FunctionPeriod[n*Cot[n*Pi/2 + n*\[Theta]], \[Theta]]


Pi/n

In any case, the point \[Theta]=Pi/(4n) belongs to this domain as well as to the domain of Sum[Tan[\[Theta] + k*Pi/n], {k, 0, n - 1}]. The latter statement follows from

FunctionDomain[Tan[\[Theta] + k*Pi/n], \[Theta]]


1/2 + ((k \[Pi])/n + \[Theta])/\[Pi] \[NotElement] Integers

Third, Sum[Tan[\[Theta] + k*Pi/n], {k, 0, n - 1}] + n*Cot[n*Pi/2 + n*\[Theta]] is a constant (perhaps, depending on n) on each interval of its domain (which is a periodic set). We find this constant by substituting \[Theta]==Pi/(4n) into the sum:

 FindSequenceFunction[Table[FullSimplify[Sum[Tan[Pi/(4 n) + k*Pi/n], {k, 0, n - 1},
Assumptions -> n \[Element] PositiveIntegers] +
n*Cot[n*Pi/2 + n*Pi/(4 n)]], {n, 1, 10}], n]


0