Lights at the ends of a row
Ten lamps stand in a row. Four are switched on. No two lit lamps are adjacent, and exactly one end lamp is lit. How many lighting patterns are possible?
Hint
Choose which end is lit. Which seven positions are still available?
Show answer and methods 2 methods
Answer
20
Method 1 Compress the gaps
Suppose the left end is lit. Positions 2 and 10 must be dark. Choose three non-adjacent positions from 3 through 9. If their indices within these seven positions are a < b < c, then a, b-1, c-2 form an ordinary three-element subset of 1 through 5. This reversible transformation gives 10 choices. The right end gives another 10.
Method 2 Build a recurrence from the last lamp
Fix the lit end. There are seven eligible positions for the other three lit lamps. Let F(n,k) count ways to light k nonadjacent lamps in n positions. If the last lamp is dark there are F(n-1,k) ways; if it is lit its neighbour must be dark, giving F(n-2,k-1). This gives F(7,3)=F(6,3)+F(5,2). For three lights in six slots the four possibilities are 135, 136, 146 and 246. For two in five slots, 10 pairs minus 4 adjacent pairs gives 6. Thus each end gives 4+6=10, and the two ends give 20.