# Is it possible to expand a polynomial written as a product with symbolic range?

I have an expression of a polynomial here $$\prod_{k=1}^n{x+2(-1)^k\cos{\frac{k\pi}{2n+1}}}.$$ I'd like to expand the product, but the function Expand just give me the same expression. I wonder if there's a way to obtain the simplified and expanded form of the polynomial. Thanks.

• That looks like it could almost be a Chebyshev polynomial... – J. M.'s ennui May 10 '20 at 14:00
• What is the expected result? – Daniel Lichtblau May 10 '20 at 14:47
• Can you phrase the problem in the following manner please? 1. this is the code I used, 2. this was the output, 3. this is the output I want instead. Do include runnable code. – Szabolcs May 10 '20 at 15:03
• @J.M. Right on the money! In terms of a polynomial in $x$ the coefficients are found at Coefficients of first difference of Chebyshev S polynomials. – JimB May 10 '20 at 15:37

If you think there's a simplified solution and Mathematica (or Maple or whatever) doesn't give you a simplified solution, you just have to explore.

Expand the polynomial in $$x$$ for various values of $$n$$ and look for patterns. Mathematica and OEIS.org make this possible. Here is the expansion for $$n=8$$:

n = 8;
p = Product[x + 2 (-1)^k Cos[k π/(2 n + 1)], {k, 1, n}] // Expand // TrigReduce;
s = Table[{x^i, If[i == 0, FullSimplify[p /. x -> 0],
FullSimplify[Coefficient[p, x^i]]]}, {i, 0, n}];
p = #[[1]] #[[2]] & /@ s // Total
(* 1 + 4 x - 10 x^2 - 10 x^3 + 15 x^4 + 6 x^5 - 7 x^6 - x^7 + x^8 *)


Then look up 1,4,-10,-10,15,6,-7,-7,1 at OEIS.org to obtain a formula that will produce those coefficients.

Do that for various values of $$n$$ to be convincing.

• Once again, thanks for following through. :) I would invite the OP to follow the links to the OEIS, but as a spoiler: With[{n = 8}, CoefficientList[ChebyshevU[n, x/2] - ChebyshevU[n - 1, x/2], x]]. – J. M.'s ennui May 10 '20 at 15:51