Suppose that we are given a list of non-zero integers $(a_1,...,a_n)$ and we want to decide whether there exist $(x_1,...,x_n)$ such that

$x_1a_1 + x_2a_2 + ... + x_na_n = 0$,

$x_i$ $\in$ $\{-1,0,1\}$, with at least one $x_i \neq$ 0.

Note that this is not the same as PARTITION, where the restriction $x_i \in \{-1,1\}$ would give a solution. Of course we should also be aware that with $x_i \in \{0,1\}$ is the NP complete problem SUBSET-SUM. I don't see any obvious way of reducing SUBSET-SUM or PARTITION to this problem. For example, attempting to reduce a 0-1 problem to $\{-1,0,1\}$ problem by appending the list with negative elements appears to accomplish nothing.

The closest problem that I found was described this post, calling the problem WEAK-PARTITION. However, the link that the original poster provided is currently broken.

I would like to know whether there is an efficient (i.e. polynomial time) algorithm known for this problem and whether anyone knows of further references to this problem.


Your problem is NP-complete, as proved by Adi Shamir in his paper On the cryptocomplexity of knapsack systems.

  • 2
    $\begingroup$ Thanks, Theorem 3 and Lemma 4 are the relevant parts if anyone comes across this. $\endgroup$
    – Kevin
    May 31 '18 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.