The problem of counting the number of solutions to a knapsack instance can be defined as follows: Given items with sizes $a_{1}, a_{2}, \ldots, a_{n}>0$ and an integer $b>$ 0 , find the number of vectors $\left(x_{1}, x_{2}, \ldots, x_{n}\right) \in\{0,1\}^{n}$ such that $\sum_{i=1}^{n} a_{i} x_{i} \leq b$. The number $b$ can be thought of as the size of a knapsack, and the $x_{1}$ denote whether or not each item is put into the knapsack. Counting solutions corresponds to counting the number of different sets of items that can be placed in the knapsack without exceeding its capacity.
(a) A naïve way of counting the number of solutions to this problem is to repeatedly choose $\left(x_{1}, x_{2}, \ldots, x_{n}\right) \in\{0,1\}^{n}$ uniformly at random, and return the $2^{n}$ times the fraction of samples that yield valid solutions. Argue why this is not a good strategy in general; in particular, argue that it will work poorly when each $a_{i}$ is 1 and $b=\sqrt{n}$.
(b) Consider a Markov chain $X_{0}, X_{1}, \ldots$ on vectors $\left(x_{1}, x_{2}, \ldots, x_{n}\right) \in\{0,1\}^{n} .$ Suppose $X_{j}$ is $\left(x_{1}, x_{2}, \ldots, x_{n}\right)$. At each step, the Markov chain chooses $i \in[1, n]$ uniformly at random. If $x_{i}=1$, then $X_{j+1}$ is obtained from $X_{j}$ by setting $x_{i}$ to 0 . If $x_{i}=0$, then $X_{j+1}$ is obtained from $X_{j}$ by setting $x_{l}$ to 1 if doing so maintains the restriction $\sum_{i=1}^{n} a_{i} x_{i} \leq b .$ Otherwise, $X_{j+1}=X_{j} .$
Argue that this Markov chain has a uniform stationary distribution whenever $\sum_{i=1}^{n} a_{i}>b$. Be sure to argue that the chain is irreducible and aperiodic.
(c) Argue that, if we have an FPAUS for the knapsack problem, then we can derive an FPRAS for the problem. To set the problem up properly, assume without loss of generality that $a_{1} \leq a_{2} \leq \cdots \leq a_{n}$. Let $b_{0}=0$ and $b_{1}=\sum_{j=1}^{l} a_{i}$. Let $\Omega\left(b_{i}\right)$ be the set of vectors $\left(x_{1}, x_{2}, \ldots, x_{n}\right) \in\{0,1\}^{n}$ that satisfy $\sum_{i=1}^{n} a_{t} x_{i} \leq b_{1}$. Let $k$ be the smallest integer such that $b_{k} \geq b$. Consider the equation
$$
|\Omega(b)|=\frac{|\Omega(b)|}{\left|\Omega\left(b_{k-1}\right)\right|} \times \frac{\left|\Omega\left(b_{k-1}\right)\right|}{\left|\Omega\left(b_{k-2}\right)\right|} \times \cdots \times \frac{\left|\Omega\left(b_{1}\right)\right|}{\left|\Omega\left(b_{0}\right)\right|} \times\left|\Omega\left(b_{0}\right)\right|
$$
You will need to argue that $\left|\Omega\left(b_{i-1}\right)\right| /\left|\Omega\left(b_{i}\right)\right|$ is not too small. Specifically, argue that $\left|\Omega\left(b_{i}\right)\right| \leq(n+1)\left|\Omega\left(b_{i-1}\right)\right|$.