Is there a way to expand a summation of product of two functions?

457 Views Asked by At

I have been experimenting with summations were you multiply to functions, e.g. $\sum_{i=0}^n f(n)g(n)$ where $f(x)=x^2$ and $g(x)=-\frac{x^2}{\log{x}}$. While trying out different functions for $f(x)$ and $g(x)$, I stumbled upon this. $$\sum_{i=1}^n ((-1)^i\left|i+x-\frac{n}{2}\right|+\frac{1}{2})$$ I simplified it until here $$(\sum_{i=1}^n(-1)^i\left|i+x-\frac{n}{2}\right|\bigr)+\frac{n}{2}$$ I think I can simplify it more by making it so that in $\sum_{i=1}^nf(x)g(x), f(x)=(-1)^i$ and $g(x)=\left|i+x-\frac{n}{2}\right|$ and then expanding the summation, but I don't know how.

Is there a formula that expands out or simplifies $\sum_{i=1}^n f(x)g(x)$?