# how to compute this summation /composite function

Let $f(x)$ be the set of all even numbers smaller or equal than $x$.

For example, $f(10)=\{0,2,4,6,8,10\}$. Let $g(x)=2x$.

Consider the double sum: $$\sum_{i=1}^4 \sum_{j\in(g \circ f)(i)} j$$

I know that $(g \circ f)(i)=g(f(i))$

Where should the summation start from?

-

\begin{align*} \sum_{i=1}^4 \sum_{j \in g(f(i))} j &= \sum_{j \in g(f(1))} j +\sum_{j \in g(f(2))} j +\sum_{j \in g(f(3))} j+\sum_{j \in g(f(4))} j \\\\ &= g(0) + \big(g(0) + g(2)\big) + \big(g(0) + g(2)\big) + \big(g(0) + g(2) + g(4)\big) \\\\ &= 4g(0) + 3g(2) +g(4)\;. \end{align*}
Using $g(x)=2x$, we find the result $0 + 12 + 8 =20$.