All possible integral solutions of a linear equation of $n$ binary variables

85 Views Asked by At

Let us consider the following equations:

$x_1+x_2+\dots+x_n=1$ where $x_i\in \{0,1\}$ How can I determine all the solutions? I can solve easily the equation of two varieties like this:

$x_1+x_2=1$. Here the the number of solutions is $2$ and the solutions are $ (0,1), (1,0)$.

1

There are 1 best solutions below

0
On

If at least two elements is greater than $0$ then the sum cannot be $1$, hence exactly one element is $1$, hence there are n solutions, depending on which of the number is $1$.