The problem I am working on is the following:

Show that there exists an $NP$-Complete problem in $SPACE(n)$. Does the existence of such a problem imply that $NP$ is contained in $SPACE(n)$. Why or why not?

  1. $SAT$ is contained in $SPACE(n)$. To show that, simply store Boolean formula (takes $O(n)$ space) and try all assignments for the variables.

  2. $NP$-Complete problem is the problem that is in $NP$ and every problem in $NP$ can be reduced to it, therefore, since $SAT$ is in $SPACE(n)$, any other problem in $NP$ would be contained in SPACE(n).

Would that be a correct solution to the problem? Also, I have come across related question on $NP \neq SPACE(n)$

  • 1
    $\begingroup$ Please ask one question per post. $\endgroup$
    – Complexity
    Commented Mar 15, 2018 at 6:06
  • 2
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$
    – D.W.
    Commented Mar 15, 2018 at 6:09
  • 1
    $\begingroup$ Your second step needs justification/proof; you can't just assert it without justification. Based on the question you link to it seems you already know that your conclusion is faulty. $\endgroup$
    – D.W.
    Commented Mar 15, 2018 at 6:10

1 Answer 1


First, let me show how to prove that some NP-complete problem using linear space just given the existence of some NP-complete problem.

Suppose that $L$ is NP-complete. In particular, $L$ runs in nondeterministic time $O(n^k)$ for some $k$, and so uses $O(n^k)$ space. Construct a new language $L’ = \{(x,1^{|x|^k}) : x \in L\}$. Given an input to $L’$, we can first verify that it is of the form $(x,1^{|x|^k})$, and then run the nondeterministic algorithm for $L$, which now runs in linear time and space (since the length of the input is $|x| + |x|^k$). Conversely, $L’$ is still NP-hard, since you can easily reduce $L$ to $L’$.

The technique illustrated above is known as padding, and is very useful in computational complexity.

Second, why does this not show that all of NP can be solved in linear space? The fact that $L’$ is NP-hard means that every language $A$ in NP can be reduced to it in polynomial time. If the reduction works in time $O(n^k)$, we can use the linear space algorithms for $L’$ to solve $A$ in space $O(n^k)$, since this is the size of the input to $L’$.

It is expected that NP is not contained in $\mathsf{SPACE}(n)$, but we don’t know how to prove it. Indeed, since L is contained in $\mathsf{SPACE}(n)$, if we could prove that NP is not, then we would separate L from NP, a separation which isn’t known at the moment. See this answer. It is known, however, that NP is different from $\mathsf{SPACE}(n)$; see this answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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