for positive integer n we have: $N={1,2,...,n}, f(n)= \Sigma_{A \subseteq N} \Sigma_{B \subseteq N} , |A \cap B|$. for example, how I can calculate $f_5$?
I have some trouble with definition. this take from local contest on school in Spania, 2010.
First let $P_n=\big\{A/ A\subset N\big\} $ ,so that the function $f$ can be defined by : $$f(n)=\sum_{A\in P_n}\sum_{B\in P_n}|A\cap B|\,\,\,\,\,\, (1)$$ Now we have $$\begin{align}f(n)&&=&\sum_{A\in P_n}\sum_{B\in P_n}|A\cap B| &(2)\\ &&=&\sum_{A\in P_n}\sum_{k=0}^{|A|} \sum_{B\in P_n,|B\cap A|=k}|A\cap B|&(3)\\ &&=&\sum_{A\in P_n}\sum_{k=0}^{|A|} k |\big\{B\in P_n/|B\cap A|=k\big\}|&(4)\end{align}$$ but we know that the number of subsets $B$ for which $A\cap B$ has $k$ elements is : $$\dbinom{|A|}{k}2^{n-|A|} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (5)$$ hence: $$\begin{align}f(n)&&=&\sum_{A\in P_n}\sum_{k=0}^{|A|} k\dbinom{|A|}{k}2^{n-|A|}&(6)\\ &&=&\sum_{A\in P_n}|A|2^{|A|-1}2^{n-|A|}&(7)\\ &&=&2^{n-1}\sum_{A\in P_n}|A|&(8)\\ &&=&2^{n-1}\sum_{k=0}^n \sum_{A\in P_n,|A|=k}k&(9)\\ &&=&2^{n-1}\sum_{k=0}^n k|\big\{A\in P_n/|A|=k\big\}|&(10)\end{align}$$
and here also we know that the number of subsets $A$ of $P_n$ of cardinal $A$ is $\dbinom{n}{k}$ so: $$\begin{align}f(n)&&=&2^{n-1}\sum_{k=0}^n k\dbinom{n}{k}&(11)\\ &&=& 2^{n-1}.n.2^{n-1}&(12)\\ &&=& n4^{n-1}&(13)\end{align}$$
So for $n=5$ we obtain $f(5)=1280$