6-digits code arrangement 6-digit codes with no repeated digits are made by using {1,2,3,4,5,6}. Find the probability that a code chosen at random out of all 6-digit codes made will have both 1 as the first digit and 6 as the last digit but not both.
My answer:
Total probability of arranging the 6-digit codes - probability that has 1 as the first digit and 6 as the last digit.
$\frac{(6! - 4!)}{6!} = \frac{29}{30}$
The answer given is $\frac{4}{15}$.
May I know what I have done incorrectly?
 A: The question makes sense only if it is asking for "either A is first XOR B is last"
And when probabilities are asked for, it is often easier to compute them directly rather than by counting permutations.
P(A first & B not last) +P(B last & A not first)
$ = \Large\frac16\frac45 + \frac16\frac45 = \frac4{15}$
A: Assuming that the question is either $1$ is first or $6$ is last (either-or translates to the logical exclusive-or), then we can use inclusion-exclusion to compute the probability that $1$ is first or $6$ is last (allowing the possibility that we have both):
$$
\overbrace{\quad\ \frac16\ \quad}^\text{$1$ is first}+\overbrace{\quad\ \frac16\ \quad}^\text{$6$ is last}-\overbrace{\quad\ \frac1{30}\ \quad}^{\substack{\text{$1$ is first}\\\text{and}\\\text{$6$ is last}}}=\overbrace{\quad\ \frac3{10}\ \quad}^{\substack{\text{$1$ is first}\\\text{or}\vphantom{d}\\\text{$6$ is last}}}
$$
To get the probability that we have either one or the other, we need to subtract the probability that we have both (again):
$$
\overbrace{\quad\ \frac3{10}\ \quad}^{\substack{\text{$1$ is first}\\\text{or}\vphantom{d}\\\text{$6$ is last}}}-\overbrace{\quad\ \frac1{30}\ \quad}^{\substack{\text{$1$ is first}\\\text{and}\\\text{$6$ is last}}}=\overbrace{\quad\ \frac4{15}\ \quad}^{\substack{\text{either}\vphantom{g}\\\text{$1$ is first}\\\text{or}\vphantom{d}\\\text{$6$ is last}}}
$$
A: If you mean "either has a $1$ as the first digit or a $6$ as the final digit, but not both", then there is an issue with your calculation.
You correctly subtracted off the cases where the codes have a $1$ as the first digit AND a $6$ as the last digit, but you did not subtract off the cases where the first digit is NOT a $1$ AND the last digit is NOT a $6$.
