This statement you made is not the full story:
the function $f(x)$ is periodic if $f(x+T)=f(x)$ for every $x$; where $T$ is the period of the function $f(x)$.
The full story is:
the function $f(x)$ is periodic if $f(x+T)=f(x)$ for every $x$; where $T$ is a period of the function $f(x)$.
Periodic functions actually have infinitely many periods. If $T$ is a period of $f$, then $$f(x + 2T) = f((x + T) + T) = f(x + T) = f(x)$$
So $2T$ is also a period of $f$. And an almost identical calculation shows that $3T$ is also a period, and so on. If $T$ is a period of $f$, then so is $kT$ for any positive integer $k$.
Now if $f$ is continuous and periodic but not constant, there has to be a smallest period, and that is the one we normally call the period of $f$. But it is useful to keep in mind that all the multiples of that value are also periods.
Next note that if two functions $f$ and $g$ both share a common period $T$ then so does any operation applied to them. If $F(x,y)$ is any function of two variables, then
$$F(f(x+T),g(x+T))= F(f(x), g(x))$$
The same holds true for any number of arguments, even infinite, provided the individual functions are all periodic with the same period $T$.
$$F(f_1(x+T), f_2(x + T), f_3(x + T), \dots) = F(f_1(x), f_2(x), f_3(x), \dots)$$
The summation in your problem is a function $F$ of infinitely many variables. So if you could find a common period for all of the $\cos \frac{n\pi x}l$ functions being added, it would also be a period for their sum.
@geetha290krm
– amer hakam Aug 30 '22 at 09:24