is this a combination or permutation problem? I have see the following problem in a Discrete Maths book and it says:

In the first case the author solves it like a permutation, so he multiply eight three times which is like using the formula $$P(n,k)=n^{k}$$
obtaining the result of $$n^{k}=8^{3}=512$$ samples of 3 with repetition.
However, for me it seems that is a combination problem, because the order is irrelevant in this case; so I could use the following formula:
$$\binom{8+3-1}{3}=120$$ samples of 3 students with repetition allowed
In the same way for option (b) the author uses the product of $$8.7.6$$ which is like using the formula of permutation without repetition giving 336 samples of 3 students. However, I believe that in this case also the order is not relevant so one could use the formula:
$$\binom{8}{3}=56$$
samples of 3 students without repetition.
Any thoughts about this trivial problem?
Thanks
 A: From the use of the word "sample" I assume the author has in mind some model of probability for this question, rather than posing a question merely about combinatorics.

What this author calls "number of samples" is what I think most authors would refer to as the size of the sample space. This author's "sample" is presumably what others would call an element of the sample space.
In a question like the one presented, however, the sample space is actually not defined. You have to devise a suitable sample space that matches the description, but technically there is more than one possible choice.
The only way I see to make sense of a question like this is to remember that people who ask questions like this, expecting you to come up with a particular answer, seem usually to be looking for a simple answer that gives a sample space with uniform probability over all elements of the sample space.
When selecting three students with replacement,
it is certainly possible to define a sample space in which choosing student A twice and student B once, regardless of the order in which the choices occurred, is considered to be just one element of the sample space.
But you also need to consider the possibility that students A, B, and C are each chosen once. If you take all ways of selecting students A, B, and C with replacement regardless of order of selection and call this another element of your sample space,
you now have one element that is twice as likely as another element.
(Exercise: which of these two is the more likely element: 2 As and 1 B, or one each of A, B, and C?)
A simple way to get a uniform sample space is to take into account the order in which the students were selected, so choosing A, then A, then B is a different element of the sample space than choosing A, then B, then A.
When sampling without replacement you can ignore the order of selection and still get a uniform sample space. So the author's decision to use permutations rather than combinations seems arbitrary.
It may be that the answer to part (b) is influenced by part (a);
that is, taking order into account is how we make sense of (a), so it did not occur to the author to stop paying attention to order for (b).

If the next exercise lists the eight students and asks for the probability that student A is the last student selected in each of the cases (a) and (b), then that would also be a motivation to consider the order of selection important in part (b).
I don't condone a book posing questions in this way
(in fact I find it quite objectionable),
but it often pays to read ahead a little bit in cases where there is doubt as to what the author has in mind in a particular part of a book.
I hope you are actually able to learn some math despite the way this book appears to be written.
