Question:

Let 𝐺 be an undirected graph, which is a path on 8 vertices. The number of matchings
in 𝐺 is ______. (answer in integer)

Show Hint

Let \(M(n)\) be the number of matchings in a path on \(n\) vertices. Show that \(M(n) = M(n-1) + M(n-2)\) by considering whether the last edge is used, with \(M(1)=1\) and \(M(2)=2\). This generates the sequence 1, 2, 3, 5, 8, 13, 21, 34, so \(M(8) = 34\).
Updated On: Jul 7, 2026
Show Solution
collegedunia
Verified By Collegedunia

Correct Answer: 34

Solution and Explanation

A path graph \(P_8\) has 8 vertices and 7 edges, labeled \(v_1 - v_2 - v_3 - \dots - v_8\). A matching is a set of edges in which no two edges share a common vertex. We must count all possible matchings, including the empty matching.

Step 1: Let \(M(n)\) denote the number of matchings in a path on \(n\) vertices. Focus on the last vertex \(v_n\) and the edge \((v_{n-1}, v_n)\).

Case (a): The edge \((v_{n-1}, v_n)\) is not used in the matching. Then the remaining choices form any matching of the path on the first \(n-1\) vertices, giving \(M(n-1)\) matchings.

Case (b): The edge \((v_{n-1}, v_n)\) is used. Then both \(v_{n-1}\) and \(v_n\) are already covered, so the remaining choices form any matching of the path on the first \(n-2\) vertices, giving \(M(n-2)\) matchings.

Since these two cases are disjoint and exhaustive, we get the recurrence:

\[ M(n) = M(n-1) + M(n-2) \]

Step 2: Set the base cases. For \(n = 1\) (a single vertex, no edges), the only matching is the empty one, so \(M(1) = 1\). For \(n = 2\) (a single edge), the matchings are the empty matching and the matching using that one edge, so \(M(2) = 2\).

Step 3: Apply the recurrence up to \(n = 8\):

\[ M(3) = M(2) + M(1) = 2 + 1 = 3 \]

\[ M(4) = M(3) + M(2) = 3 + 2 = 5 \]

\[ M(5) = M(4) + M(3) = 5 + 3 = 8 \]

\[ M(6) = M(5) + M(4) = 8 + 5 = 13 \]

\[ M(7) = M(6) + M(5) = 13 + 8 = 21 \]

\[ M(8) = M(7) + M(6) = 21 + 13 = 34 \]

Step 4: This sequence \(1, 2, 3, 5, 8, 13, 21, 34\) is exactly the Fibonacci pattern shifted by one index. The number of matchings in the path on 8 vertices is therefore 34.

The final answer is: \[\boxed{34}\]

Was this answer helpful?
0
0

Top GATE CS Engineering Mathematics Questions

View More Questions