# How many integer solutions of $x_1$ + $x_2$ + $x_3$ + $x_4$ = 28 are there with [duplicate]

How many integer solutions of $$x_1$$ + $$x_2$$ + $$x_3$$ + $$x_4$$ = 28 are there with

(a) 0 ≤ $$x_i$$ ≤ 12?

(b) −10 ≤ $$x_i$$ ≤ 20?

(c) 0 ≤ $$x_i$$, $$x_1$$ ≤ 6, $$x_2$$ ≤ 10, $$x_3$$ ≤ 15, $$x_4$$ ≤ 21?

I have tried.

a) To count the compliment value, so (31 choose 3) - (15 choose 3)

b) Not quite sure where to begin

c) (31 choose 3)-(24 choose 3)-(18 choose 3)- (13 choose 3)- (9 choose 3)

## marked as duplicate by N. F. Taussig combinatorics StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Oct 29 '18 at 20:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• What have you tried? – Jens Oct 29 '18 at 16:40
• Hey, this site isn't used to give you the answers, we're here to help you work them out. You're more likely to get help if you have showed what you have attempted! Edit the post with your attempt and someone may help – Brad Scott Oct 29 '18 at 20:01

## 1 Answer

Hint: Use principle of inclusion and exclusion. First you can find no of solutions corresponding to only the lower bound. Then you can subtract from this considering the lower bound to be one plus the upper bound.

That is, if you want $$b\leq x_i\leq a$$, solve independently for $$b\leq x_i$$ and subtract from this the cases when $$a+1\leq x_i$$

(You may also use generating functions but that might be tough since the upper limits are not same for all of the $$x_i$$).