Let B= "At least one lid is matched with the cup"
Then B=A 1+A2+...+A5.
P(A 1+A2+...+A5)
=P(A 1)+P(A2)+...+P(A5)
-P(A 1A2)-P(A 1A3)-...-P(A4A5)
+P(a 1a2 a3)-P(a 1a2 a4)+...+P(A3A4A5)-
...
+P(A 1A2A3A4A5)
Because there are five ways to match the lid! A little, so
P(a 1)= P(A2)= 1...=P(A5)=4! /5!
P(a 1 a2)= P(a 1 a3)= P...=P(A4A5)=3! /5!
...
P(A 1A2A3A4A5)= 1/5!
therefore
P(B)
=P(A 1+A2+...+A5)
=(4! /5! )*5-(3! /5! )*C(5,2)+(2! /5! )*C(5,3)-...+ 1/5!
P (all errors) = 1-PB)
= 1-(4! /5! )*5+(3! /5! )*C(5,2)-(2! /5! )*C(5,3)+...- 1/5!
=(3! /5! )*C(5,2)-(2! /5! )*C(5,3)+...- 1/5!