In how many ways can a person score a total of $130$ marks in an exam consisting of $3$ sections of $50$ marks each? In how many ways can a person score a total of $130$ marks in an exam consisting of $3$ sections of $50$ marks each?
What I did:-
$$a+b+c=130$$
So applying partition rule 
$n=130$ and $130$ marks has to be divided into three groups so $r=$
$132C2$
Now we will subtract the case when $a$, $b$ or $c$ is $51$, i.e. more than $50$.  Suppose $a$ is $51$.
\begin{align*}
51+b+c & = 130\\
b+c & = 79
\end{align*}
Now $n=79$ and $r=2$.
$80C1$
Similarly, for $b$ and $c$ also $= 80C1$
Final answer $= 132C2-3 \cdot (80C1)$
But actual  answer is $132C2-3 \cdot (81C2)+3 \cdot (30C2)$
Please someone explain me this. What is wrong with my answer? Why are we adding?
 A: We wish to solve the equation
$$a + b + c = 130 \tag{1}$$
in the nonnegative integers subject to the restrictions that $a, b, c \leq 50$.
As you observed, equation 1 has 
$$\binom{130 + 2}{2} = \binom{132}{2}$$
solutions in the nonnegative integers.
From these, we must exclude those in which or more of the variables exceeds $50$.  Notice that at most two variables can exceed $50$ since $3 \cdot 51 = 153 > 130$.
Suppose $a > 50$.  Then $a' = a - 51$ is a nonnegative integer.  Substituting $a' + 51$ for $a$ in equation 1 yields
\begin{align*}
a' + 51 + b + c & = 130\\
a' + b + c & = 79 \tag{2}
\end{align*}
Equation 2 is an equation in the nonnegative integers with 
$$\binom{79 + 2}{2} = \binom{81}{2}$$
solutions.  By symmetry, there are the same number of solutions in which $b > 50$ or $c > 50$.  Hence, there are 
$$\binom{3}{1}\binom{81}{2}$$
solutions in which a variable exceeds $50$.
However, if we subtract $\binom{3}{1}\binom{81}{2}$ from the total, we will have subtracted too much since we have counted those cases in which two variables exceed $50$ twice, once for each way we could designate one of the variables as the one that exceeds $50$.  We only want to subtract those cases once, so we must add them back.  
Suppose $a > 50$ and $b > 50$.  Let $a' = a - 51$ and let $b' = b - 51$.  Then $a'$ and $b'$ are nonnegative integers.  Substituting $a' + 51$ for $a$ and $b' + 51$ for $b$ in equation 1 yields
\begin{align*}
a' + 51 + b' + 51 + c & = 130\\
a' + b' + c & = 28 \tag{3}
\end{align*}
Equation 3 is an equation in the nonnegative integers with 
$$\binom{28 + 2}{2} = \binom{30}{2}$$
solutions.  By symmetry, there are an equal number of solutions in which $a$ and $c$ both exceed $50$ and in which $b$ and $c$ both exceed $50$. Thus, there are 
$$\binom{3}{2}\binom{30}{2}$$
solutions in which two of the variables exceed $50$.
By the Inclusion-Exclusion Principle, the number of ways a person could obtain a score of $130$ marks on an examination consisting of three parts worth $50$ marks each is
$$\binom{132}{2} - \binom{3}{1}\binom{81}{2} + \binom{3}{2}\binom{30}{2}$$
A: Denote by $x_1$, $x_2$, $x_3$ the number of missed points in the three sections. The $x_i$ are $\geq0$ and add up to $20$. By "stars and bars" the number of such triples is given by
$${22\choose2}=231\ .$$
A: Christian does a great job of simplifying.  Another way to look at this problem and realize that 50 should never come into the equation is as follows:
We are looking for the number of cases in which a+b+c= 130, which has a minimum value for a,b or c of 30.  Therefore we can revise the equation by subtracting 30 from each value and getting the # of cases where d = a-30, e = b-30 and f = c-30 range from 0 to 20 and d + e + f = 40.  since f can range from 0-20, we need the # of cases where 20<=d+e<=40.  
when d = 0, we have 1 solution (e=20)
When d=1, we have 2 solutions (e=19, e = 20), etc. until
d=20, and we have 21 solutions for e (e=0 through e=20)
so we get sum (1+2+3...+21) = 22x21/2 = 231
A: All the given answers are good, just adding mine.
We need to solve $a+b+c=130$ with the restriction that $a,b,c \leq 50$
Basically, $50-a,50-b,50-c \geq 0$
$-a-b-c=-130$
$(50-a)+(50-b)+(50-c)=20$
Now apply stars and bars method to obtain $\boxed{231}$
