# How many samples are required to estimate the probabilities of a state?

Suppose that we have a quantum state of the form:
$$|\psi\rangle = \sqrt{p}|0\rangle + \sqrt{1-p}|1\rangle$$
In order to get an estimate of the probability of reading $$|0\rangle$$ or $$|1\rangle$$, we need to sample $$|\psi\rangle$$. How many times do we need to sample to have an $$\epsilon$$-estimate ? Keep in mind that this is different from quantum tomography because i we don't want to reconstruct the state from measurements, i just want to find an approximation of the probability of reading some state. In Supervised Learning with Quantum Computers, Schuld,M, et.al, the authors say that sampling from a qubit is equivalent to sampling from a bernoulli distribution,thus we can use the Wald interval:
$$\epsilon = z\sqrt{{\bar{p}(1-\bar{p})}\over S}$$ where $$z$$ is the confidence level, $$\bar{p}$$ is the average and $$S$$ the number of samples.
In the case of $$p$$ being close to either 0 or 1, we can use Wilson Score interval:
$$\epsilon = {z \over {1 + {z^2\over S}}}\sqrt{{{\bar{p}(1-\bar{p})}\over S} + {z^2 \over 4S^2}}$$ Now, the i ask the following question: What if i have a state with multiple qubits? How do i get an $$\epsilon$$-estimate of the probability of reading some state? If you can suggest some references, i would appreciateit. Thank you very much.

You can consider a state of $$n$$ qubits $$|\varphi\rangle = \sum_{i}^k\alpha_i|x_i\rangle$$ Where $$|x_i\rangle$$ is a vector of the computational basis (i.e. $$|x_i\rangle \in \{|0\rangle, |1\rangle\}^{\otimes n}$$) and each $$|x_i\rangle$$ has probability $$|\alpha_i|^2$$ of being measured.
After creating and sampling such state $$S$$ times, you could consider $$k$$ Bernoulli trials - one for each $$|x_i\rangle$$ - where for each $$i^{th}$$ trial you consider a success if you measure the state $$|x_i\rangle$$ and failure if you measure any other state.
In that way you could just reuse the Wald/Wilson intervals for each $$|x_i\rangle$$.
For instance, using the Wald interval, you could compute for each $$|x_i\rangle$$ $$\hat{p}_i = \frac{\text{ number of times } |x_i\rangle\text{ appears}}{S}$$ and say with confidence $$z$$ that $$|\alpha_i|^2 \in [\hat{p}_i - \epsilon, \hat{p}_i + \epsilon]$$ where $$\epsilon = z\sqrt{\frac{\hat{p}_i(1 - \hat{p}_i)}{S}}$$