TITLE: Connected components of the complement of a degree-d affine hypersurface
QUESTION [7 upvotes]: Let $n$ and $d$ be positive integers, and $f\in\mathbb{R}[x_1,\dots,x_n]$ be a polynomial of degree $d$. Let's consider the zero-set $M = \{x \in \mathbb{R}^n: f(x) = 0\}$ of $f$.

Can we estimate the number of connected components of $\mathbb{R}^n\setminus M$?

I throw out a guess: no more than $2^d$. An realisation of the bound $2^d$ is given by the example: $f(x) = x_1x_2\cdots x_d$ (when $n \ge d$). I can prove it for the case $d = 2$.
UPDATE: is it possible to find an estimate that does not depend on $n$?

REPLY [2 votes]: You can do a bit better than the bound in Dan's reply. For a sufficiently small $\varepsilon$, consider the polynomial $g= f^2-\varepsilon$. Note that the zero set of $g$ has at lest one connected component inside of every cell of ${\mathbb R}^n\setminus M$. Thus, the Milnor-Thom theorem gives the upper bound $d^n$.
The above bound is asymptotically tight. By taking $f$ to be the product of $d$ linear expressions of the form $a_1x_1+a_2x_2+\cdots+a_nx_n+b$ you get that $M$ is the union of $n$ hyperplanes. When these hyperplanes are generic, it is not difficult to show that ${\mathbb R}^n\setminus M$ consists of at least $cd^n$ compoenets, for some constant $c$. If you would like to have a more well-behaved polynomial, you can again replace $f$ with $g= f^2-\varepsilon$.