a) For each student, Patrick can choose between five different colors. He can thus give out pencils in $5^3 =\pmb{125}$ different ways.
b) Patrick can choose among five colors for the first student, four colors for the second student and three colors for the third student. This can be done in $5 \cdot 4 \cdot 3 =\pmb{60}$ different ways.
c) Patrick will choose three students from a group of ten to which he will give one green pencil each. This can be done in $\displaystyle{\binom{10}{3}} = \dfrac{10 \ \cdot \ 9 \ \cdot \ 7}{3!} =\pmb{120}$ different ways.
d) This is the same problem as c) but the difference is now that the color of the pencils may vary. For each of the $120$ possible distributions of pencils in question c), the pencils could have $5 \cdot 4 \cdot 3 = 120$ different color combinations. Patrick can thus give out the three pens in $120 \cdot 120 =\pmb{14 \ 400}$ different ways.
e) This problem can be divided into three different cases:
(1) All students have one pencil (1,1,1)
In this case, there is only one way in which the pencils can be distributed: everyone gets one pencil each.
(2) One student has no pencil (0,1,2)
In this case, a student has two pencils, a student has a pen and a student does not get a pen. This can be done in $3! = 6$ different ways.
(3) Two students have no pencil (0,0,3)
This means that one student has all three pencils while the others have no pencil. This can be done in $\frac{3}{2!} = 3$ different ways.
Patrick can thus give three pink pencils to three students in $1 + 6 + 3 =\pmb{10}$ different ways.
f) This is almost the same task as e) but with the difference that the color of the pencils may differ. We can thus divide the problem into the following four cases:
(1) 0 pencils are red or brown
(2) 1 pencil is red or brown
(3) 2 are red or brown
(4) 3 pencils are red or brown
We want at most two pencils to be red or brown, which is the sum of cases (1), (2) and (3). The easiest way to determine this is to use the subtraction method. We simply determine the total number ot outcomes and subtract the number of pencils in case (4). There are $5^3 = 125$ different ways in total that the three pencils could be colored. (Because the pencils will be given to three different students, the order in which the pencils are chosen matters). If all three pencils must be either red or brown, there are $2^3 = 8$ ways in which the pencils could be chosen.
In question e), we determined that Patrick could give three same-colored pencils to three students in 10 different ways. For each of these 10 distributions, the pencils can now have $125 - 8 = 117$ unique color combinations. In total, there are thus $10 \cdot 117 =\pmb{1170}$ different ways that Patrick can give three pencils to three students with at most two pencils being either red or brown.