Probability Function Hypergeometric distribution The question:
A shipment of 2500 car headlights contains 200 defective. You choose from this shipment without replacement until you have 18 which are not defective. Let X be the number of defective headlights you obtain. Give the probability function, $f(x)$
My attempt:
I use hypergeometric distribution.
$$ f(x) = \frac{{ 2300 \choose 18} {200 \choose x}}{ {2500 \choose x+18}}$$
The official answer:
In the first $(x+17)$ selection we need to get $x$ defective (use hypergeometric distribution)  and then we need a good one on the $(x+18)$ draw. Therefore, 
$$ f(x) = \frac{ {200 \choose x} {2300 \choose 17}} {{ 2500 \choose x+17}} * \frac{2283}{2500 - (x+17)}  $$
I think there might be a mistake because the answer seems to answer what is the probability that we draw 17 defective and the 18 th draw is not defective, and if that is the case I don’t seem to understand how they got the value 2283. 
 A: The hypergeometric distribution doesn't care about the order in which things are drawn. However, in this question the order is important: if you draw 18 not defective headlights straight away, then you stop drawing.
This is why the official answer is correct: you first draw 17 not defective bulbs and $x$ defective bulbs (where the order doesn't matter), AND then you draw the 18th defective bulb and so stop drawing bulbs.
The first fraction in their solution is the probability of drawing 17 not defective bulbs and $x$ defective bulbs.
The second fraction in their solution is the probability of drawing one more defective bulb, given you have already drawn 17 not defective bulbs and $x$ defective bulbs. "$2283$" is the number of defective bulbs left ($2500-17$) and "$2500-(x+17)$" is the number of bulbs left in the shipment.
A: The essential observation to make is that the selection process does not stop until one obtains the 18th non-defective headlight; therefore, if $X$ counts the random number of defective headlights selected, we must have drawn $X+18$ headlights in total; moreover, the final headlight selected is always non-defective, otherwise we could not have stopped at that point.  If you say that we had already drawn $18$ non-defective headlights, then you did not stop when you were supposed to.
With this in mind, we now see why the solution is structured as it is:  If $X+17$ is the total number of headlights selected prior to the final selection that stops the process, then there are exactly $X$ defective headlights and $17$ non-defective ones we have obtained so far, and these can be ordered in any way--there are no additional restrictions, because the $18^{\rm th}$ non-defective headlight has not yet been drawn.  The probability obeys the hypergeometric distribution. But now we must also include the probability that the next draw is non-defective, otherwise the process would not stop at that point.  At that point, there are $2500 - (X + 17)$ remaining headlights, of which $2500 - 200 - 17$ are non-defective, thus the probability of selecting a non-defective headlight is simply $$\frac{2283}{2500 - (X+17)}.$$
