In a certain exercise I am asked to say how many possible solutions are there for the diophantine equation $x_1 + x_2 + \cdots + x_{20} = 50$, with the condition that $x_i$ can only be or 1 or 3. Here is my attempt:
To begin with, one has to choose how many 3 can be. Taking into account that there are at most 20 $x_i$ that can add up to the number on the right side and that those $x_i$ can only be 1, I ended up with the fact that the only possible solution would be having 15 threes and therefore the sum of the remaining 5 members would be 5, so the remaining members would all be 1. The only thing missing is ordering those threes: the answer is therefore $20 \choose 15$. Is this correct, or am I missing something?


2 Answers 2


Yes, it's correct. You can do this faster by subtracting $20$ and dividing by $2$ on both sides, then letting $y_i=(x_i-1)/2\in\{0,1\}$ to give $\sum_{i=1}^{20}y_i=15$ which is now obvious.


Assuming that order of $\{x_i\}$ matters, your answer is correct. However, if order of $\{x_i\}$ does not matter than the answer is $1$.

  • $\begingroup$ Yes, the order of $x_i$ matters since these are different variables $\endgroup$
    – Daniel C.
    Oct 3 at 11:27
  • 3
    $\begingroup$ Then you're correct. BTW I suggest you check out @BenjaminWang 's answer. It's quite insightful. Remember to give him an upvote and click the check mark if you find it helpful $\endgroup$
    – IraeVid
    Oct 3 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .