Skip to main content
1 of 3
Aaron Meyerowitz
  • 30.1k
  • 1
  • 48
  • 104

A first step would be to find a (nice) basis of the null space of $A$. Once that is done (which would take about $n^3$ steps with a lazy algorithm), answering your question would seem easy in practice for reasonable size $n.$ However the problem is NP-complete: As $n$ grows to be enormous the number of steps required in the worst case (it is suspected) can not be be bounded by any power of $n.$

One version of this he subset-sum problem is

given a set $S$ of $m$ positive integers and an integer $k$, is there a subset $T$ whose sum is exactly $k?$

This is known to be NP-complete, there is (almost certainly) no method which ALWAYS gives the correct answer in a reasonable amount of time.

Let $S=\{s_1,s_2,\cdots,s_m\}$ and the sum of the $s_i$ be $n.$ Unless both $m$ and $n$ are quite large the problem should be easy.

To translate subset sum to your problem, let $A$ be a matrix made of $m$ square blocks along the diagonal. Block $i$ is $s \times s$ for $s=s_i$ with $1$’s everywhere except diagonal entries $1-s.$ Then a vector is in the null space of $A$ exactly if the first $s_1$ entries are equal to each other and the next $s_2$ are equal to each other. Etc.

Aaron Meyerowitz
  • 30.1k
  • 1
  • 48
  • 104