Let be an undirected graph, which is a path on 8 vertices. The number of matchings in is ______. (answer in integer)
GATE 2026 CS1 Q.57: solution and answer
Answer and solution
ANSWER
The number of matchings in a path on 8 vertices is 34.
Official answer: 34Source: Official answer key, GATE 2026 CS1 (IIT Guwahati)
Let be the number of matchings (including the empty one) in the path on vertices. has no edges, so ; has one edge, so (the empty matching, or the single edge).
Split on the last vertex . If is unmatched, the rest is any matching of , giving choices. If is matched, it must be matched to its only neighbour , and the rest is any matching of , giving choices. The two cases are disjoint and cover everything.
So , a Fibonacci recurrence.
Compute: , , , , , .
Check by counting on edges. A matching with edges in the path (7 edges) is a choice of pairwise non-adjacent edges, which can be done in ways. So the count is .
The empty matching is included, because a matching is any set of pairwise non-adjacent edges, and the empty set qualifies. Both methods agree: the answer is .
KEY IDEA
Count matchings of a path with a recurrence on the last vertex: it is either unmatched or matched to its single neighbour, so , which gives the Fibonacci numbers. The empty matching counts.
WATCH OUT FOR
Leaving out the empty matching and answering 33, or counting only perfect matchings (which gives 1) or only maximal ones. Another slip is starting the recurrence with or .
From the GATE 2026 CS1 paper. Every question of this paper · Download the full paper · All 14 Graph theory questions, with notes
More Graph theory questions
- GATE 2024 CS1 Q.51 · MSQ · 2 marksThe chromatic number of a graph is the minimum number of colours used in a proper colouring of the graph.
- GATE 2024 CS2 Q.17 · MCQ · 1 markLet A be the adjacency matrix of a simple undirected graph G. Suppose A is its own inverse.
- GATE 2024 CS2 Q.60 · NAT · 2 marksThe chromatic number of a graph is the minimum number of colours used in a proper colouring of the graph.
- GATE 2022 CS Q.30 · NAT · 1 markConsider a simple undirected graph of 10 vertices. If the graph is disconnected, then the maximum number of…
