# Is there a positive integer $N$ for which $\sum_{n=1}^N \cos\left(n^2x\right)=0$ for every $x\in[0,2\pi]$?

I'd like to know whether or not the trigonometric sum $$\sum_{n=1}^N \cos\left(n^2x\right)$$ is ever identically $$0$$ on $$[0,2\pi]$$.

Plotting the graph of $$\sum_{n=1}^N \cos\left(n^2x\right)$$ for a few values of $$N$$, I conjecture that the answer is nay. I figured I could prove this by showing that the Wronskian of the functions $$\cos\left(1^2x\right)$$, $$\cos\left(2^2x\right)$$, $$\dots$$, $$\cos\left(n^2x\right)$$ is not identically $$0$$ over $$[0,2\pi]$$, since this would imply that they're linearly independent.

After cranking out the derivatives and seeing the obvious pattern in them, I ran into a roadblock because I wasn't able to find any convenient values of $$x$$ for which the Wronskian is nonzero. I tried to evaluate it at integer multiples of $$\pi$$, but quickly realized that this would fail because every row of $$\sin$$'s would evaluate to $$0$$, making the whole determinant zero. My tiny brain can't think of any other convenient values to evaluate the determinant (having to consider all the numbers $$1^2$$, $$2^2$$, $$\dots$$, $$N^2$$ jointly really screws this up), so it seems like this approach is bound to fail, at least for me.

Provided that my conjecture is true, is there another way to prove linear independence? If this isn't the best approach, how can I prove that the sum is never identically $$0$$? I greatly appreciate any and all assistance.

Context: I'm currently investigating whether the integral $$\int_0^{2\pi}\left(\sum_{n=1}^N \cos\left(n^2x\right)\right)^4 dx$$ is ever $$0$$ when $$N$$ varies in $$\mathbb{Z}^+$$. Part of my interest in this problem comes from this Math SE post from a fellow user.

The integrand is non-negative, so the integral is certainly at least $$0$$. If there's an $$N$$ for which the integral is actually zero, then from the demonstrably true implication

$$f\text{ continuous}, f(x)\geq 0\text{, and }\int_a^b f(x)dx=0\implies f(x)=0\text{ for every }x\in[a,b]$$

we can deduce that

$$\left(\sum_{n=1}^N \cos\left(n^2x\right)\right)^4=0\text{ for every }x\in[0,2\pi]$$

which is only possible if $$\sum_{n=1}^N \cos\left(n^2x\right)\equiv 0$$. This is why I'm interested in whether or not the sum is ever identically $$0$$.

• I guess I miss something... For $x=0$, the sum is equal to $N$. Oct 8, 2021 at 8:08
• I am guessing the question is whether any non-trivial linear combination of $\cos(n^2x)$ is always non-zero somewhere, not just the sum, i.e. whether they are linearly independent? But that just follows from orthogonality for cosine series. Oct 8, 2021 at 8:10
• @Damien oh my goodness. I feel dumb for not seeing that! Oct 8, 2021 at 8:17

You might already know that the functions $$1, \cos x, \sin x, \cos 2x, \sin 2x , \cdots$$ form an orthogonal basis for the space $$L^2[0,2\pi]$$ (which contains the space of all continuous functions on $$[0,2\pi]$$). As such, the only linear sum of these functions, $$\sum_{n\geqslant 0} a_n \cos n x + \sum_{m > 0} b_m \sin m x$$, finite or not, that is identically zero almost everywhere is the sum where all $$a_n, b_m$$ are zero. Conversely, any sum that does not have all terms zero, such as yours, cannot be identically zero almost everywhere, notwithstanding the point that it is anyway non-zero when $$x=0$$.
The orthogonality argument is a very effective one (as is the evaluation at zero), but I wanted to point out another possibility. Let $$f(x)=\sum_{n=1}^N{\cos(n^2x)}$$. Then $$f$$ is smooth and we can see that $$\cos(N^2x)$$ is the limit, as $$k \rightarrow \infty$$, of $$N^{-8k}f^{(4k)}(x)$$.
If $$f$$ identically vanishes on $$[0,2\pi]$$ (thus on $$\mathbb{R}$$), so do all its derivatives and the above limit is zero, hence $$\cos(N^2x)=0$$ for all $$x$$ – a contradiction.