View worked solution
Answer: 34 : 34
Let denote the number of matchings in a path graph with vertices.
We can establish a recurrence relation for by considering the last vertex in the path :
- Case 1: is not matched. The remaining vertices can be matched in ways.
- Case 2: is matched. It must be matched with its only neighbor . The remaining vertices can be matched in ways.
Thus, we obtain the recurrence relation:
The base cases are:
- (the empty matching on a single vertex)
- (the empty matching and the single-edge matching on two vertices)
Using the recurrence, we compute the values sequentially:
Therefore, the number of matchings in a path on vertices is 34.
Free practice · Your answers on this page are not saved.
