Consider the number $n$ a partition $P$ of $n$. Denote by $f_n(P)$ the number of $1$s in $P$ and by $g_n(P)$ the number of distinct elements in $P$. Show that $\displaystyle\sum_{P} f_n(P) = \displaystyle\sum_{P} g_n(P)$. Note that a partition is a non-decreasing sequence of integers that add upto $n$.
Here is my take on the problem :
Denote by $p(n)$ the number of partitions of $n$. Now any partition of $n+1$ such that it has a $1$ is basically $1$ $+$ some partition of $n$, which gives -
$\displaystyle\sum_P f_{n+1}(P) = p(n) + \displaystyle\sum_P f_{n}(P)$
Similarly just add $1$ to the largest element of every partition of $n$ to get $n+1$. Consider the partitions of $n+1$ into two categories - one having the largest integer appear only once in the partition and another having the largest integer repeat. In the second category, reducing the last number (by $1$) either keeps the number of distinct elements same or decreases by $1$, which isn't desired, while in the first category, reducing the largest element by $1$ yields a partition of $n$ that has exactly one less number of distinct elements. We basically generate
$\displaystyle\sum_P g_{n+1} (P) = p(n) + \displaystyle\sum_P g_{n} (P)$, as desired.
Is there a way to solve this without induction? Elegant methods requiring generating functions are fine too, though I'd appreciate any solution that relies on construction and not recurrences/GFs.
The generating function $f(x,y)=\sum_{n,k}f_{nk}x^ny^k$ that counts the partitions of $n$ with $k$ parts $1$ is
\begin{eqnarray} f(x,y) &=&\sum_{j=0}^\infty(xy)^j\prod_{m=2}^\infty\sum_{j=0}^\infty x^{jm} \\ &=& \frac1{1-xy}\prod_{m=2}^\infty\frac1{1-x^m}\;. \end{eqnarray}
The generating function $g(x,y)=\sum_{n,k}g_{nk}x^ny^k$ that counts the partitions of $n$ with $k$ distinct parts is
\begin{eqnarray} g(x,y) &=& \prod_{m=1}^\infty\left(1+y\sum_{j=1}^\infty x^{jm}\right) \\ &=& \prod_{m=1}^\infty\frac{1-x^m(1-y)}{1-x^m}\;. \end{eqnarray}
We can extract the desired sums from these generating functions:
\begin{eqnarray} \sum_Pf_n(P) &=& \left[x^n\right]\left.\frac\partial{\partial y}f(x,y)\right|_{y=1} \\ &=& \left[x^n\right]\left.\frac x{(1-xy)^2}\prod_{m=2}^\infty\frac1{1-x^m}\right|_{y=1} \\ &=& \left[x^n\right]\frac x{1-x}\prod_{m=1}^\infty\frac1{1-x^m} \end{eqnarray}
and likewise
\begin{eqnarray} \sum_Pg_n(P) &=& \left[x^n\right]\left.\frac\partial{\partial y}g(x,y)\right|_{y=1} \\ &=& \left[x^n\right]\left.\sum_{m=1}^\infty\frac{x^m}{1-x^m}\prod_{m'\ne m}\frac{1-x^m(1-y)}{1-x^m}\right|_{y=1} \\ &=& \left[x^n\right]\left(\sum_{m=1}^\infty x^m\right)\left(\prod_{m=1}^\infty\frac1{1-x^m}\right) \\ &=& \left[x^n\right]\frac x{1-x}\prod_{m=1}^\infty\frac1{1-x^m}\;. \end{eqnarray}
Sorry about the generating functions ;-)