You can view this as counting integer solutions. x1,x2,x3,x4 representing the spacing. x1 is the spots before the first car, x2 between the first and the second, x3 between the second and third, x4 after the third.
For the no two cars adjacent the constraints are: x1,x4>=0, x2,x3>=1, x1+x2+x3+x4=7. For at least two spaces, x1,x4>=0, x2,x3>=2, x1+x2+x3+x4=7.
Then you can use stars-and-bars to count the solutions.
Subtracting 1 from x2,x3 turns x1,x4>=0, x2,x3>=1, x1+x2+x3+x4=7 into x1,x2,x3,x4>=0, x1+x2+x3+x4=5, and there are C(5+3,3) ways.
Subtracting 2 from x2,x3 turns x1,x4>=0, x2,x3>=2, x1+x2+x3+x4=7 into x1,x2,x3,x4>=0,x1+x2+x3+x4=3, and there are C(3+3,3) ways.
C(3+3,3)/C(5+3,3) = 5/14
No comments:
Post a Comment