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.