What is the sample size required to observe minimum numbers of each of two types of items? Suppose I have a large population consisting of 1 million items. 75% of these consist of type A and 25% of type B. I need to take a sample from the population but don't know until after the sample what the numbers of each type will be in the sample. My final sample needs to have a minimum of x of type A and and a minimum of y of type B. How many would I have to sample in total to be sure of achieving these numbers with 95% confidence?
 A: Let's begin with a general formulation of your problem.
You contemplate taking a sample of a population in some way.  A sample of size $n$ will yield two counts: the number of A's and the number of B's.  Let $X_n$ represent the count of A's, so that $n-X_n$ is the count of B's.  When the sample is random, $X_n$ will be a random variable.
The event of interest to you is that $X_n \ge x$ and $n-X_n \ge y$ where you have specified the thresholds $x$ and $y.$  We may combine these relations mathematically into
$$\mathcal{E}_n:\ x \le X_n \le n-y.$$
Given a probability $1-\alpha,$ such as $95\% = 100 - 5\%,$ you would like to find the least $n\ge 1$ for which $\Pr(\mathcal{E}_n)\ge 1-\alpha.$  To do so, we will have to develop a formula for this probability in terms of $n$ and then solve the inequality.
That's it for the formulation.  Let's turn to the analysis of your specific case.
With $x=800,$ $y=600,$ and a population of a million, it doesn't matter whether you sample with or without replacement, because you will find $n$ is going to be a tiny fraction of the population size.  Just make sure you sample randomly and independently.
Since there are a huge number of A's and B's in the population and the sample size obviously has to be at least $x+y=1400,$ that's large enough to guarantee that the Normal approximation to the distribution of $X_n$ will be excellent.  This simplifies the problem, because all we need to work out are the mean and variance of $X_n.$  The mean obviously is $E[X_n]=3n/4$ because $75\% = 3/4$ of the population consists of A's.  The variance depends a tiny bit on whether you sample with or without replacement.  When sampling with replacement, $X_n$ has a Binomial distribution with parameters $3/4$ and $n,$ whence its variance is
$$\operatorname{Var}(X_n) = (3/4)(1-3/4)n = \frac{3n}{16}.$$
As usual, it's simplest to standardize $X_n$ for this calculation, so re-express the event as
$$\mathcal{E}_n:\ \frac{x - E[X_n]}{\sqrt{\operatorname{Var}(X_n)}} \le \frac{X - E[X_n]}{\sqrt{\operatorname{Var}(X_n)}} \le \frac{n-y - E[X_n]}{\sqrt{\operatorname{Var}(X_n)}},$$
which simplifies to
$$\mathcal{E}_n:\ \frac{x - 3n/4}{\sqrt{3n/16}} \le Z_n \le \frac{n-y - 3n/4}{\sqrt{3n/16}}$$
where $Z_n$ (the standardized version of $X_n$) has a standard Normal distribution. Writing $\Phi$ for the standard Normal distribution function, we find
$$1-\alpha \le \Pr(\mathcal{E}_n) = \Phi\left(\frac{n-y - 3n/4}{\sqrt{3n/16}}\right) - \Phi\left(\frac{x - 3n/4}{\sqrt{3n/16}}\right).$$
That's a complicated mess: it needs numerical methods to solve, such as repeatedly looking up values in a table or--much better--using a root finder.  Deploy the latter by expressing the problem as

Find the smallest $n\gt 0$ for which $$0 = f(n) = \Phi\left(\frac{n-y - 3n/4}{\sqrt{3n/16}}\right) - \Phi\left(\frac{x - 3n/4}{\sqrt{3n/16}}\right) - (1-\alpha)$$ (and then round it up to the nearest integer).

It's not hard to show that such a root exists and is unique (because $f$ is a continuous strictly increasing function with a negative limiting value as $n\to 0$ and positive limit $\alpha$ as $n\to\infty$).
Here, as an illustration, is an R implementation using uniroot, its native root finding function, to find this zero of $f:$
f <- function(alpha=0.05, x=800, y=600, A=0.75) {
  sigma <- sqrt(A*(1-A))
  f <- function(n) diff(pnorm((c(x, n-y) - A*n) / (sigma * sqrt(n)))) - (1-alpha)
  xi <- x/A + y/(1-A)
  ceiling(uniroot(f, c(1, xi - 8*qnorm(alpha)*sigma*sqrt(xi)))$root)
}

pnorm implements $\Phi.$
Most of the work (on the last line) is overestimating the sample size so that uniroot has a finite interval in which to search.  I use a rough formula that should work in any situation where this analysis applies.
This solution indicates your sample size should be at least $n=2544.$
As a check, I simulated 10,000 samples of this size from your population of one million, without replacement.  In 95.3% of these samples at least $800$ A's and at least $600$ B's were observed.  This percentage is not significantly different from the target of 95%.  Running such a simulation is a reliable, straightforward check of the answer (which, after all, was based on a series of approximations and assumptions).
