<s>[INST] Generating function for counting compositions of $n$ I was given the next question: I was asked to find the generating function for the number of divisions of $n$ (a given natural number) with exactly 3 elements. 
For example: if $n$ equals to 5 then 3,1,1 are a set of one of the options (3 + 1 + 1 = 5) 
I tried thinking about using an exponential generating function but I'm failing to see whether it's right or wrong. Any help will be appreciated! 
Repetitions are not allowed
 [/INST] We derive the wanted generating function for the number of partitions of $n$ with exactly three parts by starting with a seemingly different generating function.

The generating function for the number of partitions which consist of zero or more of $1,2,$ and $3$ is
  \begin{align*}
&(1+x+x^2+x^3+\cdots)(1+x^2+x^4+x^6+\cdots)(1+x^3+x^6+x^9+\cdots)\\
&\qquad=\frac{1}{(1-x)(1-x^2)(1-x^3)}
\end{align*}
Note: The number of partitions consisting of numbers $\leq k$ is the same as the number of partitions with number of parts $\leq k$.

If we use Ferrer diagrams to visualise the situation we see that each partition containing numbers $\leq k$ which is reflected at the main diagonal corresponds with a partition containing $\leq k$ summands.
                                
Since this correspondence is bijective the generating function is the same in both cases.

We conclude a generating function for the number of partitions with exactly three parts is
  \begin{align*}
&\frac{1}{(1-x)(1-x^2)(1-x^3)}-\frac{1}{(1-x)(1-x^2)}\\
&\qquad=\frac{1}{(1-x)(1-x^2)}\left(\frac{1}{1-x^3}-1\right)\\
&\qquad=\frac{x^3}{(1-x)(1-x^2)(1-x^3)}\\
&\qquad=x^3+x^4+2x^5+3x^6+4x^7+\color{blue}{5}x^8+7x^9\cdots
\end{align*}
  The last line was done with some help of Wolfram Alpha.

Example: There are $\color{blue}{5}$ partitions of $8$ with three summands
\begin{align*}
8&=1+1+6\\
&=1+2+5\\
&=1+3+4\\
&=2+2+4\\
&=2+3+3
\end{align*}
</s>