Đặt \(A=cosx+cos2x+...+cosnx\)
\(\Rightarrow2A.sin\frac{x}{2}=2sin\frac{x}{2}.cosx+2sin\frac{x}{2}.cos2x+...+2sin\frac{x}{2}.cosnx\)
\(=sin\frac{3x}{2}-sin\frac{x}{2}+sin\frac{5x}{2}-sin\frac{3x}{2}+...+sin\frac{\left(2n+1\right)x}{2}-sin\frac{\left(2n-1\right)x}{2}\)
\(=sin\frac{\left(2n+1\right)x}{2}-sin\frac{x}{2}=2cos\frac{\left(n+1\right)x}{2}sin\frac{nx}{2}\)
\(\Rightarrow A=\frac{cos\frac{\left(n+1\right)x}{2}.sin\frac{nx}{2}}{sin\frac{x}{2}}\)