A random sample of size $n$ is drawn from a lot of $N$ items, of which a fraction $p$ are defective. Let $X = $ number of defective items in the sample. Determine $f_X (x) = P(X = x)$ if
$\cdot$ The sample is ordered with replacement
$\cdot$ The sample is ordered without replacement
If is ordered without replacement we have $n(\Omega) = \frac{N!}{(N-n)!}$ and I'm not sure if the numerator is $$n(A) = \frac{Np!}{(Np-x)!} \cdot \frac{(N-Np)!}{(N-Np-(Np-x))!} $$ because we want $x$ to be defective, and the rest not defective, and $P(X = x) =\frac{n(A)}{n(\Omega)}$.
If is ordered with replacement we have $n(\Omega) = N^{n}$ and I'm not sure if the numerator is
$$n(A) = Np (Np-1) (Np-2) \cdots (Np-x)! $$
and $P(X = x) =\frac{n(A)}{n(\Omega)}$.
I would appreciate some help, I am a little confused, with order it becomes more complicated for me to think.
Order does not affect the distribution of the total number of defectives in the sample. Replacement does.
Sampling without replacement, you have a hypergeometric distribution:
$$\mathbb P(X=x)= \frac{{Np \choose x}{N-Np \choose n-x}}{{N \choose n}}=\frac{(Np)!\,(N-Np)!\,n!\,(N-n)!}{x! \,(Np-x)! \, (n-x)!\, (N-Np-n+x)!}.$$
Sampling with replacement, you have a binomial distribution:
$$\mathbb P(X=x)= {n \choose x} p^x (1-p)^{n-x}.$$