In how many ways $2$ bananas can be distributed among $5$ persons if each person can get any number of things? 
In how many ways $2$ bananas can be distributed among $5$ persons if each person can get any number of things?

Is my solution correct and is there any general formula?
Let the bananas be $B$ and $B$. Let the persons be $P_1,P_2,P_3,P_4,P_5$
Now let's form cases
Case $1$: when two persons get a banana each
$P_1P_2,P_1P_3,P_1P_4,P_1P_5,P_2P_3,P_2P_4,P_2P_5,P_3P_4,P_3P_5,P_4P_5$ Total $10$ cases
Case $2:$ when only one person gets a banana
$P_1$ or $P_2$ or $P_3$ or $P_4$ or $P_5$ Total $5$ cases
Case $3:$ when only one person gets $2$ bananas
$P_1$ or $P_2$ or $P_3$ or $P_4$ or $P_5$ Total $5$ cases
Case $4:$ when no person gets a banana
$1$ case
So, in total there are $21$ cases. Is it right$?$ Is there a general formula for these types of questions$?$
Any help is greatly appreciated.
 A: I am interpreting the question as follows:

In how many ways can two indistinguishable bananas be distributed to five people without restriction?

Note that interpretation corresponds to your cases 1 and 3, as drhab pointed out in the comments.
Method 1:  Since there are only two bananas, there are two possibilities: one person receives both bananas, which can occur in five ways, or two people each receive one banana, which can occur in $\binom{5}{2}$ ways, giving
$$\binom{5}{1} + \binom{5}{2} = 15$$
possibilities.
This method does not generalize well when there are many bananas to distribute.  Let's examine the method drhab suggested in the comments.
Method 2:  Let $x_i$ be the number of bananas the $i$th person receives.  Then
$$x_1 + x_2 + x_3 + x_4 + x_5 = 2 \tag{1}$$
is an equation in the nonnegative integers.  A particular solution of equation $1$ in the nonnegative integers corresponds to the placement of $5 - 1 = 4$ addition signs in a row of two ones.  For instance,
$$1 1 + + + +$$
corresponds to the solution $x_1 = 2, x_2 = x_3 = x_4 = x_5 = 0$, while
$$+ 1 + + 1 +$$
corresponds to the solution $x_1 = 0, x_2 = 1, x_3 = 0, x_4 = 1, x_5 = 0$.  The number of such solutions is the number of ways we can place four addition signs in a row of two ones, which is
$$\binom{2 + 5 - 1}{5 - 1} = \binom{6}{4} = 15$$
since we must choose which $5 - 1 = 4$ of $2 + 5 - 1 = 6$ positions required for two ones and four addition signs will be filled with addition signs.
The number of ways $k$ bananas could be distributed to $n$ people without restriction is the number of solutions of the equation
$$x_1 + x_2 + x_3 + \cdots + x_n = k \tag{2}$$
in the nonnegative integers.  The number of solutions of equation $2$ in the nonnegative integers corresponds to the placement of $n - 1$ bananas in a row of $k$ ones, which is
$$\binom{k + n - 1}{n - 1}$$
since we must choose which $n - 1$ of the $k + n - 1$ positions required for $k$ ones and $n - 1$ addition signs will be filled with addition signs.
A: Yet another approach:

*

*There are 5 initial choices, and for each of them there are other 5 choices for the 2nd banana. So we have 25 possible ways to draw bananas.

*But P1 & P2 is the same as P2 & P1, so we need to subtract those. For P1 there are 4 duplicates which we remove, then for P2 there are other 4, but we subtracted one already, so 3 left and so on.

Eventually it's going to be: $5^2 - (4 + 3 + 2 + 1) = 15$.
In case number of people is large, it's possible to simplify the sum using the famous riddle about counting the sum of 1 to 100 which would give us: $5^2 - 5\times2=15$.
